LuaLS / LuaLS/lua-language-server
Infer pcall arguments from the first function parameter
まだ誰も着手していません。
- 主要言語
- Lua
- スター
- 4.4k
- フォーク
- 442
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
Hi 👋
I was wondering if it would be possible for LuaLS to infer the types of the arguments passed to pcall based on the signature of its first function argument. This would significantly improve developer experience, especially when working with typed Lua (e.g., EmmyLua annotations) or when relying on auto-completion and type checking.
Example:
local function greet(name: string)
print("Hello, " .. name)
end
pcall(greet, "world")
^- here we should see `name: string`
In this case, it would be great if LuaLS could infer that greet expects a string, and therefore type-check or suggest "world" accordingly when passed to pcall.
Currently, the parameters after the first one are not checked or suggested with much context, making it less ergonomic when using pcall (or other similar functions) for safe calls.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、例に示されている pcall の呼び出しを LuaLS がどのように処理し、関数シグネチャに対して引数をどのようにチェックしているかを追跡します。関連する型チェックと補完の経路を特定し、その後、最初の関数パラメーター以降の引数が、型付き Lua 呼び出しに期待されるコンテキストを受け取ることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- lua
- 領域
- developer-experience, devtools
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100