dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.83k stars 655 forks source link

Intellisense works in 'Folder' but not in 'Workspace' #5580

Open terryaney opened 1 year ago

terryaney commented 1 year ago

Type: Bug

Expected Results: C#/.NET Core Intellisense works when project is opened as a folder or when project is opened via a workspace.

Actual: I have the same exact C#/.NET Core project/folder/file that I try to edit in Visual Studio Code and it behaves differently based on whether or not the project/folder is opened independently or as part of a VS Code workspace with another website

When opened as part of a workspace, intellisense does not work. If I type the whole method names out, it will compile/work, but I can not get intellisense or 'navigate' to methods.

Note: The library/package that being displayed here is 'FastEndpoints'.

When opened as a folder photo_2023-02-08_12-59-51

When opened in a workspace photo_2023-02-08_12-59-58

I'm not sure if the problem is because two .vscode folders are in the workspace?

Scenarios

  1. Workspace file was located within the website folder and referenced website (has .vscode), web api (has .vscode), library project, miscellaneous folder - intellisense in web api does NOT work, but works everywhere else.
  2. Open Folder - simply open the folder of web api and all intellisense works.
  3. Workspace file located outside of any project folders and referenced web api, library project and miscellaneous folder - all intellisense works.
  4. Workspace file located outside of any project folders and referenced web site, web api, library project and misc folder - intellisense in the web site does NOT work, but works everywhere else.

My folder structure is:

Camelot
+--Infrastructure (library project)
+--Domain (library project)
+--Api
|    +--WebService.Proxy (web api)
+--Websites
|    +--Nexgen (web site, originally contained workspace scenario 1)
+--Workspaces
     +--Api (created workspace scenario 3 here)
     +--Websites (created workspace scenario 4 here)

VS Code version: Code 1.75.0 (e2816fe719a4026ffa1ee0189dc89bdfdbafb164, 2023-02-01T15:23:45.584Z) OS version: Windows_NT x64 10.0.22621 Modes: Sandboxed: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz (16 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|undefined| |Memory (System)|63.70GB (43.73GB free)| |Process Argv|--crash-reporter-id 3a73b254-9ee7-4cb6-b1eb-57f9149a1430| |Screen Reader|no| |VM|0%|
Extensions (29) Extension|Author (truncated)|Version ---|---|--- libman|adr|1.0.1 markdown-mermaid|bie|1.17.4 npm-intellisense|chr|1.4.4 xml|Dot|2.5.1 gitlens|eam|13.2.0 vscode-firefox-debug|fir|2.9.8 auto-close-tag|for|0.5.14 Ionide-fsharp|Ion|7.4.0 vscode-autohotkey-plus-plus|mar|3.2.0 theme-monokai-pro-vscode|mon|1.2.0 vscode-docker|ms-|1.23.3 csharp|ms-|1.25.4 vscode-dotnet-pack|ms-|1.0.12 isort|ms-|2022.8.0 python|ms-|2023.2.0 vscode-pylance|ms-|2023.2.10 remote-containers|ms-|0.275.1 vsliveshare|ms-|1.0.5828 vsliveshare-audio|ms-|0.1.93 es6-css-minify|olb|3.3.3 vscode-nuget-gallery|pat|0.0.24 java|red|1.14.0 intellicode-api-usage-examples|Vis|0.2.7 vscodeintellicode|Vis|1.2.30 vscode-java-debug|vsc|0.48.0 vscode-java-dependency|vsc|0.21.1 vscode-java-pack|vsc|0.25.7 vscode-java-test|vsc|0.37.1 vscode-maven|vsc|0.40.4
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 pythonvspyl392:30443607 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263:30335439 pythondataviewer:30285071 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593cf:30376535 pythonvs932:30410667 cppdebug:30492333 vsclangdc:30486549 c4g48928:30535728 dsvsc012cf:30540253 azure-dev_surveyone:30548225 pyindex848:30577860 nodejswelcome1cf:30587006 2e4cg342:30602488 89544117:30613380 pythonsymbol12cf:30657549 ```
Shadowblitz16 commented 1 year ago

I get this too. my project layout looks like this... image

terryaney commented 1 year ago

I've removed the 'Api' project and simply have the Website project and two referenced library projects, and intellisense/code navigation is completely dead :( I get no functionality now and I don't know how to get it back :(

terryaney commented 1 year ago

@Shadowblitz16 FYI, I did the OmniSharp: Select Project suggestion from this stackoverflow answer and it seemed to work. I selected my 'web site' project and intellisense started working. Give it a try. (I didn't have to do OminSharp: Project command)

terryaney commented 1 year ago

FYI, this is hit or miss. I have not been able to have CTRL+T navigation for weeks now, and OmniSharp: Select Project hasn't been able to fix it.