Ketho / vscode-wow-api

VS Code extension for World of Warcraft AddOns
https://marketplace.visualstudio.com/items?itemName=ketho.wow-api
MIT License
154 stars 33 forks source link

(request) Add globalstrings to the Annotations folder in a Lua compatible form #162

Open brittyazel opened 3 months ago

brittyazel commented 3 months ago

Right now we have the full globalstring list for each language in the /src folder, but these files are .ts files and not immediately understandable by EmmyLua. It would be helpful to have these global strings available within the IDE during development, and it seems like it wouldn't take too much effort to expose these strings for EmmyLua to parse. Would it be possible to have a version of these globalstrings, or maybe just the english versions, put into /Annotations to be picked up by the IDE?

Ketho commented 3 months ago

I remember deciding against having globalstrings in the annotations, I thought it would needlessly increase loading times and be too big to parse (as in LuaLS will not even load files bigger than 500 KB by default), and pollute global completion.

Globalstrings should still be available for completion but only when there are 4+ uppercase characters, canceling completion and pressing ctrl+space again or using backspace at 5 characters.

I haven't actually tried and tested having globalstrings in the annotations but this seemed the best tradeoff to me.

brittyazel commented 3 months ago

Hrm, is that something special that VSCode is doing with regard to ingesting those globalstring .ts files? Or are these definitions coming from elsewhere? I'm actually using IntelliJ + EmmyLua, and afaik there's no interplay between Emmylua and .ts files. I think for this to work for my specific use case, these definitions would need to be defined in a .lua file.

Totally understandable if this is outside the scope of what you are interested in supporting. That said, this repo works so well for IntelliJ+EmmyLua, you could basically advertise official support for it lol. The only thing I do different than maybe others do is that I only tell IntelliJ+EmmyLua to source the /Annotations folder, not the repository root.

Ketho commented 3 months ago

Yeah it's a VSCode specific feature, I kind of forgot you were using IntelliJ sorry. I thought that some annotations like @enum are not supported in EmmyLua, so LuaLS annotations keeps drifting away from EmmyLua.

Maybe you could add a custom path just to source from GlobalStrings.

I wouldn't mind if you advertised IntelliJ support in the README for me, I'm having busy week for a deadline :(