Skip to content

ComingToy/glslx

Repository files navigation

glslx: GLSL Language Server ✨

License C++17 CMake build

glslx is a GLSL language server based on the official Khronos Group glslang compiler library, providing comprehensive and accurate language support for GLSL shader development. 🚀

✨ Features

✅ Implemented Features

  • Smart Code Completion
    • User-defined variables, structs, and functions
    • Built-in variables, functions, and data types
    • Language keywords and extension directives
    • Struct member
  • Precise Code Navigation
    • Go to Definition
    • Document Outline View
  • Real-time Error Diagnostics
    • Syntax and semantic checking via glslang
  • Header File Support
    • Full handling of #include directives
  • Conditional Compilation Support
    • Grey out code in inactive preprocessor branches

🚧 Planned Features

  • Semantic Tokens
  • Hover Documentation
  • Find References

🔧 Build Guide

System Requirements

  • CMake 3.26+
  • C++17-compatible compiler

Build Steps

  1. Clone the repository (including submodules):

    git clone --recursive https://github.com/ComingToy/glslx.git  
    cd glslx  
  2. Configure and build the project:

    cmake -DENABLE_OPT=OFF -B build -S .  
    cmake --build build --parallel  
  3. Install (optional):

    sudo cp build/src/glslx /usr/local/bin/  

📖 Usage

Neovim (coc.nvim) Configuration Example

  1. Edit the coc.nvim configuration file ~/.config/nvim/coc-settings.json:

    {  
      "languageserver": {  
        "glslang": {  
          "command": "/usr/local/bin/glslx",  
          "filetypes": ["glslx"]  
        }  
      }  
    }  
  2. Compilation Command Configuration:
    Create a compile_commands_glslx.json file in the project root, following the Compilation Database Specification. Example:

    [  
      {  
        "directory": "/path/to/project",  
        "command": "glslc --target-env=vulkan1.3 -DInputType=float16_t -o output.spv -I /path/to/includes source.comp",  
        "file": "/path/to/project/source.comp",  
        "output": "output.spv"  
      }  
    ]  

🎥 Feature Demos

Feature Demo
Code Diagnostics Code Diagnostics
Extension Completion Extension Completion
Function Completion Function Completion
Struct Member Completion Struct Member Completion
Goto Definition Goto Definition
Conditional Compilation Support Conditional Compilation Support

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

glslang language server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published