dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 666 forks source link

C# IntelliSense does not refresh for externally edited files in symlink directory until said files are opened and resaved in VS Code #3328

Open TobiasWehrum opened 4 years ago

TobiasWehrum commented 4 years ago

Issue Type: Bug

  1. Create a new C# project with dotnet new console.
  2. Create another folder to link, e.g. a folder above the project called "LinkedFolder".
  3. Create a symbolic link or a junction, e.g. by calling mklink /J Linked "..\LinkedFolder".
  4. With VSCode, create a class in Test.cs in the LinkedFolder.
  5. Use that class in the C# project's Program.cs. Note that IntelliSense works.
  6. Close all tabs except Program.cs.
  7. With an external editor, modify Test.cs (e.g. add a public const field).
  8. Try to use the new field in Program.cs. IntelliSense does not know it.
  9. Open Test.cs.
  10. Save it without editing it.
  11. IntelliSense in Program.cs will now know the new field.

VS Code version: Code 1.38.1 (b37e54c98e1a74ba89e03073e5a3761284e3ffb0, 2019-09-11T13:35:15.005Z) OS version: Windows_NT x64 6.1.7601

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz (4 x 2533)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: unavailable_off
protected_video_decode: unavailable_off
rasterization: unavailable_off
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|7.99GB (0.41GB free)| |Process Argv|C:/dev/Projekte/Unity/Contract Work/Canvas City/CanvasCity Unity -g C:\dev\Projekte\Unity\Contract Work\Canvas City\CanvasCity Unity\Assets\Scripts\AR\AREditorController.cs:1:0| |Screen Reader|no| |VM|0%|
Extensions (32) Extension|Author (truncated)|Version ---|---|--- vscode-ron|a5h|0.4.0 vscode-sqlite|ale|0.8.0 vscode-color|ans|0.4.5 vscode-intelephense-client|bme|1.2.3 better-toml|bun|0.3.2 vsc-rustfmt|Con|0.1.0 vscode-eslint|dba|1.9.1 vscode-wasm|dts|1.2.1 vscode-html-css|ecm|0.2.3 vscode-npm-script|eg2|0.3.9 eppz-code|epp|1.2.41 lintlens|ghm|2.7.0 todo-tree|Gru|0.0.158 vscode-test-explorer|hbe|2.14.6 csharpextensions|jch|1.3.0 csharp|ms-|1.21.4 vscode-typescript-tslint-plugin|ms-|1.2.2 LiveServer|rit|5.6.1 vscode-jest-test-adapter|rtb|0.2.0 rust|rus|0.6.3 csspreview|san|1.0.2 react-component-refactor|san|0.2.0 crates|ser|0.4.3 markdown-preview-enhanced|shd|0.4.3 vscode-scss-formatter|sib|1.4.2 html5-boilerplate|sid|1.0.3 rust-pack|Swe|0.2.23 vscode-rust-test-adapter|Swe|0.8.0 vs-code-node-require|tgr|1.4.0 unity-debug|Uni|2.7.2 vscodeintellicode|Vis|1.1.9 vscode-import-cost|wix|2.12.0
rchande commented 4 years ago

@filipw Do you think this is an omnisharp issue or a file watching issue with VS Code itself?

filipw commented 4 years ago

we'd need to see OmniSharp log with "omnisharp.logginglevel":"debug". VS Code should report file changes to the server - OmniSharp will not watch for files. If the changes are not reported, then it's VS Code, if they are we start digging into OmniSharp 😀

filipw commented 4 years ago

my gut feeling would be that changes don't get reported, the file watchers in VS Code are famously flaky

TobiasWehrum commented 4 years ago

Saving the file with VSCode with "omnisharp.loggingLevel":"debug" enabled triggers lots of OmniSharp log outputs. Changing and saving the file with an external editor seems to trigger no logs from OmniSharp at all.