simple-completion-language-server icon indicating copy to clipboard operation
simple-completion-language-server copied to clipboard

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

Open jmetz opened this issue 1 year ago • 5 comments

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.

jmetz avatar Jun 27 '24 09:06 jmetz

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 ?

estin avatar Jul 01 '24 06:07 estin

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

jmetz avatar Jul 01 '24 07:07 jmetz

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

GameDungeon avatar Aug 11 '24 21:08 GameDungeon

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.

estin avatar Aug 12 '24 13:08 estin

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.

GameDungeon avatar Aug 12 '24 13:08 GameDungeon