estin / simple-completion-language-server

Language server to enable word completion and snippets for Helix editor
MIT License
199 stars 10 forks source link

Support variable such as `CURRENT_YEAR` used by friendly-snippets #68

Open jmetz opened 3 months ago

jmetz commented 3 months ago

There are a bunch of common system variables that spring to mind, including date-time related, username, email, or perhaps even the result of a shell command.

estin commented 3 months ago

Hi! It can be implemented with some restrictions. I don't use snippets heavily and don't know common standards for variables in snippets. This is "standard": https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables ?

jmetz commented 3 months ago

Yeah that looks pretty comparable to other snippet systems I've used before 👍

GameDungeon commented 1 month ago

Those would be great, especially TM_SELECTED_TEXT which allows for way more powerful snippets.

estin commented 1 month ago

Hi!

I have take a look on it https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax

Variable resolving is the task for editor (client side), not for language-server. I hope after https://github.com/helix-editor/helix/pull/9801 we can use varaibles in templates

For scls we can add feature - snippets as result of shell execution, like :pipe. Helix now allow via keymap configure hot keys for :pipe my-snippet.sh. But scls can give menu as regular snippet and execute on complete/resolve with litle hacks.

GameDungeon commented 1 month ago

I just checked the code for helix-editor/helix#9801 and tested it (which is the branch I use). It currently implements variable parsing, but it does not seem to have support for any specific variables yet, but the fact it has got that far is good news.