vscode-factoriomod-debug icon indicating copy to clipboard operation
vscode-factoriomod-debug copied to clipboard

Sumneko don't do Lua diagnostics correctly.

Open YPetremann opened this issue 2 years ago • 2 comments
trafficstars

I use my ~/.factorio/mods as workspace

here the workspace config:

{
  "factorio.versions": [
    {
      "name": "Home",
      "factorioPath": "~/.factorio/bin/x64/factorio",
      "active": true
    }
  ],
  "Lua.workspace.library": [
    "/home/ypetremann/.factorio/data"
  ],
  "Lua.workspace.userThirdParty": [
    "/home/ypetremann/.config/Code/User/workspaceStorage/41d17afb68f79f41547c41aa0b00bf09/justarandomgeek.factoriomod-debug/sumneko-3rd"
  ],
  "factorio.docs.docLinksVersion": "current",
  "factorio.package.zipLocation": "outside"
}

Sumneke throw me errors like :

Undefined global `game`.
Undefined global `serpent`.
Undefined global `rendering`.
Undefined global `script`.
Undefined type or alias `EventData.on_gui_checked_state_changed`.
...

This indicatre that sumneko don't work correctly with the factorio modding toolkit

YPetremann avatar Nov 10 '23 19:11 YPetremann

If you are using sumeko Lua V3.7.3 on Linux there are popups missing. I've had the same problem. Those missing popups result in not having the correct path in "Lua.workspace.library"

You could change the Version to V3.7.0 then the popups should show up, or you can add this path to your libraries.

"/home/your_name/.config/Code/User/workspaceStorage/{hex-num}/justarandomgeek.factoriomod-debug/sumneko-3rd/factorio/library"

K1ngLui avatar Nov 25 '23 18:11 K1ngLui

This seems to be related to the recent changes in LuaLS checking for libraries: https://github.com/LuaLS/lua-language-server/issues/2419 https://github.com/LuaLS/lua-language-server/pull/2354

I've found setting "Lua.workspace.checkThirdParty": "ApplyInMemory" seems to work well, but i'm not sure i want to set that automatically yet (i expect it will change again in LuaLS, since it's not just us affected)

justarandomgeek avatar Nov 28 '23 02:11 justarandomgeek