Love for Neovim
Some love for neovim 💕
Its not the first time I blog about neovim. Hence I just had an experience, where I was thankfull to have an editor, that I can customize to the maximum.
I already wrote about the treesitter thingy. Now in my dreams 🏰 I was building a LSP Server for this language, but always tought, that this is silly, impossible and even useless.
What would the language server even provide? 🤔 Highlight is solved and in my opinion better and faster with tree-sitter. Go to definition is not a thing. There are no function definitions in this language.
Every variable is global and can be declared multiple times. Its up to the user to get this right. So how did my coworker kept track of all this mess?
Turns out he came to the same concepts language builders had as well. He just didn't do it explicitly. He kept track of the variables in multiple excel files. Knowing that he should not touch the same variable in the same scope, he made sure, that a variable is only ever used within a certain aria of code. Like that he rarely shot himself in the foot, which to me was amazing. 🎩
What has this all to do with an LSP and neovim? Well I stumpled upon null_ls or new none_ls Which gave me the relatively simple possibility to get hover information for those variables.
Unfortunately I can't open source this little plugin yet, but what it essentially does is:
- Lookup the current tree-sitter node under the cursor
- Ask a nushell script to open the excel files
- Find the variable name in the specified column
- Give back a popup window with the description of the variable
The variable names have very short names like: AK
Which in this case means: Antriebskasten
And there is even more complex ones.
Why tree-sitter and not only asking for cword
?
There is even multiple appearences of a variable.
AK
or $AK
can mean the same thing, but would deliver different cwords.
With none_ls, neovim, nushell and tree-sitter power I was able to get LSP information into this project, that is actually usefull.
I think in this short time, this wouldn't have been possible with any other editor. So thanks to all the contributors of this great project! 🚀