WIP LSP for C3 language
Using tree-sitter grammar rules from https://github.com/cbuttner/tree-sitter-c3.git
Features
- Indexes workspace variables and function definitions
- TextDocumentCompletion. Suggests symbols located in project's source code. See notes.
- Go to declaration.
- Go to definition.
- Hover Displays information about symbol under cursor.
Precompiled binaries for the following operating systems are available:
You can also build from source:
- Download and install golang: https://go.dev/
- Clone this repo
- Run
make build
: This will createc3-lsp
inserver/bin
folder.
There's a simple vscode extension available for download here: download vix
Be sure to configure it with the path of the lsp server binary.
Current status
Index status
- Attributes
- Variables & type
- Global constants
- Functions
- Function parameters
- Function return type
- Enums + Enumerators
- base type
- enum methods
- Faults
- Structs
- Struct members
- Struct methods
- Struct implementing interface
- Anonymous bitstructs
- [~] Struct subtyping: Only for those subtypes defined in same file.
- bitstruct
- Unions
- Union members
- [~] defines
- Interfaces
- [~] Macros
- return type
- imports
- modules
- multiple modules per file
- implicit module name is assumed to be the file name, converted to lower case, with any invalid characters replaced by underscore (_).
- Generics
- Language Builtins
LSP Features Status
- Index scopes and its hierarchy to improve hover and Auto Completion.
- Complete Go to declaration
- Find symbol in same scope
- Find symbol in parent scope
- Find symbol present in same module, but different file
- Find symbol in imported module
- Find symbol in implicit parent module.
- Find symbol in stdlib
- [~] TextDocumentCompletion:
- Struct methods are not suggested until first letter is written.
- Completion of symbols defined in stdlib.
- LSP specification: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
- treesitter
- Queries docs: https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
- Queries: https://emacs-tree-sitter.github.io/syntax-highlighting/queries/
- Tree-sitter - a new parsing system for programming tools (video) https://www.thestrangeloop.com/2018/tree-sitter---a-new-parsing-system-for-programming-tools.html