LuaLS / lua-language-server

A language server that offers Lua language support - programmed in Lua
https://luals.github.io
MIT License
3.24k stars 305 forks source link

undefined global love, and anything defined in files other than main.lua #1686

Closed JeremiahCheatham closed 1 year ago

JeremiahCheatham commented 1 year ago

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Linux

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

to not complain about love not being defined. And not complain about everything defined in other files as undefined global.

Actual Behaviour

Everything work just fine as expected before yesterday when i updated my system. Now i have almost as many errors as lines in my files everything is an undefined global.

Reproduction steps

Try any lua project here is one my son and i finished last week. Though i had no errors at the time of finishing it. Now it does. https://github.com/jeremiahcheatham/bat-brightness

My current project is not uploaded. But everything kicks out errors now.

Additional Notes

No response

Log File

No response

sumneko commented 1 year ago

Please provide your log, see https://github.com/sumneko/lua-language-server/wiki/FAQ#where-can-i-find-the-log-file

JeremiahCheatham commented 1 year ago

I'm not sure what log file you want as the link above doesn't really explain at all what i'm searching for. So this is what i found in service.log. Hope it's helpful it doesn't really tell me anything.

[19:30:55.605][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:65]: Lua Lsp startup, root:  /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server
[19:30:55.605][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:66]: ROOT:   /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server
[19:30:55.605][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:67]: LOGPATH:    /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/log
[19:30:55.605][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:68]: METAPATH:   /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/meta
[19:30:55.605][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:69]: VERSION:    3.6.2
[19:30:55.621][debug][#0:script/service/telemetry.lua:22]: Telemetry Token: 757B63AA4D89361E
[19:30:55.627][debug][#0:script/pub/pub.lua:50]: Create brave:  1
[19:30:55.627][debug][#0:script/pub/pub.lua:50]: Create brave:  2
[19:30:55.627][debug][#0:script/pub/pub.lua:50]: Create brave:  3
[19:30:55.627][debug][#0:script/pub/pub.lua:50]: Create brave:  4
[19:30:55.627][info] [#0:script/service/service.lua:141]: 
========= Medical Examination Report =========
    --------------- Memory ---------------
        Total: 1.547 MB
        # 00 : 1.547 MB
        # 01 : 0.000 MB
        # 02 : 0.000 MB
        # 03 : 0.000 MB
        # 04 : 0.000 MB
    --------------- Coroutine ---------------
        Total:     0
        Running:   0
        Suspended: 0
        Normal:    0
        Dead:      0
    --------------- Cache ---------------
        Total: 1
        Dead:  0
    ---------------  RPC  ---------------
        Holdon:   0
        Waiting:  0
==============================================
[19:31:07.837][warn] [#0:script/pub/report.lua:25]: Load proto error:   Proto header error: 
sumneko commented 1 year ago

Your description shows that the server can start normally, but gives many wrong warnings. But the log shows the server does not start normally.

Please reproduce the problem in your description locally, and then find the correct log file in the log directory to provide me. You can determine it according to the modification time of the file.

JeremiahCheatham commented 1 year ago

if i directly call lua-language-server from within my source folder against my main.lua this is my output.

/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/bin/lua-language-server: main.lua:1: module 'game' not found:
    no field package.preload['game']
    no file './script/game.lua'
    no file './script/game/init.lua'
    no file '/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/bin/game.so'
stack traceback:
    [C]: in function 'require'
    main.lua:1: in main chunk
    ...ckages/lua-language-server/extension/server/bin/main.lua:85: in main chunk
    [C]: in ?

if i copy the lua-language-server to my source folder then run that copy against my main.lua this is what i get.

./lua-language-server: /home/jeremiah/minesweeper/main.lua:9: attempt to index a nil value (global 'love')
stack traceback:
    /home/jeremiah/minesweeper/main.lua:9: in main chunk
    [C]: in ?
JeremiahCheatham commented 1 year ago

game that i can't find is game.lua that is in the same folder as main.lua that i am running all this from. It's not finding any of the required modules it only complains about 1 but doens't find any.

JeremiahCheatham commented 1 year ago

This is my main.lua

Code ``` require("game") require("border") require("face") require("digitback") require("remain") require("clock") require("board") function love.load() math.randomseed(os.time()) love.graphics.setDefaultFilter("nearest", "nearest") Game:load() end function love.update(dt) Game:update(dt) end function love.draw() Game:draw() end function love.mousereleased(x, y, button) if button == 1 then if Face.face == 2 then Face.face = 1 if y >= Face.y and y <= Face.y + Face.height then if x >= Face.x and x <= Face.x + Face.width then Game:reset() end end end end if Game.running then if button == 1 then if Face.face == 3 then Face.face = 1 if y >= Board.top and y <= Board.bottom then if x >= Board.left and x <= Board.right then Board:tileReleased(x, y) end end end elseif button == 2 then if y >= Board.top and y <= Board.bottom then if x >= Board.left and x <= Board.right then Board:flagTile(x, y) end end end end end function love.mousepressed(x, y, button) if button == 1 then if y >= Face.y and y <= Face.y + Face.height then if x >= Face.x and x <= Face.x + Face.width then Face.face = 2 end end if Game.running then if y >= Board.top and y <= Board.bottom then if x >= Board.left and x <= Board.right then Board:tilePressed(x, y) end end end end end function love:keypressed(k) if k == '1' then Board.theme = 0 Border.theme = 0 Face.theme = 0 DigitBack.theme = 0 Remain.theme = 0 Clock.theme = 0 elseif k == '2' then Board.theme = 16 Border.theme = 0 Face.theme = 0 DigitBack.theme = 0 Remain.theme = 0 Clock.theme = 0 elseif k == '3' then Board.theme = 32 Border.theme = 0 Face.theme = 0 DigitBack.theme = 0 Remain.theme = 0 Clock.theme = 0 elseif k == '4' then Board.theme = 48 Border.theme = 0 Face.theme = 5 DigitBack.theme = 0 Remain.theme = 0 Clock.theme = 0 elseif k == '5' then Board.theme = 64 Border.theme = 0 Face.theme = 5 DigitBack.theme = 0 Remain.theme = 0 Clock.theme = 0 elseif k == '6' then Board.theme = 80 Border.theme = 0 Face.theme = 5 DigitBack.theme = 0 Remain.theme = 0 Clock.theme = 0 elseif k == '7' then Board.theme = 96 Border.theme = 8 Face.theme = 10 DigitBack.theme = 1 Remain.theme = 12 Clock.theme = 12 elseif k == '8' then Board.theme = 112 Border.theme = 8 Face.theme = 10 DigitBack.theme = 1 Remain.theme = 12 Clock.theme = 12 elseif k == 'r' then Game.columns = 79 Game.rows = 41 Game.scale = 1 Game:reset() elseif k == 'e' then Game.columns = 60 Game.rows = 30 Game.scale = 1.3 Game:reset() elseif k == 'w' then Game.columns = 40 Game.rows = 20 Game.scale = 1.8 Game:reset() elseif k == 'q' then Game.columns = 30 Game.rows = 15 Game.scale = 2 Game:reset() elseif k == 'a' then Game.difficulty = 0.095 Game:reset() elseif k == 's' then Game.difficulty = 0.13 Game:reset() elseif k == 'd' then Game.difficulty = 0.165 Game:reset() elseif k == 'f' then Game.difficulty = 0.2 Game:reset() end end function LoadSpriteSheet(t, image, width, height) t = t or {} t.image = love.graphics.newImage("assets/"..image..".png") t.quads = {} for y = 0, t.image:getHeight() - height, height do for x = 0, t.image:getWidth() - width, width do table.insert(t.quads, love.graphics.newQuad(x, y, width, height, t.image:getDimensions())) end end t.originalWidth = width t.originalHeight = height t.width = width * Game.scale t.height = height * Game.scale end ``` And my game.lua ``` Game = { columns = 40, rows = 20, flags = 0, scale = 1.8, difficulty = 0.13, running = true } function Game:load() LoadSpriteSheet(Game, "largeicons", 32, 32) Board:load() Border:load() Face:load() DigitBack:load() Remain:load() Clock:load() self:reset() end function Game:reset() self.mines = math.floor(self.columns * self.rows * self.difficulty) self.running = true self.flags = 0 Board:reset() Border:reset() Face:reset() DigitBack:reset() Remain:reset() Clock:reset() end function Game:update(dt) if self.running then Clock:update(dt) end end function Game:draw() Border:draw() DigitBack:draw() Face:draw() Remain:draw() Clock:draw() Board:draw() end ```

edited to add fold - Carsa

sumneko commented 1 year ago
  1. Don't copy the lua-language-server to anywhere.
  2. Just call lua-language-server instead of lua-language-server main.lua
JeremiahCheatham commented 1 year ago

if i run the correct location of lua-language-server without any other parameters from within my source folder this is what i get. And i have to press enter to close it.

Content-Length: 120

{"jsonrpc":"2.0","method":"$/status/report","params":{"text":"😺Lua","tooltip":"Cached files: 0/0\nMemory usage: 2M"}}
sumneko commented 1 year ago

This is correct, because the server communicates with the client by input and output, so you need to use a language client to execute this command. You said that it works fine before, so you can continue to use the previous way to startup the server.

JeremiahCheatham commented 1 year ago

I'm running this config of neovim that where this is comming into play. It broke from an update the other day not sure if it's system update or lvim update. But I have since did a fresh install and it's still the same. https://github.com/LunarVim/LunarVim

JeremiahCheatham commented 1 year ago

Yeah im using it from lunarvim and as i said it was working great i loved it. Now not working at all. It doesn't understand it's a love program that causes all kinds of errors and it doesn't see any of the loaded files again causing all kinds of errors.

sumneko commented 1 year ago

Now i have almost as many errors as lines in my files everything is an undefined global.

I don't have an environment to install neovim. I just want to check your log at this time, so I can check the if the problem from this language server or other language client.

JeremiahCheatham commented 1 year ago

the main file now gives me 118 errors.

JeremiahCheatham commented 1 year ago

Anything from these it can no longer handle as well as anything love related.

require("game")
require("border")
require("face")
require("digitback")
require("remain")
require("clock")
require("board")
sumneko commented 1 year ago

Sorry, I have no energy to continue to track this problem, because you have been unable to give effective information, you just repeating what you said. This may not be your problem, because I can see that you are a novice, and you may be difficult to understand something that looks like it in my eyes. I suggest you find a programmer friend to help you check and communicate with this issue, because I really have no energy to teach you some basic knowledge.

Closing.

JeremiahCheatham commented 1 year ago

I'm sorry what? I have been trying to give you every single bit of info you asked for and 5 times more on top of it. Please state exactly what info you need?

JeremiahCheatham commented 1 year ago

you asked for log file and i gave you exactly that. and any bit of info i could possibly think of.

sumneko commented 1 year ago

Well, I will try to explain to you the last time. You can read it repeatedly, and then reply after you figure out everything.

JeremiahCheatham commented 1 year ago

I'm not sure if you are new to this. Or what is happening but you asked for a log fine described here. https://github.com/sumneko/lua-language-server/wiki/FAQ#where-can-i-find-the-log-file Only who ever wrote that seems to have a vague understand of what that is and doesn't describe it. Never the less i found the clossed thing on my machine matching that and gave it to you. Along with trying every other thing that i don't know about this since it's not my program as i could. And waited for the person who should know about this to reply. Now your only other request was to find some other log of no description somewhere or ask a programmer friend about where a log fine for your program would be. Why wouldn't you know where it is or what it is or does it exit. The only person i would ask about your program would be you. So yeah i'm a complete novice when it comes to your program as i didn't write it and have no idea how it functions or what even any error or log fines exist. I have spent several days though trying to find anything at all. If there is a log file that can shed light on this wouldn't the one person who knows about it be you and not some programmer friend of mine wtf.

JeremiahCheatham commented 1 year ago

If you need an extremely accurate description of the issue and all it's symptoms please read above as i tried my best to describe it completely. Also i am not the only one who's had this issue.

sumneko commented 1 year ago
  1. The language server will record the log on your computer. By reading the log, I can understand the running status at that time, and help to find errors.
  2. If you start the server in the form of workspace (as far as I know, neovim will use your git project as the workspace), then the log file name is your project path. If you start in a single file, the log file name is service.log.
  3. Each time the log is generated, the previous name of the same name will be covered.
  4. When the server can work normally before, it generates a normal log file (1), which is not helpful for your current problem.
  5. Later, there is a problem with the server work after you updating. It will generate a log file (2), witch records abnormal information which I want.
  6. You later fell into a startup problem that had nothing to do with your problem. You manually started the server. At this time, a log file (3) will be generated, but this log is not related to your problem.
  7. What I want is the log file (2), but you only provided the log file (3), witch is not related to your problem.
  8. What you need to do is to reproduce the problems you encounter, and then send me the corresponding log file (2).

After you fully understand what I said, you can attach your log file and re-open this isue. Otherwise, you can wait for people who encounter the same problem to open issues, or invite your programmer friends in reality to help you check this problem.

I'm going to sleep now.

JeremiahCheatham commented 1 year ago

The original file i sent was the service.log file. As you said it was showing what the log showed from my local attempt not the lvim one. You could have simply said thanks for the file now fire up lvim and send the file again. Then i would have known simply you wanted the file agian. Here it is. Hopefully this is correct i have tried reinstalling different versions of lvim so hopefully this wont affect the file output. Also there is no error initially unless i go into insert mode then back or change files then all the errors come. So i did this before exiting and this is the service.log file.

[21:16:57.592][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:65]: Lua Lsp startup, root:  /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server
[21:16:57.593][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:66]: ROOT:   /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server
[21:16:57.593][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:67]: LOGPATH:    /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/log
[21:16:57.593][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:68]: METAPATH:   /home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/meta
[21:16:57.593][info] [#0:/home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/main.lua:69]: VERSION:    3.6.2
[21:16:57.611][info] [#0:script/service/service.lua:141]: 
========= Medical Examination Report =========
    --------------- Memory ---------------
        Total: 1.546 MB
        # 00 : 1.546 MB
        # 01 : 0.000 MB
        # 02 : 0.000 MB
        # 03 : 0.000 MB
        # 04 : 0.000 MB
    --------------- Coroutine ---------------
        Total:     0
        Running:   0
        Suspended: 0
        Normal:    0
        Dead:      0
    --------------- Cache ---------------
        Total: 1
        Dead:  0
    ---------------  RPC  ---------------
        Holdon:   0
        Waiting:  0
==============================================
[21:16:57.614][info] [#0:script/language.lua:137]: VSC language: nil
[21:16:57.614][info] [#0:script/language.lua:138]: LS  language: en-us
[21:16:57.717][info] [#0:script/provider/provider.lua:56]: Load config from client  fallback
[21:16:57.717][info] [#0:script/provider/provider.lua:57]: {
  Lua = {
    diagnostics = {
      globals = { "vim", "lvim", "packer_plugins", "reload" }
    },
    runtime = {
      special = {
        reload = "require"
      },
      version = "LuaJIT"
    },
    telemetry = {
      enable = false
    },
    workspace = {
      checkThirdParty = false,
      library = { "/usr/share/nvim/runtime", "/home/jeremiah/.local/share/lunarvim/lvim", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/opt/neodev.nvim/types/stable", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/LuaSnip/lua", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/plenary.nvim/lua", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/telescope.nvim/lua" },
      maxPreload = 5000,
      preloadFileSize = 10000
    }
  }
}
[21:16:57.717][info] [#0:script/library.lua:207]: Init builtin library at:  nil
[21:16:57.729][info] [#0:script/provider/provider.lua:56]: Load config from client  fallback
[21:16:57.729][info] [#0:script/provider/provider.lua:57]: {
  Lua = {
    diagnostics = {
      globals = { "vim", "lvim", "packer_plugins", "reload" }
    },
    runtime = {
      special = {
        reload = "require"
      },
      version = "LuaJIT"
    },
    telemetry = {
      enable = false
    },
    workspace = {
      checkThirdParty = false,
      library = { "/usr/share/nvim/runtime", "/home/jeremiah/.local/share/lunarvim/lvim", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/opt/neodev.nvim/types/stable", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/LuaSnip/lua", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/plenary.nvim/lua", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/telescope.nvim/lua" },
      maxPreload = 5000,
      preloadFileSize = 10000
    }
  }
}
[21:16:57.729][info] [#0:script/provider/provider.lua:56]: Load config from client  fallback
[21:16:57.729][info] [#0:script/provider/provider.lua:57]: {
  Lua = {
    diagnostics = {
      globals = { "vim", "lvim", "packer_plugins", "reload" }
    },
    runtime = {
      special = {
        reload = "require"
      },
      version = "LuaJIT"
    },
    telemetry = {
      enable = false
    },
    workspace = {
      checkThirdParty = false,
      library = { "/usr/share/nvim/runtime", "/home/jeremiah/.local/share/lunarvim/lvim", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/opt/neodev.nvim/types/stable", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/LuaSnip/lua", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/plenary.nvim/lua", "/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/telescope.nvim/lua" },
      maxPreload = 5000,
      preloadFileSize = 10000
    }
  }
}
[21:16:57.830][info] [#0:script/workspace/workspace.lua:304]: Preload start:    <fallback>
[21:16:57.833][info] [#0:script/workspace/workspace.lua:327]: Scan library at:  file:///home/jeremiah/.local/share/lunarvim/lvim
[21:16:57.853][info] [#0:script/workspace/workspace.lua:327]: Scan library at:  file:///home/jeremiah/.local/share/lunarvim/site/pack/packer/start/telescope.nvim/lua
[21:16:57.862][info] [#0:script/workspace/workspace.lua:327]: Scan library at:  file:///usr/share/nvim/runtime
[21:16:57.915][info] [#0:script/workspace/workspace.lua:327]: Scan library at:  file:///home/jeremiah/.local/share/lunarvim/site/pack/packer/start/LuaSnip/lua
[21:16:57.918][info] [#0:script/workspace/workspace.lua:327]: Scan library at:  file:///home/jeremiah/.local/share/nvim/mason/packages/lua-language-server/extension/server/meta/LuaJIT%20en-us%20utf8
[21:16:57.919][info] [#0:script/workspace/workspace.lua:327]: Scan library at:  file:///home/jeremiah/.local/share/lunarvim/site/pack/packer/opt/neodev.nvim/types/stable
[21:16:57.919][info] [#0:script/workspace/workspace.lua:327]: Scan library at:  file:///home/jeremiah/.local/share/lunarvim/site/pack/packer/start/plenary.nvim/lua
[21:16:58.023][info] [#0:script/workspace/workspace.lua:347]: Found 352 files at:   <fallback>
[21:16:58.023][info] [#0:script/workspace/loading.lua:157]: Load files from disk:   <fallback>
[21:16:58.972][warn] [#0:script/files.lua:678]: Compile [file:///home/jeremiah/.local/share/lunarvim/site/pack/packer/start/LuaSnip/lua/luasnip/util/parser/init.lua] takes [0.102] sec, size [4.032] kb.
[21:16:59.486][warn] [#0:script/files.lua:678]: Compile [file:///home/jeremiah/.local/share/lunarvim/site/pack/packer/start/telescope.nvim/lua/telescope/actions/init.lua] takes [0.167] sec, size [46.814] kb.
[21:17:00.039][info] [#0:script/workspace/loading.lua:169]: Loaded files takes [1.839] sec: <fallback>
[21:17:00.039][info] [#0:script/workspace/loading.lua:178]: Compile files takes [0.000] sec: <fallback>
[21:17:00.040][info] [#0:script/workspace/loading.lua:179]: Loaded finish:  <fallback>
[21:17:00.040][info] [#0:script/workspace/workspace.lua:349]: Preload finish at:    <fallback>
[21:17:00.247][warn] [#0:script/proto/proto.lua:122]: Response of [workspace/diagnostic/refresh] error [-32601]: MethodNotFound
[21:17:00.249][warn] [#0:script/proto/proto.lua:171]: Method [textDocument/documentSymbol] takes [2.152]sec. {
  id = 2,
  jsonrpc = "2.0",
  method = "textDocument/documentSymbol",
  params = {
    textDocument = {
      uri = "file:///home/jeremiah/minesweeper/game.lua"
    }
  }
}
[21:17:08.857][warn] [#0:script/vm/global.lua:70]: global-manager getSets costs 0.21365 _DEBUG
[21:17:08.870][warn] [#0:script/provider/provider.lua:641]: Completion takes 0.231 sec.
[21:17:16.323][info] [#0:script/provider/provider.lua:169]: Server shutdown.
[21:17:16.323][warn] [#0:script/pub/report.lua:25]: Load proto error:   Disconnected!
carsakiller commented 1 year ago

I'm not sure what log file you want as the link above doesn't really explain at all what i'm searching for

How can it be improved? I do a lot of the documentation here and would like to improve it if it is lacking. When writing the documentation, I use the knowledge I have gained from using the language server, but I do not have the deepest understanding of everything that goes on in the pretty complex software, especially on the NeoVim side of things. Any improvements and suggestions are welcome. It looks like there was a misunderstanding over the log files, where a log to a different issue was shared, rather than a log that reproduced the issue you are experiencing - but maybe there is something you would like to add to the documentation?

Have you made sure that the love library is enabled? It is a built-in library, but it must be activated still. This can be done automatically, should the server prompt you, or would be specified using the workspace.library setting in your configuration file.

Also, I just want to remind you that this software is open source and worked on by Sumneko for free in their spare time. There seems to be a lot of trouble understanding each other here, but we are trying to help you, so please be respectful.

JeremiahCheatham commented 1 year ago

As one amateur programmer to another if he can't easily explain about what he's doing, or how it works then he doesn't fully understand it himself. Thats for anything if you can't explain to someone who doesn't know anything about it then you yourself doesn't fully understand what your doing. Being able to explain is paramount to fully understanding. Also if you can't communicate what your looking for its not the other person fault it's your own. Communication goes hand it hand with being able to understand and explain anything.

He wanted a log file called service.log however that is not mentioned anywhere. The link He gave me doesn't even contain that file name. However I have been around linux and troubleshooting for a very long time. I actually used to run my own linux distro that was not based on anyone else but instead built from the ground up by myself. That means any bugs i had to google or problem solve myself. So i was able to figure out what log he was looking for even though i had no concept of what your code does. And i gave him that info along with anything else i could find. Understanding what you don't know is the first step in learning so i have no issue admitting what i don't know but also tried to give everything i did know and could find.

Then suddenly he's telling me this is invalid and closed and i need to find a programmer friend. I had no idea he still needed info or what it was. Just an absolute failure at communication. if he would simply said what he was seeking of course would try to give all that to him. And i'm not an idiot can understand concepts of log files as i had already found what he needed to start with. But say that i can't be bothered i'm closing it is pretty telling. It's not like i'm the first person to bring up this issue.

Carsakiller As i tried stating over and over before love is not being enabled how ever that is meant to happen. It did happen before yes. But it is no longer happening. There is no prompt for it at all there was in the past. And it is no understanding anything defined in other files. I know he said i keep repeating myself but this is exactly what is happening. And this is why i'm here asking why this is happening. Respect is defiantly an issue. it is not rare for people to make projects on github that others depend on and then have issues with communication and arrogance. It sucks for me for now i'm back to vscodium for lua. It could be a me issue and i'm the only one effected. Or it can be lvim and they are all affected or its sumneko issue and there is a lot of affected people.

carsakiller commented 1 year ago

Their first language is not English, so there is bound to be some communication issues. I don't think they were trying to be disrespectful, the wording might just be weird as they use a machine translator. Also, the thing about open source github projects is, yes, you may not agree with how someone does something - maybe they are even rude, but no one is forcing you to use the software.

A lot of what you are saying is giving off the feeling of "Sumneko works for the users, and it is their job". Whether this is your intention or not, it just doesn't come off great. We are trying to help you, so we just ask for your patience and cooperation. This is why I asked to keep it respectful, that is all 🙂


I saw you mentioned Love is not enabled, could you check your configuration file though? To properly enable it, there should be an entry in your config file, stating so. The prompts not appearing may be a separate issue, but let's focus on making sure it is in your config to see if the intellisense is working.

So it is working in vscodium but not with lvim? I have not used either, but that definitely raises some flags for further debugging there.

JeremiahCheatham commented 1 year ago

I'm not sure where to look for that config lua is mention in the lvim config but there must be a config file for lua specifically somewhere but I can't seem to find it.

--[[
lvim is the global options object

Linters should be
filled in as strings with either
a global executable or a path to
an executable
]]
-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT

-- general
lvim.log.level = "warn"
lvim.format_on_save.enabled = false
lvim.colorscheme = "lunar"
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false

-- keymappings [view all the defaults by pressing <leader>Lk]
lvim.leader = "space"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
-- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>"
-- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>"
-- unmap a default keymapping
-- vim.keymap.del("n", "<C-Up>")
-- override a default keymapping
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" -- or vim.keymap.set("n", "<C-q>", ":q<cr>" )

-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
-- local _, actions = pcall(require, "telescope.actions")
-- lvim.builtin.telescope.defaults.mappings = {
--   -- for input mode
--   i = {
--     ["<C-j>"] = actions.move_selection_next,
--     ["<C-k>"] = actions.move_selection_previous,
--     ["<C-n>"] = actions.cycle_history_next,
--     ["<C-p>"] = actions.cycle_history_prev,
--   },
--   -- for normal mode
--   n = {
--     ["<C-j>"] = actions.move_selection_next,
--     ["<C-k>"] = actions.move_selection_previous,
--   },
-- }

-- Change theme settings
-- lvim.builtin.theme.options.dim_inactive = true
-- lvim.builtin.theme.options.style = "storm"

-- Use which-key to add extra bindings with the leader-key prefix
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
-- lvim.builtin.which_key.mappings["t"] = {
--   name = "+Trouble",
--   r = { "<cmd>Trouble lsp_references<cr>", "References" },
--   f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
--   d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
--   q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
--   l = { "<cmd>Trouble loclist<cr>", "LocationList" },
--   w = { "<cmd>Trouble workspace_diagnostics<cr>", "Workspace Diagnostics" },
-- }

-- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false

-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
  "bash",
  "c",
  "javascript",
  "json",
  "lua",
  "python",
  "typescript",
  "tsx",
  "css",
  "rust",
  "java",
  "yaml",
}

lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enable = true

-- generic LSP settings

-- -- make sure server will always be installed even if the server is in skipped_servers list
-- lvim.lsp.installer.setup.ensure_installed = {
--     "sumneko_lua",
--     "jsonls",
-- }
-- -- change UI setting of `LspInstallInfo`
-- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
-- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
-- lvim.lsp.installer.setup.ui.border = "rounded"
-- lvim.lsp.installer.setup.ui.keymaps = {
--     uninstall_server = "d",
--     toggle_server_expand = "o",
-- }

-- ---@usage disable automatic installation of servers
-- lvim.lsp.installer.setup.automatic_installation = false

-- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
-- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
-- require("lvim.lsp.manager").setup("pyright", opts)

-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
-- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
--   return server ~= "emmet_ls"
-- end, lvim.lsp.automatic_configuration.skipped_servers)

-- -- you can set a custom on_attach function that will be used for all the language servers
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
-- lvim.lsp.on_attach_callback = function(client, bufnr)
--   local function buf_set_option(...)
--     vim.api.nvim_buf_set_option(bufnr, ...)
--   end
--   --Enable completion triggered by <c-x><c-o>
--   buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- end

-- -- set a formatter, this will override the language server formatting capabilities (if it exists)
-- local formatters = require "lvim.lsp.null-ls.formatters"
-- formatters.setup {
--   { command = "black", filetypes = { "python" } },
--   { command = "isort", filetypes = { "python" } },
--   {
--     -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
--     command = "prettier",
--     ---@usage arguments to pass to the formatter
--     -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
--     extra_args = { "--print-with", "100" },
--     ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
--     filetypes = { "typescript", "typescriptreact" },
--   },
-- }

-- -- set additional linters
-- local linters = require "lvim.lsp.null-ls.linters"
-- linters.setup {
--   { command = "flake8", filetypes = { "python" } },
--   {
--     -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
--     command = "shellcheck",
--     ---@usage arguments to pass to the formatter
--     -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
--     extra_args = { "--severity", "warning" },
--   },
--   {
--     command = "codespell",
--     ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
--     filetypes = { "javascript", "python" },
--   },
-- }

-- Additional Plugins
-- lvim.plugins = {
--     {
--       "folke/trouble.nvim",
--       cmd = "TroubleToggle",
--     },
-- }

-- Autocommands (https://neovim.io/doc/user/autocmd.html)
-- vim.api.nvim_create_autocmd("BufEnter", {
--   pattern = { "*.json", "*.jsonc" },
--   -- enable wrap mode for json files only
--   command = "setlocal wrap",
-- })
-- vim.api.nvim_create_autocmd("FileType", {
--   pattern = "zsh",
--   callback = function()
--     -- let treesitter use bash highlight for zsh files as well
--     require("nvim-treesitter.highlight").attach(0, "bash")
--   end,
-- })
JeremiahCheatham commented 1 year ago

I found a file called sumneko_lua.lua

local default_workspace = {
  library = {
    vim.fn.expand "$VIMRUNTIME",
    get_lvim_base_dir(),
    require("neodev.config").types(),
  },
  checkThirdParty = false,

  maxPreload = 5000,
  preloadFileSize = 10000,
}

local add_packages_to_workspace = function(packages, config)
  -- config.settings.Lua = config.settings.Lua or { workspace = default_workspace }
  local runtimedirs = vim.api.nvim__get_runtime({ "lua" }, true, { is_lua = true })
  local workspace = config.settings.Lua.workspace
  for _, v in pairs(runtimedirs) do
    for _, pack in ipairs(packages) do
      if v:match(pack) and not vim.tbl_contains(workspace.library, v) then
        table.insert(workspace.library, v)
      end
    end
  end
end

local lspconfig = require "lspconfig"

local make_on_new_config = function(on_new_config, _)
  return lspconfig.util.add_hook_before(on_new_config, function(new_config, _)
    local server_name = new_config.name

    if server_name ~= "sumneko_lua" then
      return
    end
    local plugins = { "plenary.nvim", "telescope.nvim", "nvim-treesitter", "LuaSnip" }
    add_packages_to_workspace(plugins, new_config)
  end)
end

lspconfig.util.default_config = vim.tbl_extend("force", lspconfig.util.default_config, {
  on_new_config = make_on_new_config(lspconfig.util.default_config.on_new_config),
})

local opts = {
  settings = {
    Lua = {
      telemetry = { enable = false },
      runtime = {
        version = "LuaJIT",
        special = {
          reload = "require",
        },
      },
      diagnostics = {
        globals = { "vim", "lvim", "packer_plugins", "reload" },
      },
      workspace = default_workspace,
    },
  },
}

return opts
carsakiller commented 1 year ago

Line 7 in the second config file you sent: checkThirdParty = false

This seems like it is applied by default for each new Lua project you create. The workspace.checkThirdParty setting prevents the language server from prompting you to apply a library, like love. This seems like a silly default to have, as it removes the convenience of that feature.

I have only ever used the VS Code client, so I am not 100% sure how configuration works for your client. That being said, you should be able to create a .luarc.json file in your workspace where you would have something similar to this:

{
  "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
  "workspace.library": ["${3rd}/love2d/library"]
}

The important line is the second one, where we set the workspace.library setting so that love is enabled.

You can view all the settings in the wiki.

carsakiller commented 1 year ago

After reviewing your log file, I can confirm that love is just not enabled. Whatever you are using to set up your default settings, it is disabling checkThirdParty, preventing the suggestion from coming up, and then just applying the following libraries:

"/usr/share/nvim/runtime",
"/home/jeremiah/.local/share/lunarvim/lvim",
"/home/jeremiah/.local/share/lunarvim/site/pack/packer/opt/neodev.nvim/types/stable",
"/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/LuaSnip/lua",
"/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/plenary.nvim/lua",
"/home/jeremiah/.local/share/lunarvim/site/pack/packer/start/telescope.nvim/lua"

These can be seen on lines 47, 71, and 94.

I have shared with you how you can use a .luarc.json file to manually add the love2d definitions, but I would recommend also changing your default config so that checkThridParty is not always disabled. This will prevent you from running into this problem over and over again.

JeremiahCheatham commented 1 year ago

So this seems to be an lvim sort of. They disabled it 3 days ago because it pops up ever single time which i can confirm that did happen. So they disabled it. https://github.com/LunarVim/LunarVim/pull/3445 However it now asks about luassert too. So this was there response to that bug.

This doesn't fix my issue about it not seeing any of the required modules that's still the same. After you told me what statement it was i was easily able to look this up. However if you wouldn't have told me i would have never ever found this. I have looked at your and there documentation countless times over the last couple days. To you I am sure it looks like a great reference but to someone who isn't involved in this project its like reading hieroglyphs. No matter how many times i read the links about builtin no part of any sentence has any meaning to me at all. It all looks like magic. And now that you have told me about that like i said i can now have something to search and very quickly find where it came from. But still i have no idea what the other pop up is. Or how to fix the original issue of why they dissabled it or the rest of the issue why it's not seeing anything defined in other files. For me this is all still magic and i have desperately tried to solve it myself and read over and over word that simply have no meaning at all to me. Which the log file i knew what i was hunting for even if the name wasn't given of what it was. But with the rest i cant even start to look because i have no idea what i am looking for. Its very very frustrating.

So let me say the documentation while may be great reference you guys. doesn't make sense to someone who not a developer here. The statement that people shouldn't expect support is so ridiculous it's hard to reply. If you have released software to the public with the expectations that it be used by any number of people you must expect they will ask for support. If you don't want people asking for support then you should not be releasing software period. I know they may not get the help they need but to expect people not ask or not expect to be able to ask is absurd. There is almost 1500 tickets.

The statement that he may be rude but no one is forcing you to use it. This is an amazing statement that took me down a rabbit hole of high narcissim and benevolence. And helped me better understand what i said above about people running project and the arrogance and ignorance involved and their support system of enablers.

This whole thing has been painful when it should have been trivial to anyone who has an open ear, understanding of there own software and a basic understanding that others will not have an understanding of there software. I am surprised we got to the love thing since i had given up on the entire deal but also seem no closer. Last night instead i learned ruby a language i never used before and made a game just to relax for this.

sumneko commented 1 year ago

When a person's speech is just stupid, I can't tell whether he is fishing or really stupid.

sumneko commented 1 year ago

Their first language is not English, so there is bound to be some communication issues. I don't think they were trying to be disrespectful, the wording might just be weird as they use a machine translator. Also, the thing about open source github projects is, yes, you may not agree with how someone does something - maybe they are even rude, but no one is forcing you to use the software.

I don't think this is a communication issues. The log file is a very basic programmer knowledge. In the past few years, no one has been in trouble in this regard. Sometimes people don't know which file is needed, and they will upload the entire directory. My experience is not to be an early childhood teacher, otherwise there will be endless idiot problems to flood you. Keep a proper threshold and filter out the fool who wastes your time.

carsakiller commented 1 year ago

The statement that people shouldn't expect support is so ridiculous it's hard to reply. If you have released software to the public with the expectations that it be used by any number of people you must expect they will ask for support. If you don't want people asking for support then you should not be releasing software period. I know they may not get the help they need but to expect people not ask or not expect to be able to ask is absurd

People asking for support could be expected, providing support is not expected. This software is MIT licensed, meaning there is no warranty, which is stated in plain English in this sentence:

THE SOFTWARE IS PROVIDED "AS IS"

That being said, many people here have received support, and we never said you can't ask for help - it is just simply not guaranteed that the issue will be solved, so please respect that and don't expect that Sumneko MUST solve your issue.

Anyway, this is completely off-topic, I was just asking you to respect our time and our efforts to assist you, but you continue to speak with disrespect. Respectful criticism is welcome. Saying it is incomprehensible, but not providing info on how things can be improved doesn't give us anywhere to improve.

If this is continued, I will just lock the issue, as I don't want to spend my spare time helping you if you are going to be rude and keep going in circles.


I have provided a solution to the love library issue and provided you the exact steps and code you should need to fix that issue. You have not mentioned attempting the solution, so please try this and see if it solves the love library issue.

But still i have no idea what the other pop up is. Or how to fix the original issue of why they dissabled it or the rest of the issue why it's not seeing anything defined in other files

What other pop up? I will look into changing the keyword for activating luassert so that it is harder to trigger. As for the other issue of everything being undefined, we would need some more info like some sample code and your directory structure for your project to make sure everything is accessible.

JeremiahCheatham commented 1 year ago

Please don't quote me on things i never said. Nothing else needs to be said. Sumneko is how he is and carsakiller is who he is. We can all agree the issue is not going to be solved. How about we let all we have said stand for anyone else to come read. I could quote your lines back to you. Or you can miss quote me again about things i never said. But there is no point there is nothing here i can learn as it's above my head, I'm not a developer on the project. And there is nothing you 2 will learn. So thanks for the, well thanks. And let it stand for others to know the attitudes and actions of what we have said. Again don't miss quote me as i have never said anyone must do anything. I said not expecting people to ask for assistance is absurd and your have benevolent narcissism and arrogance as that is what comes up when people make statements like "no one is forcing you to" as in my way or the highway and you need to be appreciative you have tried to help. Respect is 2 way. and He was disrespectful the entire time, i never took it as a language issue that was your cover for him. And your actions and support of his. Let that stand for the next person to read though.

JeremiahCheatham commented 1 year ago

Also i am constantly confused with the complete rudeness then what seems like have attempt to try and help more. Please let it stand. as you don't need sample code as i gave several examples already and repeatedly said and sent the unspecified log file and so on. If there as something else it would have been said above. It's like as you said above fishing or something. I don't wish to spend any more time upset to people with attitude, communication issues. It's broken so i guess it suck for me. And the others who tried to ask then gave up.

carsakiller commented 1 year ago

Fair enough, I have locked the issue. I have offered solutions which I have not heard anything about since and little effort has been taken to rectify the original issue from the reporter, there has only been effort put into arguing, so I am considering the issue stale and unproductive.

If anyone else is experiencing a similar problem, please open your own issue.