LuaLS / LuaLS/lua-language-server

An annotation for indicating that a function may error

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

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

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

説明

It would be pretty useful to have an indicator of whether the function may error (and thus needs to be handled with `pcall` or the like).
```lua
---@fallible
---@param bar string
---@return string bar
local function assert_is_foobar(bar)
if bar ~= "foobar" then
error("bar isn't equal to foobar")
end
return bar
end
```
I'm aware of #1881 but it doesn't fullfill the same purpose as `@fallible`, the main difference being the fact that `@noreturn` indicates that the function never returns while this indicates that the function could return an error

The LSP server could also potentially show the user a warning if they don't wrap a `@fallible` function in a `pcall` call

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

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

はじめの一歩

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

調査の方向性

まず、言語サーバーが現在、関連する @noreturn アノテーションをどのように扱い、pcall の使用をどのように解析しているかを確認してください。この issue ではファイルもテストも指定されておらず、想定される警告の動作も任意と説明されているため、コーディングの前に実装範囲と完了条件を明確にする必要があります。

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

評価

技術スタック
lua
領域
devtools
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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