dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.86k stars 673 forks source link

Support virtual workspaces #4538

Open lszomoru opened 3 years ago

lszomoru commented 3 years ago

👋 Hi there, Martin here, from the VS Code team.

Recently we've announced the Remote Repository feature that lets you browse and edit files and folders directly on GitHub.

Open Remote Repository... opens VSCode on a folder or workspace located on a virtual file system. We call this a virtual workspace. We observed that not all extension support this well, either because they can not, or they haven't thought about it.

It would be fantastic if you could test whether your extension can handle virtual workspaces:

Check out the Virtual Workspaces Extension Author Guide on how to do that.

When done, set the new virtualWorkspaces capability in your 'package.json'.

{
  "capabilities": {
    "virtualWorkspaces": true | false
  }
}

For questions and comments please use the Virtual Workspaces Tracking Issue.

Thanks for the support and the great work! ❤️

JoeRobich commented 3 years ago

To support virtual workspaces we would need to route all OmniSharp-Roslyn file access (meaning MSBuild as well) through the extension. Opened a PR to mark that virtualWorkspaces are not supported at this time.

aeschli commented 3 years ago

Thanks for adopting the virtualWorkspaces capability!

It's now also possible to give a description why the capability is enabled or disabled:

{
  "capabilities": {
    "virtualWorkspaces": {
      "supported": false,
      "description": "Debugging is not possible in virtual workspaces."
    }
  }
}
{
  "capabilities": {
    "virtualWorkspaces": {
      "supported": "limited",
      "description": "In virtual workspaces, resolving and finding references across files is not supported."
    }
  }
}

This message can be seen in the extensions view: image

JoeRobich commented 3 years ago

Reopening to track providing a description of why virtual workspaces are unsupported.

aeschli commented 3 years ago

I forgot to mention that the new format requires 1.57 insiders.

John0King commented 2 years ago

I have an idea that it's possiable to add limited support for virtual workspaces.

  1. LSP Client try find a file with .csproj and post it's content to LSP Server
  2. LSP Server read it's TargetFramework and load a local version of Sdk
  3. now it's support for add intellsense to Sdk types.

more adventage:

  1. Server ask Client to find class/enum/struc/record file (using RegExp ) and then client post them all to the server
  2. Server read the file and full support of intellsence worked.