You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, files that are ignored (either via the ignoreDirs or ignoreGlobs setting) are not parsed at all (which was a deliberate change).
However, this is a problem if your project contains vendored library files that trigger diagnostics -- in this case, you do want these files to be parsed but you simply don't want any diagnostics to be reported, especially with emmylua_check. (Otherwise you'll trigger errors in your files because emmylua doesn't know about the vendored API and types.)
(I also didn't find a (documented) way of marking files as ignored via --- emmylua: ignore comments, but an additional config setting for "parse but don't diagnose" would be more useful.)
If it is a file, adding meta will not trigger a diagnosis. If it is a directory added to the library, it will not be diagnosed either. Note that the library is resolved before the workspace, and the library is unaware of the definitions in the main workspace.
For me, it's a single (non-meta) file vendored inside the main sources (say, lua/foo/vendored.lua if my main module is foo), so adding it to the library will have it processed twice. Unless I'm missing something from your suggestion?
Adding ---@meta to the top of the file works, for the record. It would be cleaner not having to touch vendored files at all (especially if there are multiple), though, and this annotation breaks luals (which is an issue when you want or need to migrate incrementally, like I do).
A related issue around the two different aspects ignoring files is the following: In my (Neovim-based) projects, I download the Neovim runtime (and several other dependencies) to a .test-deps folder. I am then specifying (via an environment variable $VIMRUNTIME) the runtime as a workspace library; at the same time, I do not want to check all the dependencies themselves. So my luarc.json has the following:
If $VIMRUNTIME is a subdirectory of .test-deps, this works with luals but doesn't work with emmylua_check. (This could also be solved by simply having library overriding ignoreDir/Glob.)
A related issue around the two different aspects ignoring files is the following: In my (Neovim-based) projects, I download the Neovim runtime (and several other dependencies) to a .test-deps folder. I am then specifying (via an environment variable $VIMRUNTIME) the runtime as a workspace library; at the same time, I do not want to check all the dependencies themselves. So my luarc.json has the following:
"workspace": {
"library": [
"$VIMRUNTIME",
"${3rd}/busted/library"
],
"ignoreDir": [
".test-deps",
"tests"
]
},
If $VIMRUNTIME is a subdirectory of .test-deps, this works with luals but doesn't work with emmylua_check. (This could also be solved by simply having library overriding ignoreDir/Glob.)
Does that mean ignore doesn't apply to paths added to library?
Do you think the include setting should also apply to the lib (library)? There isn't an official interface for that, but you can effectively enable it through the runtime.extensions configuration. Keep in mind that not all Lua source files use the .lua extension — I'll often see names like .lua.txt, .bytes, or plain .txt.
Good question -- I don't use that setting, so I can't really comment. Generally, I think when the settings are in conflict, a specific path should take precedence over a more general path?
Now the ignoreGlobs is only used on current workspace filter, but it will cause problems when I add plugin cache (default ~/.local/share/nvim/lazy). As the filter no longer filter files, nvim-higlight-colors/lua/color/nvim-higlight-colors/buffer_utils_spec.lua is parsed. Mock test will override vim.fn and cause incorrect warnings on calling vim.fn.foo. When perform goto definition action on vim.fn, it will be navigated to this position.
I think the reason is that Lua doesn't provide enough conventions for me to follow; to fix this, we need to support a multi-lib configuration system that allows each library's .luarc to take effect independently.
I think the reason is that Lua doesn't provide enough conventions for me to follow; to fix this, we need to support a multi-lib configuration system that allows each library's .luarc to take effect independently.
But actually many nvim plugins do not follow the standard .luarc.json convention (eg, nvim-highlight-colors), so just directly reading from each library's .luarc might have some issues
I guess the most robust solution is to handle this directly within the .emmyrc.json.
Either something like
A simpler (but harder to document) fix could be to have only ignoreDirs being ignored for library paths (since they're both "dirs"), while ignoreGlobs still applying to library?
But actually many nvim plugins do not follow the standard .luarc.json convention (eg, nvim-highlight-colors)
Yes, but they should. So why not open an issue about (or even better, a PR) adding one?
Yes, but they should. So why not open an issue about (or even better, a PR) adding one?
While I agree that they should put a .luarc.json in their repo, but because it's not forced behavior, I guess some plugin authors might not want to put it into their repo or like maybe that repo is rarely maintained and they just accept critical prs? Also, there are a lot of plugins that I used don't have this file in their repo, so it's kinda a big task to find them all and pr them one by one. Moreover, I think most people just let nvim plugins managed by the plugin managers and these plugins should be treated as immutable/read-only dependencies. Well, at least imo it's better that there's a way to configure how these libraries are indexed locally without modifying the upstream source or maintaining forks. But still these are just my personal thoughts. I'm new to lua and nvim, so I don't know if this is exactly what everyone else needs, maybe we can propose a better solution with more people discuss about this
It can also be configured directly as a specific file; in that case the module name is the filename, and it can be mixed with the traditional plain-string configuration.
Yes, regression bisected to faf2233 (Sorry for not immediately testing that!)
Just to make clear: My main issue here is the opposite than what is handled in that commit: I have a library directory inside an ignoreDir, not some files/directories inside a library I want to ignore!
Activity
CppCXY commentedon Dec 5, 2025
If it is a file, adding meta will not trigger a diagnosis. If it is a directory added to the library, it will not be diagnosed either. Note that the library is resolved before the workspace, and the library is unaware of the definitions in the main workspace.
clason commentedon Dec 5, 2025
For me, it's a single (non-meta) file vendored inside the main sources (say,
lua/foo/vendored.luaif my main module isfoo), so adding it to the library will have it processed twice. Unless I'm missing something from your suggestion?xuhuanzy commentedon Dec 5, 2025
---@meta鸟用没有, meta 应该只过滤一些诊断而不是过滤全部CppCXY commentedon Dec 5, 2025
Currently the library only supports directories, but we should be able to improve this.
clason commentedon Dec 5, 2025
Adding
---@metato the top of the file works, for the record. It would be cleaner not having to touch vendored files at all (especially if there are multiple), though, and this annotation breaks luals (which is an issue when you want or need to migrate incrementally, like I do).clason commentedon Dec 8, 2025
A related issue around the two different aspects ignoring files is the following: In my (Neovim-based) projects, I download the Neovim runtime (and several other dependencies) to a
.test-depsfolder. I am then specifying (via an environment variable$VIMRUNTIME) the runtime as a workspace library; at the same time, I do not want to check all the dependencies themselves. So myluarc.jsonhas the following:If
$VIMRUNTIMEis a subdirectory of.test-deps, this works with luals but doesn't work withemmylua_check. (This could also be solved by simply havinglibraryoverridingignoreDir/Glob.)CppCXY commentedon Dec 8, 2025
Does that mean ignore doesn't apply to paths added to library?
clason commentedon Dec 8, 2025
Yes, that would be my suggestion (and expectation, coming from luals).
CppCXY commentedon Dec 8, 2025
Do you think the include setting should also apply to the lib (library)? There isn't an official interface for that, but you can effectively enable it through the
runtime.extensionsconfiguration. Keep in mind that not all Lua source files use the .lua extension — I'll often see names like .lua.txt, .bytes, or plain .txt.clason commentedon Dec 8, 2025
Good question -- I don't use that setting, so I can't really comment. Generally, I think when the settings are in conflict, a specific path should take precedence over a more general path?
CppCXY commentedon Dec 8, 2025
I've submitted the code; please try it.
clason commentedon Dec 8, 2025
Yes, works fine now, thank you!
aurora0x27 commentedon Dec 29, 2025
Now the
ignoreGlobsis only used on current workspace filter, but it will cause problems when I add plugin cache (default~/.local/share/nvim/lazy). As the filter no longer filter files,nvim-higlight-colors/lua/color/nvim-higlight-colors/buffer_utils_spec.luais parsed. Mock test will overridevim.fnand cause incorrect warnings on callingvim.fn.foo. When performgoto definition actiononvim.fn, it will be navigated to this position.file pos
This
**/*_spec.luafile was supposed to be filtered before this patch.My configuration:
{ "$schema": "https://raw.githubusercontent.com/EmmyLuaLs/emmylua-analyzer-rust/refs/heads/main/crates/emmylua_code_analysis/resources/schema.json", "runtime": { "version": "LuaJIT", "requirePattern": [ "lua/?.lua", "lua/?/init.lua", "?/lua/?.lua", "?/lua/?/init.lua" ] }, "workspace": { "library": [ "$VIMRUNTIME", "$LLS_Addons/luvit", ], "ignoreGlobs": ["**/*_spec.lua" ] }, "codeAction": { "insertSpace": true }, "strict": { "typeCall": true, "arrayIndex": true } }CppCXY commentedon Dec 29, 2025
I think the reason is that Lua doesn't provide enough conventions for me to follow; to fix this, we need to support a multi-lib configuration system that allows each library's .luarc to take effect independently.
lxymahatma commentedon Dec 29, 2025
But actually many nvim plugins do not follow the standard .luarc.json convention (eg, nvim-highlight-colors), so just directly reading from each library's .luarc might have some issues
I guess the most robust solution is to handle this directly within the .emmyrc.json.
Either something like
for entire library imports or like more detailed
clason commentedon Dec 29, 2025
A simpler (but harder to document) fix could be to have only
ignoreDirsbeing ignored forlibrarypaths (since they're both "dirs"), whileignoreGlobsstill applying tolibrary?Yes, but they should. So why not open an issue about (or even better, a PR) adding one?
lxymahatma commentedon Dec 29, 2025
While I agree that they should put a .luarc.json in their repo, but because it's not forced behavior, I guess some plugin authors might not want to put it into their repo or like maybe that repo is rarely maintained and they just accept critical prs? Also, there are a lot of plugins that I used don't have this file in their repo, so it's kinda a big task to find them all and pr them one by one. Moreover, I think most people just let nvim plugins managed by the plugin managers and these plugins should be treated as immutable/read-only dependencies. Well, at least imo it's better that there's a way to configure how these libraries are indexed locally without modifying the upstream source or maintaining forks. But still these are just my personal thoughts. I'm new to lua and nvim, so I don't know if this is exactly what everyone else needs, maybe we can propose a better solution with more people discuss about this
CppCXY commentedon Jan 26, 2026
I have update the workspace.library config, it can config like:
{ "workspace.library": [ { "path": "rx", "ignoreGlobs": [ "*.lua.txt" ] }, "$VIMRUNITME", "XXX/to/file.lua" ] }It can also be configured directly as a specific file; in that case the module name is the filename, and it can be mixed with the traditional plain-string configuration.
see: faf2233
clason commentedon Mar 6, 2026
@CppCXY Can it be that something has regressed in the new release? My setup
no longer finds the
$VIMRUNTIMEas a subdirectory of.test-deps, which I tested in January and it worked. Do I need to adapt the config?clason commentedon Mar 6, 2026
Yes, regression bisected to faf2233 (Sorry for not immediately testing that!)
Just to make clear: My main issue here is the opposite than what is handled in that commit: I have a
librarydirectory inside anignoreDir, not some files/directories inside alibraryI want to ignore!xuhuanzy commentedon Jun 19, 2026
close?