This looks really neat and handy especially the type annotations part. I always got frustrated when accidentally putting the wrong type into a column.
How's the Language Server support for this? Last time I tried ZLS, it was quite well rounded so I am curious to know if this type annotations would work with it or not. Would be really cool if they do.
I have never been able to fully adopt zig due to how frustrating working with strings is but I absolutely loved the comptime functionality.
I think the only real way you can run make a language server understand comptime code is using the compiler as a library, similar to how Nim does it - nimsuggest (the tool for autocompletion, definitions, etc) is basically the compiler itself with some nimsuggest-specific stuff, so it understand macros, templates, compile time code evaluation, etc.
Comments
This looks really neat and handy especially the type annotations part. I always got frustrated when accidentally putting the wrong type into a column.
How's the Language Server support for this? Last time I tried ZLS, it was quite well rounded so I am curious to know if this type annotations would work with it or not. Would be really cool if they do.
I have never been able to fully adopt zig due to how frustrating working with strings is but I absolutely loved the comptime functionality.
ZLS currently does not run any comptime code as far as i know
It would be cool to have an official Zig language server that can do it
I think the only real way you can run make a language server understand comptime code is using the compiler as a library, similar to how Nim does it - nimsuggest (the tool for autocompletion, definitions, etc) is basically the compiler itself with some nimsuggest-specific stuff, so it understand macros, templates, compile time code evaluation, etc.
Isn't that's how most LSP servers are implemented? I'm only vaguely familiar with clangd.
Yes. An LSP has to work along with the compiler, or it has to become an alternative compiler.
For example, from the article "Why LSP?" [1]
"It is known that compilers are complicated, and a language server is a compiler and then some."
[1]: https://matklad.github.io//2022/04/25/why-lsp.html
It's moving in that direction, but far from all are based on their compiler still.
from what i understood, that is what they are planning to do, have an official built in language server
zls doesn't support this unfortunately. I don't know what the plans are for comptime support.