L3MON4D3 / LuaSnip

Snippet Engine for Neovim written in Lua.
Apache License 2.0
3.45k stars 245 forks source link

Feature request: Expose types of snippet globals for nicer development #1025

Open MariaSolOs opened 1 year ago

MariaSolOs commented 1 year ago

When writing custom snippets, it would be really helpful to use type annotations for s, t, and other global snippet constructors for better editing support :)

bew commented 1 year ago

Related #378 (but incomplete)

L3MON4D3 commented 1 year ago

Oh yeah, for sure! As far as I understand, this would basically be whatever is in DOC.md, but as emmylua-annotation, so lua-language-server can parse it? If so, I'd say there is a choice to make:

I'd honestly be fine with either option since I don't really anticipate many major additions to luasnip, so the additional long-time-work induced by the first option may not outweigh one-time work and complexity introduced by the second one (though the second one may be fun to figure out)

Unfortunately, I really don't use annotations at all though, so my motivation for doing either is pretty low :sweat_smile:

MariaSolOs commented 1 year ago

@L3MON4D3 that's fair. I think that if no major API changes are predicted, then option 1 is fine.

Any reason why #378 hasn't been merged? Despite being incomplete, it's still an improvement.

L3MON4D3 commented 1 year ago

Only that it's marked as draft, and adding annotations for a small number of api-functions only seemed a bit weird. But you're right, better that than nothing. I'll look into getting it merged

MariaSolOs commented 1 year ago

Sounds good. I think that splitting the work into smaller PRs will be less overwhelming than documenting the entire API at once (I think no one has the motivation for that hehe).

I’m also happy to help with this btw!

L3MON4D3 commented 1 year ago

Sounds good. I think that splitting the work into smaller PRs will be less overwhelming than documenting the entire API at once

Ah, yeah, probably also true :D

I’m also happy to help with this btw!

Yay, hoped for just that :P Best wait until I'm done with #941 (shouldn't be long now), lots of changes to the files where api is defined in there

UtkarshVerma commented 3 months ago

Hi, I am also interested in this. Since the other PR is merged. Is there anything else blocking this?