Skip to content

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

Open
@ArmoredPony

Description

@ArmoredPony

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat/diagnosticsRelated to the diagnostics featurefeat/type checkRelated to the type checking feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions