LuaLS / LuaLS/lua-language-server

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

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

Nobody has claimed this yet.

Dominant language
Lua
Stars
4.4k
Forks
442
PR merge metrics
No merged PRs in 30d

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_

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.