Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Annotations in inline comments do not recognize others on the same line

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

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

評価

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

調査の方向性

報告にあるインライン Lua アノテーションの例を使って VSCode で問題を再現し、その後、複数行に分割されたアノテーションと、1 行に複数あるアノテーションを比較します。language server が generics、parameters、returns、classes、fields、aliases などの関連するアノテーションをどのように関連付けるかを追跡します。同じ行のアノテーションが別々の行のアノテーションと一貫して解釈されれば完了です。

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

説明

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?

Annotations, Type Checking

Expected Behaviour

Placing multiple annotations in inline comments like so works fine: the generics are interpreted correctly.

--[[@generic C]]
--[[@param any C]]
--[[@return C]]
local function exampleGeneric(any) return any end

So one would expect grouping them together on the same line (like this) would also work:

--[[@generic C]] --[[@param any C]] --[[@return C]]
local function exampleGeneric(any) return any end
Actual Behaviour

In the previous example, the generic seems to be defined, but doesn't carry over properly to the other two annotations. Similarly, adding a line break between the first and second annotation like this

--[[@generic C]]
--[[@param any C]] --[[@return C]]
local function exampleGeneric(any) return any end

allows the generic to be recognized by the second annotation, but not the third. This behavior is also visible in other annotations that require others to be nearby, such as with classes and fields, and aliases.

Reproduction steps
  1. Open VSCode
  2. Paste either of the following examples into an empty lua file:
--[[@class amazingClass]] --[[@field field1 string]] --[[@field field2 number]]
--[[@generic C]] --[[@param any C]] --[[@return C]]
local function exampleGeneric(any) return any end
Additional Notes

While I realize there is little practical use for some of these cases, such as the class definition (as it starts to take up a lot of horizontal space really quickly when defining new fields), this is especially useful when creating a plugin that allows for inline annotation definitions like the following:

local width: integer, height: integer = screen.width, screen.height
local logo: love.Image = textures["logo.png"]

which generates inline comments like so in order to preserve syntax coloring, as well as line numbers during runtime:

local width --[[@type integer ]], height --[[@type integer ]] = screen.width, screen.height
local logo --[[@type love.Image ]] = textures["logo.png"]
Log File

No response

主要言語
Lua
スター
4.4k
フォーク
442
平均マージ
8日 9時間
マージ済み PR(30日)
1

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

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

はじめの一歩

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

LuaLS/lua-language-server のほかの issue

LuaLS/lua-language-server の issue をすべて見る

似ている issue

Lua の issue をもっと見る

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

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