LuaLS / LuaLS/lua-language-server

`module()` function isn't respected by the language server

Đang mở
#2,901 0 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?

Linux

### What is the issue affecting?

Diagnostics/Syntax Checking

### Expected Behaviour

When `module()` is used in a script, functions defined "globally", like so:
```lua
module("MyExampleModule")

function HelloWorld() end
```
Are understood by the language server to belong to the table at `_G.MyExampleModule`

### Actual Behaviour

Using the above example, the language server incorrectly believes `HelloWorld()` is at `_G.HelloWorld()` as opposed to `_G.MyExampleModule.HelloWorld()`

### Reproduction steps

1. Copy the above example into a file
2. Create another file in the same workspace
3. Type "Hello"
4. Observe that the autocomplete suggests the function `_G.HelloWorld()`, which does not exist

### Additional Notes

This cannot be worked around with `setfenv()`

### Log File

N/A

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

Tái hiện vấn đề trong tiện ích mở rộng Visual Studio Code bằng ví dụ gồm hai tệp và bước tự động hoàn thành đã mô tả. Theo dõi cách module("MyExampleModule") được xử lý trong quá trình chẩn đoán và hoàn thành, sau đó xác minh rằng HelloWorld được đề xuất dưới _G.MyExampleModule thay vì _G.HelloWorld.

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
Lĩnh vực
devtools
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 tả rõ ràng
Mức phù hợp với người mới
45/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.