LuaLS / LuaLS/lua-language-server

VSCode - Language Server Diagnostics Not Loading Default Libraries

Đang mở
#3,145 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Lua
Star
4.4k
Fork
442
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

No errors on the following code:

Core = {
  Shared = {
    Functions = {}
  }
}

---Makes a deep copy of a given object.
---Does NOT handle metatables or recursive tables.
---@param Obj any The object to be copied.
---@return any Cpy The copied object.
function Core.Shared.Functions.DeepCopy(Obj)
  if Obj then
    local Cpy = nil

    if type(Obj) == "table" then
      Cpy = {}

      for K, V in pairs(Obj) do
        Cpy[Core.Shared.Functions.DeepCopy(K)] = Core.Shared.Functions.DeepCopy(V)
      end
    else
      Cpy = Obj
    end

    return Cpy
  else
    return nil
  end
end
Actual Behaviour

Both the any annotation type, as well as both the type() and pairs() functions, display an error through the diagnostics. However, they are still seemingly recognized internally on all other fronts, as hovering works just fine on the functions, and the any annotation will be properly recognized for the type it is, displaying an error if missing a return and not displaying an error if all returns are present.

This only seems to affect the undefined-global and undefined-doc-name diagnostics. Other than that, I have no idea what caused this...

Reproduction steps
  1. Open VSCode.
  2. Ensure Sumneko's Lua extension is installed and enabled.
  3. Create a new lua file.
  4. Attempt to use any built-in functions or annotations. The error should appear.
Additional Notes

I have spent all 12 hours of my day today trying to figure this out. I'm tired, frustrated, and at a complete loss as to why this is even happening, especially considering it was working just fine as little as last week. My extension has been updated to the most recent version pretty much since the most recent version released.

I'm sure, absolutely positive that I messed something up. But I don't know what. I heard the use of system links can cause issues, but for one the only system links I have are junctions pointing to the install directory of VSCode. Beyond that, from briefly looking at the logs at least, it does not seem like the LS is even using my system links, electing instead to use the full path from my A drive instead of the shortened one on my C drive. Not to mention I've been using system links for well over a year now with absolutely zero issues.

All I did, and I swear all I did, was manually define Lua.workspace.library to an LLS-Addon. That's when the issues started happening. I tried restarting VSCode, restarting the language server, restarting my computer, even reinstalling the extension. Made sure it cleanly uninstalled and everything, even cleaned up my entire user data directory for VSCode for good measure. The issue was still there.

Again, I am sure, almost positive I just...changed a setting or something and forgot about it. But I've been through the configuration settings well over a dozen times at this point, and everything to even remotely do with diagnositics or libraries is at it's default setting.

Log File

service.log

workspace.log

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xem xét service.log và workspace.log đính kèm cùng với thiết lập Lua.workspace.library, đặc biệt là LLS-Addon được cấu hình thủ công. Tái hiện sự cố trong một tệp Lua mới bằng cách sử dụng type(), pairs() và chú thích any; được xem là hoàn tất khi các hàm tích hợp sẵn và chú thích không còn kích hoạt các chẩn đoán undefined-global hoặc undefined-doc-name.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
lua, vscode
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.