lite-xl-plugins icon indicating copy to clipboard operation
lite-xl-plugins copied to clipboard

Port of snippets lite plugin from a327ex

Open Titousensei opened this issue 2 years ago • 2 comments

Original repo: https://github.com/a327ex/lite-plugins/ Original source: https://raw.githubusercontent.com/a327ex/lite-plugins/master/plugins/snippets.lua

Should solve #1044 maybe?

This PR is just making the orginal code compatible with lite-xl. No logic change or new features were added.

Tested locally:

  1. open a lua file (for example new file test.lua)
  2. type f then press the tab key
  3. observe the snippet in your file: function () was added.

To add new snippets: edit snippets.lua and follow the instructions in the top comment.

Titousensei avatar Jan 09 '23 22:01 Titousensei

Ahh finally someone did this, thank you thank you! We need this for LSP :smiley:

Now that you are on this, maybe asking for too much :cry: but... could you implement support for what is documented here:

https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax

jgmdev avatar Jan 09 '23 23:01 jgmdev

The last time I gave a look at the original plugin it had implementation problems, like overriding Doc:text_input and keymap.on_key_pressed for functionality that should really be replaced by commands. Another improvement could be using our autocomplete mechanism, which should also be improved to support the various use cases that this plugin might need (for example the autocomplete suggestion could be made to be the description of the snippet that's going to be inserted).

Guldoman avatar Jan 10 '23 02:01 Guldoman