DanielGavin / ols

Language server for Odin
MIT License
378 stars 56 forks source link

Helix - The OLS example code of integration doesn't work with the current version of Helix, I give one possible solution to it. #282

Closed joaocarvalhoopen closed 7 months ago

joaocarvalhoopen commented 7 months ago

Hello, today I tested Helix text editor with OLS for Odin, and it works pretty well! But the current OLS instructions for Helix don't work it says to add to the following file

./config/helix/languages.toml

the following:

[[language]]
name = "odin"
scope = "scope.odin"
file-types = ["odin"]
comment-token = "//"
indent = { tab-width = 2, unit = " " }
language-server = { command = "ols" }
injection-regex = "odin"
roots = ["ols.json"]
formatter = { command = "odinfmt", args = [ "-stdin", "true" ] }

but I found that it doesn't work for the current version, after some searching, one should go to the Helix github file and search for the most current configuration for OLS.

https://github.com/helix-editor/helix/blob/master/languages.toml
[language-server]
ols = { command = "ols", args = [] }

[[language]]
name = "odin"
auto-format = false
scope = "source.odin"
file-types = ["odin"]
roots = ["ols.json"]
language-servers = [ "ols" ]
comment-token = "//"
indent = { tab-width = 4, unit = "\t" }

[[grammar]]
name = "odin"
source = { git = "https://github.com/ap29600/tree-sitter-odin", rev = "b219207e49ffca2952529d33e94ed63b1b75c4f1" }

The following mix of the two previous and with the https://github.com/amaanq/tree-sitter-odin suggested by layton it is even better:

[language-server]
ols = { command = "ols", args = [] }

[[language]]
name = "odin"
#auto-format = false
scope = "source.odin"
file-types = ["odin"]
roots = ["ols.json"]
language-servers = [ "ols" ]
comment-token = "//"
indent = { tab-width = 2, unit = " " }
injection-regex = "odin"
formatter = { command = "odinfmt", args = [ "-stdin", "true" ] }

[[grammar]]
name = "odin"
#source = { git = "https://github.com/ap29600/tree-sitter-odin", rev = "b219207e49ffca2952529d33e94ed63b1b75c4f1" }
source = { git = "https://github.com/amaanq/tree-sitter-odin" }

Best regards, Joao Nuno Carvalho

joaocarvalhoopen commented 7 months ago

Hello again,

I made a repository explaining how to configure Helix for Odin and some kind of manual with pretty pictures :-)

Github - Helix editor for Odin programming Language https://github.com/joaocarvalhoopen/Helix_editor_for_the_Odin_programming_Language

Best regards, Joao Nuno Carvalho

DanielGavin commented 7 months ago

Thanks for the information! Changed the readme to link your installation guide.