LuaLS / LuaLS/lua-language-server

Process types/annotations in a file but not it's actual content

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

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

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

説明

I use Lua both as programming language and as file format for storing data and dynamicaly loading it into Lua enviroment. Usually this data is generated, saved and loaded during a single script execution. These files are pretty big and contain a single value of known type which is returned.
Since these files are huge, they shouldn't be processed in a usual manner. Thus, they should be put into Lua.workspace.ignoreDir list. However, in that case the type of returned value will not processed as well (actually, it is processed as long as the file is opened, but once it's closed, language server forgets its type. Here is an example of such behaviour. filters.lua is a big table of words that are to be filtered during text processing)
image
image
I tried to put ---@meta annotation in that file in hopes that contents of returned table would not be processed but they were which was unexpected. I tried to use ---@diagnostic disable annotation but it seems that the file still is being diagnosted. I also tried to put ---@return table annotation on top of the file (since each lua file is basically a function) but this annotation is ignored.
So right now, it seems that a file can be either ignored or processed entirely. Is there a way to somehow specify types in a file but disable all other processing of it?

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

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

はじめの一歩

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

調査の方向性

まず、Lua.workspace.ignoreDir に一覧表示された大きな返却テーブルを使って動作を再現し、その後、@meta、@diagnostic disable、@return table で報告されている影響と比較します。ファイルを閉じた後に、無視されたファイルとアノテーションがどのように処理されるかを追跡します。ファイルがエクスポートする型情報を保持しながら、実際の内容に対する解析と診断を回避できれば完了です。

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

評価

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

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

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