LuaLS / LuaLS/lua-language-server
Process types/annotations in a file but not it's actual content
還沒有人認領這個 Issue。
- 主要語言
- 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)


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?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先,使用列在 Lua.workspace.ignoreDir 中的大型回傳表格來重現該行為,然後將其與 @meta、@diagnostic disable 和 @return table 所回報的效果進行比較。追蹤檔案關閉後,被忽略的檔案和註解是如何處理的。完成標準是:檔案能夠保留其匯出的型別資訊,同時避免對其實際內容進行分析和診斷。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- lua
- 領域
- devtools
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100