LuaLS / LuaLS/lua-language-server

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

オープン
#2,901 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Lua
スター
4.4k
フォーク
442
PR マージ指標
30日以内にマージされた PR はありません

説明

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:

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

2ファイルの例と説明されている自動補完の手順を使用して、Visual Studio Code拡張機能で問題を再現します。診断と補完の際に module("MyExampleModule") がどのように処理されるかを追跡し、その後、HelloWorld が _G.HelloWorld ではなく _G.MyExampleModule の下で候補として提示されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
lua
領域
devtools
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。