microsoft / vscode

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

Some markdown files line changes are not shown in the editor #198632

Open Ramin-RX7 opened 10 months ago

Ramin-RX7 commented 10 months ago

Does this issue occur when all extensions are disabled?: Yes

It's been a long time that I can not see the git changes next to editor lines in my markdown files. I disabled all extensions and it seems there is a problem with vs code itself, not extensions I use.

Steps to Reproduce:

  1. Open a markdown file
  2. commit the changes
  3. add more changes
  4. unlike other type of files

However this does not always happen. At first I though it happens on specific git repos but now some markdown files of my repo can detect changes, some dont.

This problem also corrupt the git (source control) changes where when I open those files (the ones that do not mark the new/modified lines), instead of showing the full file and the changes, it only shows me the staged changes lines.

As of now I'm facing this issue in this repo. The main README.md works perfectly fine, but other markdown files in the repo have the problem i mentioned.

A file that works fine: (README.md) image

A file that does not work as expected: image

lszomoru commented 10 months ago

@Ramin-RX7, thanks for filing this issue. Is there anything specific for the files in which you are able to reproduce the issue? Are they all in the same directory maybe? Do you by any chance have symbolic links inside the git repository? A recording using (https://gifcap.dev) would also be helpful to further investigate the issue. Thanks!

Ramin-RX7 commented 10 months ago

@lszomoru As you can see in the video, In the same directory one file changes works fine but the other one don't. Recording 2023-12-14 at 13 07 45 video

However it is worth mentioning that only 2 markdown files works fine showing the changes (out of 30!)

Also I couldn't find any relation between the files that this feature works correctly.

lszomoru commented 10 months ago

@alexr00, are you aware of any known issues that would result in this behaviour? Thanks!

alexr00 commented 9 months ago

I don't know of any issues that would cause this and I'm not able to repro the issue. @Ramin-RX7 could you try VS Code version 1.85?

Ramin-RX7 commented 9 months ago

@alexr00 Currently I'm on 1.85.1. Still not fixed

alexr00 commented 9 months ago

@Ramin-RX7 I'm going to need some more help understanding how to reproduce the issue. Can you try the following:

  1. Open the folder that you're seeing the issue in in VS Code
  2. Close all your open editors
  3. Reload VS Code and proceed directly to step 4
  4. Open a markdown file from the VS Code file explorer
  5. Try to reproduce the issue.

Does the issue still happen if you do only those steps?

Ramin-RX7 commented 9 months ago

@alexr00 I tried the steps you provided. Yes I still face the issue.

Since you can not reproduce it maybe you can try the same repo I'm facing it. If you can not do it, it's still ok.

In the upcoming week I will try on some other repositories to see if I can find a reason that this happens on some files and not on some others.

Also it might be good to know that this does not happen when I tried it in a Github Codespace (via vscode in web browser). The line changes where shown fine.

alexr00 commented 9 months ago

Thanks for trying @Ramin-RX7. I'm still not able to repro. Would you be able to take a full screen recording of what you do when you repro the issue, starting from when you reload or open VS Code?

Ramin-RX7 commented 9 months ago

@alexr00 Sorry, I have been busy these past few days and forgot about this. Here as you can see all editors are closed. I reload the vscode. Then I open two markdown files randomly and the line changes are not shown. Recording 2023-12-23 at 12 25 26

alexr00 commented 9 months ago

Thanks @Ramin-RX7! Somehow, I am still not able to repro the issue. @lszomoru is there somehow some setting for git that will prevent some files from being noticed?

lszomoru commented 8 months ago

I don't believe that this is caused by "git not noticing files". When I look at the recording I see that when the file is saved, the Source Control view refreshes and the modified file appears in the list of changes.

The problem seems to be with the dirty diff decorator not appearing when the new lines are added to the markdown files. As far as I know, when a file is being opened, VS Code will call the git file system provider to get the contents of the latest version of the file. From where VS Code will compute diffs based on the contents of the original file, and the dirty file.

@Ramin-RX7, in your recording you are adding new lines to the file. What happens if you modify an existing line? Does the modified line decorator appears for the modified line?

Ramin-RX7 commented 8 months ago

@lszomoru Nothing happens basically. The same thing that you mentioned (Source Control view refreshes and the modified file appears in the list of changes.) happens but the line changes in the editor (blue color for modified lines) are not shown

lszomoru commented 8 months ago

@Ramin-RX7, thanks for the update. Could you please try the following:

  1. Close all opened files in VS Code
  2. Invoke the "Git: Show Git Output" command from the command palette
  3. Click the "Clear Output" command in the panel (it's next to the lock icon)
  4. Open the file where you can reproduce the issue
  5. Send us the contents of the Git output window
Ramin-RX7 commented 8 months ago

Hey @lszomoru, This is the output I get:

# When I open a file (factories_mapping.md)
2024-01-24 12:06:16.189 [info] > git check-ignore -v -z --stdin [64ms]
2024-01-24 12:06:17.441 [info] > git ls-files --stage -- F:\Coding\Github\Shifty\docs\principals\factories\factories_mapping.md [88ms]
2024-01-24 12:06:17.452 [info] > git show --textconv :docs/principals/factories/factories_mapping.md [155ms]

# After I make some changes:
2024-01-24 12:06:37.967 [info] > git config --get commit.template [132ms]
2024-01-24 12:06:37.972 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) --ignore-case refs/heads/main refs/remotes/main [82ms]
2024-01-24 12:06:38.050 [info] > git ls-files --stage -- F:\Coding\Github\Shifty\docs\principals\factories\factories_mapping.md [101ms]
2024-01-24 12:06:38.136 [info] > git status -z -uall [103ms]
2024-01-24 12:06:38.172 [info] > git show --textconv :docs/principals/factories/factories_mapping.md [66ms]