LuaLS / LuaLS/lua-language-server

Multiple return values for fields

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

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

feat/LuaCats Annotations
主要言語
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?

Windows

What is the issue affecting?

Annotations

Expected Behaviour

The ability to define multiple return values for a field annotation.

Actual Behaviour

Any non-identifier symbol following a type is treated as a comment or a break.

Reproduction steps
  1. Create a field with a comma separated return type.
  2. See that anything following the comma is treated as a comment.
Additional Notes
---@class Color
---@field [string] Color,string
Color = {}

,string is highlighted as a comment.

---@class Color
---@field [string] Color, string
Color = {}

, is highlighted as a symbol, string is highlighted as a comment.


An example of fields with multiple return types are the named color lookups in the Tabletop Simulator API:
https://api.tabletopsimulator.com/color/#colorblue

local color, name = Color.Blue
print(color) -- Color: Blue { r = 0.118, g = 0.53, b = 1, a = 1 }
print(name) -- Blue

local color, name = Color.Red
print(color) -- Color: Red { r = 0.856, g = 0.1, b = 0.094, a = 1 }
print(name) -- Red
Log File

No response

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

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

はじめの一歩

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

調査の方向性

まず、提供された Lua スニペットを使ってアノテーションパーサーの動作を再現し、@field 宣言の後にあるカンマ区切りの型がどのようにトークン化されるかに注目します。Color,string のような複数の戻り値型がアノテーション型として認識され、残りの部分がコメントとして扱われないことを確認できれば完了です。リポジトリに関連するパーサーテストがある場合は、カバレッジを追加または更新してください。

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

評価

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

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

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