microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164k stars 29.2k forks source link

`.gitignore` ignores subproject `node_modules/` but VS Code still highlight it as green #227057

Open Aierbote opened 2 months ago

Aierbote commented 2 months ago

Does this issue occur when all extensions are disabled?: Yes/ No (the node_modules/ are now gray, after stopping Bisect the issue seems gone... I don't think it was caused by an extension)

Steps to Reproduce:

  1. Create a this repo tree folder
.
├── project1
│   ├── node_modules
│   └── ***
├── project2
│   ├── subproject
│   │   ├── node_modules
  1. Update .gitignore by replacing */node_modules with **/node_modules/ (I added both ** and / while figuring out if it was working by following a couple of suggestions found on StackOverflow )

  2. GitGraph shows the count of uncommitted changes updated, but the UI of the Explorer Panel still shows some folder highlighted in green, while it content is grayed out (if checked by expanding the folder)

  3. Using Bisect stopped the issue turning that folder into grey, but somehow persisted the fix after stopping Bisect (That's reason why I don't have screenshot of the issue 😅)

Side Note

! I know it might seems redundant to ask a fix for this, it would be better to create different repos for each project, but it's not the first time I stumbled upon this and it was really confusing, I had even started a series of edit+commit cycle to spot if the fix had worked than night

Aierbote commented 2 months ago

Inicidentally the wrong coloring appeared againg after uninstalling a deprecated Type Definition

image

As you can see the folder is colored (as the ""changed"" @types/ which wasn't even never tracked in the first place) but all other libraries have grey folders

lszomoru commented 2 months ago

@Aierbote, the folder is coloured but I am not convinced that the "decoration" is coming from source control. Source control would only create decorations for the files that are being listed in the "Source Control" view. Could you expand the folder, so that you find the actual file that is coloured? I would expect that a language server (TypeScript?) emitted some problems in a file that results in the colouring.

Aierbote commented 2 months ago

I'm sorry I cannot reproduce that, it was even odd and incidental, I'm pretty sure there was no file causing the error, that nested node_modules/@types/ had nothing but google.maps/ installed and I spotted the coloring arising only after I run npm uninstall

In the meantime I continue developing and by installing again the dependecy everything was back to normal

lszomoru commented 2 months ago

Next time you notice this type of colouring please expand the folders to the file that is coloured. Open the file and see what kind of squiggles are present in the file. As mentioned in my previous comment, source control decorations are only created for files that contain changes along with decoration letters (ex: M, A, U, etc.).

RedCMD commented 2 months ago

That is definitely the warning error decoration

Modified uses a slightly lighter yellow colour

you should have been able to see it in the problems tab image