LuaLS / vscode-lua

Release lua-language-server for VSCode
https://github.com/LuaLS/lua-language-server
MIT License
179 stars 49 forks source link

Unable to switch to latest version of Garry's Mod addon #142

Closed A1steaksa closed 1 month ago

A1steaksa commented 1 month ago

Which OS are you using?

Windows

Expected Behaviour

The latest version of the Garry's Mod addon should be downloaded and installed

Actual Behaviour

...

I also see the following error:

[2024-08-14 10:30:57] |   ERROR   |     Set Version    | Failed to checkout version Latest: Error: error: Your local changes to the following files would be overwritten by checkout:
    library/dmenubar.lua
Please commit your changes or stash them before you switch branches.
Aborting

Reproduction steps

Open Lua Addon Manager tab

Additional Notes

No response

Log

Retrieved Log ``` #### STARTUP #### [2024-08-14 10:30:44] | DEBUG | WebVue | Workspace Open: true [2024-08-14 10:30:44] | DEBUG | Filesystem | Created directory at "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager" [2024-08-14 10:30:44] | VERBOSE | Command | Executing "getAddons" ({"command":"getAddons","data":{"page":1}}) [2024-08-14 10:30:45] | ERROR | Addon Manager | Failed to fetch addons! Please check your connection to GitHub. [2024-08-14 10:30:45] | ERROR | Addon Manager | Cannot fast-forward your working tree. [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found ao [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found argparse [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found bee [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found busted [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found cc-tweaked [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found cocos4.0 [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found dkjson [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found fenster [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found fivem [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found garrysmod [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found halion [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lapis [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lldebugger [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lmathx [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found love-nuklear [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found love2d [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lovr [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lpeg [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lua-cjson [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luaecs [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luafilesystem [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luaharfbuzz [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lualogging [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luasocket [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luassert [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luaunit [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luazip [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found luvit [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found lzlib [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found md5 [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found minetest [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found mirai [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found moneymoney [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found moonloader [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found nodemcu-esp32 [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found nodemcu-esp8266 [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found openresty [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found penlight [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found powder-toy [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found RavenscriptIDEA [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found RavenscriptIDEA_withRavenM [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found REFramework-LLS [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found skynet [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found slnunicode [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found smbx2-lunalua [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found starfallex [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found StormworksAddonLua [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found tex-lualatex [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found tex-lualibs [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found tex-luametatex [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found tex-luatex [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found toml-edit [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found transformice [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found TTSLua [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found umbrella [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found unbound-api [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found xmake [2024-08-14 10:30:45] | VERBOSE | Addon Manager | Found yue [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/ao/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/argparse/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/bee/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/busted/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/cc-tweaked/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/cocos4.0/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/dkjson/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/fenster/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/fivem/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/garrysmod/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/halion/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lapis/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lldebugger/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lmathx/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/love-nuklear/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/love2d/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lovr/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lpeg/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luaecs/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lua-cjson/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luafilesystem/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luaharfbuzz/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lualogging/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luasocket/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luassert/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luaunit/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luazip/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/luvit/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/lzlib/info.json" [2024-08-14 10:30:46] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/md5/info.json" [2024-08-14 10:30:46] | WARN | Addon | fatal: no tag exactly matches '96d68018eacd50d88e434980989019ce3827972b' [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/mirai/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/minetest/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/moonloader/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/moneymoney/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/toml-edit/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/nodemcu-esp32/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/nodemcu-esp8266/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/openresty/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/penlight/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/powder-toy/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/RavenscriptIDEA/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/RavenscriptIDEA_withRavenM/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/REFramework-LLS/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/skynet/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/slnunicode/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/smbx2-lunalua/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/starfallex/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/StormworksAddonLua/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/tex-lualatex/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/tex-lualibs/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/tex-luametatex/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/tex-luatex/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/transformice/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/TTSLua/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/umbrella/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/unbound-api/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/xmake/info.json" [2024-08-14 10:30:47] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/yue/info.json" [2024-08-14 10:30:51] | VERBOSE | Command | Executing "enable" ({"command":"enable","data":{"name":"garrysmod"}}) [2024-08-14 10:30:52] | DEBUG | Addon | Initialized submodule [2024-08-14 10:30:53] | DEBUG | Addon | Submodule up to date [2024-08-14 10:30:53] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/garrysmod/module/config.json" [2024-08-14 10:30:53] | INFO | Addon | Applied addon settings for garrysmod [2024-08-14 10:30:53] | INFO | Addon | Enabled "garrysmod" [2024-08-14 10:30:53] | DEBUG | Filesystem | Read "/C:/Users/JohnM/AppData/Roaming/Code/User/globalStorage/sumneko.lua/addonManager/addons/garrysmod/info.json" [2024-08-14 10:30:54] | WARN | Addon | fatal: no tag exactly matches '521ff0c1d165d37ab46a21380e39e7b3248fa216' [2024-08-14 10:30:56] | VERBOSE | Command | Executing "setVersion" ({"command":"setVersion","data":{"name":"garrysmod","version":"Latest"}}) [2024-08-14 10:30:56] | DEBUG | Addon | [2024-08-14 10:30:57] | ERROR | Set Version | Failed to checkout version Latest: Error: error: Your local changes to the following files would be overwritten by checkout: library/dmenubar.lua Please commit your changes or stash them before you switch branches. Aborting ```
carsakiller commented 1 month ago

Hmm, this is a problem.

@A1steaksa, in the meantime, to at least get you back on the latest changes, you can delete %AppData%\Code\User\globalStorage\sumneko.lua\addonManager\addons\garrysmod\module and re-open the addon manager to force it to pull the Garry's Mod addon from scratch (once re-enabled).

@luttje, I added a method for users to select versions of their addons using Git tags. This is new as of v3.10.1 of the VS Code extension. image It is intended to be used somewhat like this; where git tags can mark drastically different versions of an addon (in this case, before I namespaced all the types): image

It is going wrong here for a few reasons. For the part that concerns you, the tags in your Garry's Mod addon repository point to the main branch, where your generation scripts are. This means if someone selects an old version, they get your old main branch, not the branch with your definitions. I don't really have a good solution for this. I have a few possible solutions:

The other thing breaking this is that I completely forgot that some people use separate branches for publishing their addon and the main branch may be entirely unusable as an addon. When a user selects the “Latest” version in the addon manager, I believe it just jumps to the latest commit on the default remote branch rather than the branch given in .gitmodules.

I am going to look at solution 2 and fixing the “latest” problems now

luttje commented 1 month ago

Thanks for reporting @A1steaksa!

Hey @carsakiller,

Thanks for the heads-up! Is it an option that we provide the branch that is relevant for our addon info.json? That seems more maintainable than individual tags.

As for the tags, I never accounted for the fact where they should point. The whole point of our repo started off more as a "here's where the addon is built" rather than "here's the addon". If it helps for tags to point to the addon library branch, let me know and I'll figure out how to re-work our workflows so there's version tags on that branch too.

Let me know what I can do to help. Thanks!

carsakiller commented 1 month ago

So if I cd into the Garry's Mod addon within LLS-Addons and run a few commands, I get some interesting results:

LLS-Addons/addons/garrysmod/module$ git branch
* (HEAD detached at 521ff0c)   main

So it seems that when a submodule that has a target branch specified is cloned, it is in a detached state, even though it also pulls main? Weird. And it isn't just called main locally while tracking origin/lua-language-server-addon, it is actually tracking origin/main:

LLS-Addons/addons/garrysmod/module$ git checkout main
Previous HEAD position was 521ff0c 🚀 Update 8/1/2024, 12:06:35 PM
Switched to branch 'main'
Your branch is up to date with 'origin/main'.

That is not expected, I thought it would clone the branch specified. Anyway, I think I see where I made my error with the jump to “latest” feature.


If I can find a nice way to check if a tag is not on the branch specified for the addon in the .gitmodules file, it could be ignored and not listed as an option.

There is technically the following solution:

# list tags only reachable from "target" branch
LLS-Addons/addons/garrysmod/module$ git tag --merged origin/lua-language-server-addon
2023-04-08_18-02-22  2023-04-10_08-43-08  2023-04-10_21-17-13

However, I am yet to get this working with gitjs in the addon manager.


As for the tags, I never accounted for the fact where they should point.

It confused me for a while. You only have a few tags on the lua-language-server-addon branch and a bunch pointing to commit 7025dfa6.

The solution I am working towards here for addon versioning should allow whatever tags you please on your main branch and then versioning tags on your “addon” branch for use in the addon manager.

That being said, I am on vacation for the next few days, so I'll have to continue this when I return.

carsakiller commented 1 month ago

https://github.com/LuaLS/vscode-lua/pull/143 should hopefully solve this. Addon versioning is still sort of in beta currently. I need to make its existence more known on the wiki and in LLS-Addons still...

@luttje, for each version you want people to be able to step back to, you will need a tag pointing to the commit on the lua-language-server-addon branch. Also, I recommend using version numbers (can they be scraped from the docs?) if possible instead of dates 🙂