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
{{ message }}
Repository navigation
.gitignore starting with * and re-including files via ! patterns ignores the whole workspace #3503
With Lua.workspace.useGitIgnore enabled (the default), the workspace files that git does not ignore are loaded. For example, * followed by !*/ and !*.lua is a common way to ignore everything except directories and .lua files.
Actual Behaviour
No workspace file is loaded at all, including .lua files in the workspace root; only library files are. With useGitIgnore set to false, all files load.
Reproduction steps
In an empty folder, create .gitignore with three lines: *, !*/, !*.lua.
Create b.lua containing local y = undefined_a and sub/a.lua containing local x = undefined_b.
git status --ignored shows neither .lua file as ignored.
lua-language-server --check=<folder> --checklevel=Information prints "no problems found". With .gitignore containing only *.txt, it reports both undefined globals.
Additional Notes
* + !*.lua and /* + !/sub/ behave the same. With ?* as the first line (same meaning for git), b.lua is found, and sub/a.lua is found only when the server's working directory is the workspace folder. This suggests two things in script/glob/gitignore.lua: a pattern like * matches the workspace root itself (empty relative path), and the directory check for !dir/ negations is made relative to the process's current directory instead of the workspace root. Version 3.19.2 (which includes the #3458 fix).
Activity