Line with just a space in gitignore causes whole project to be ignored

Closed
#3,458 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
64/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
lua
Domain
devtools

Research direction

Reproduce the behavior with the Lua.workspace.useGitIgnore setting enabled, a .gitignore containing only a space, and the a.lua assignment described in the issue. Trace the gitignore handling used by diagnostics and verify that a whitespace-only line is ignored without causing the whole project to be ignored.

Written by the indexing model from the issue text.

Description

How are you using the lua-language-server?

Visual Studio Code Extension (sumneko.lua)

Which OS are you using?

Windows

What is the issue affecting?

Diagnostics/Syntax Checking

Expected Behaviour

An empty space (literally just ) along with "Lua.workspace.useGitIgnore" : true being set seems to be causing my whole project to be ignored.

Actual Behaviour

I'd expect it to be ignored. The .gitignore docs (https://git-scm.com/docs/gitignore#_pattern_format) say:

Trailing spaces are ignored unless they are quoted with backslash ("").

Reproduction steps
  1. Assign global in a.lua: x = 100
  2. Add .gitignore with empty space character
  3. See below:
Image

Removing the .gitignore file fixes the issue.

Additional Notes

No response

Log File

No response

Dominant language
Lua
Stars
4.4k
Forks
442
Avg merge
8d 9h
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from LuaLS/lua-language-server

All issues in LuaLS/lua-language-server

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.