LuaLS / LuaLS/lua-language-server

Exact Classes Do Not Autocomplete Methods

オープン
#2,919 コメント 3 件 リアクション 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?

Completion

Expected Behaviour

Autocomplete should complete methods on instances of (exact) classes.

Expected completion for a normal class:
20241029_094227

Actual Behaviour

Methods are not completed.

20241029_094211

Reproduction steps

VSCode project with v3.11.0 plugin.

All defaults, no .luarc.json.

Ctrl-space at last line.

---@class (exact) Point
--@class Point
---@field x number
---@field y number
local Point = {}

function Point:new(o)
  o = o or {}

  setmetatable(o, self)
  self.__index = self ---@diagnostic disable-line: inject-field

  return o
end

---@param i integer
function Point:add(i)
  self.x = self.x + i
end

---@type Point
local point = Point:new({ x = 1, y = 2 })

point:
Additional Notes

Many thanks for all the fantastic work - luals makes me so much more productive!

Log File

log.tar.gz

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

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

はじめの一歩

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

調査の方向性

提供された Point クラスを使用し、最終行で Ctrl-space を実行して、v3.11.0 プラグインを含む Visual Studio Code プロジェクトで問題を再現します。正確なクラスに対する補完を通常のクラス例と比較します。Point インスタンスで add メソッドが補完候補として提示されれば完了です。

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

評価

技術スタック
lua
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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