Repository navigation
forked from DanielGavin/ols
Folders and files
Repository files navigation
Language server for Odin. This project is still in early development.
NOTE(Linux and MacOS are not supported until the compiler catches up on those platforms)
cd ols
./build.bat
All configurations is contained in one json file that must be named ols.json in your main workspace.
In order for the language server to index your files, the ols.json must contain all the collections in your project.
Example of ols.json:
{
"collections": [{ "name": "core", "path": "c:/path/to/Odin/core" },
{ "name": "shared", "path": "c:/path/to/MyProject/src" }],
"thread_pool_count": 4,
"enable_semantic_tokens": false,
"enable_document_symbols": true,
"enable_hover": true
}
Support Language server features:
- Completion
- Go to definition
- Semantic tokens(really unstable and unfinished)
- Document symbols
- Signature help
- Hover
Install the extension https://github.com/DanielGavin/ols-vscode
Install the package https://github.com/sublimelsp/LSP
Configuration of the LSP:
{
"clients":
{
"odin":
{
"command":
[
"C:/path/to/ols"
],
"enabled": true,
"languageId": "odin",
"scopes":
[
"source.odin"
],
"syntaxes":
[
"Packages/Odin/Odin.sublime-syntax"
]
}
},
"only_show_lsp_completions": true,
}
Install Coc.
Configuration of the LSP:
{
"languageserver": {
"odin": {
"command": "ols",
"filetypes": ["odin"],
"rootPatterns": ["ols.json"]
}
}
}
;; With odin-mode (https://github.com/mattt-b/odin-mode) and lsp-mode already added to your init.el of course!.
(setq-default lsp-auto-guess-root t) ;; if you work with Projectile/project.el this will help find the ols.json file.
(defvar lsp-language-id-configuration '((odin-mode . "odin")))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "/path/to/ols/executable")
:major-modes '(odin-mode)
:server-id 'ols
:multi-root t)) ;; This is just so lsp-mode sends the "workspaceFolders" param to the server.
(add-hook 'odin-mode-hook #'lsp)