vscode-projects-plus icon indicating copy to clipboard operation
vscode-projects-plus copied to clipboard

Projects with `.code-workspace` paths aren't highlighted

Open StefanoCecere opened this issue 6 years ago • 10 comments

i have a few .code-workspace proejcts. they are opened, but in the bottom status bar title, they are shown as "No project" (normal project show their title)

ciao!

StefanoCecere avatar Jul 09 '18 23:07 StefanoCecere

That would be cumbersome to implement without this proper API: https://github.com/Microsoft/vscode/issues/37421.

Let's wait until they implement it.

fabiospampinato avatar Jul 09 '18 23:07 fabiospampinato

I am having the issue of "No project"

This could be fixed with i.e. "search-path":

"projects": [
    {
      "name": "MyProject",
      "description": "MyProject Master Project",
      "icon": "globe",
      "path": "~/Source/MyProject/MyProject.code-workspace",
      "search-path": "~/Source/MyProject"
    }
  ]

This does almost nothing except restore back the default functionality of Project+ by allowing you to specify a path. Which fixes the problem. Or just make the "path" an optional array.

If/when the workspace config API is added, this does not interfere with that. The user might want to have an optional path and workspace file.

Yzrsah avatar Dec 05 '18 09:12 Yzrsah

@Zyrsha I'm not sure how that extra property would solve the issue.

To be clear we can solve this today: if we can't recognize the current project we could open all .code-workspace files and check if any of them matches the current setup, no need for extra properties. But this solution is not great, in order to implement the "right" solution we would need to know the path to the current .code-workspace file, and there's no API for that.

fabiospampinato avatar Dec 05 '18 17:12 fabiospampinato

"projects": [
    {
      "name": "MyProject",
      "description": "MyProject Master Project",
      "icon": "globe",
      "path": "~/Source/MyProject/MyProject.code-workspace",
      "search-path": "~/Source/MyProject"
    }
  ]

Has the same path search behavior as if you used:

"projects": [
    {
      "name": "MyProject",
      "description": "MyProject Master Project",
      "icon": "globe",
      "path": "~/Source/MyProject"
    }
  ]

The only difference is that the workspace file is loaded when opening the project. But the rest of the behavior of Project+ stays the same as it was before, as if you had added nothing new except for loading of a workspace file.

Alternate syntax for the same thing:

"projects": [
    {
      "name": "MyProject",
      "description": "MyProject Master Project",
      "icon": "globe",
      "path": "~/Source/MyProject"
      "workspace": "~/Source/MyProject/MyProject.code-workspace",
    }
  ]

Yzrsah avatar Dec 05 '18 23:12 Yzrsah

@Zyrsha I'm not sure where you're getting at with this. We already support opening .code-workspace files (just put them as the value of path), and we could already support them even in the statusbar item without the need for any extra properties, but the solution would be very clunky.

fabiospampinato avatar Dec 06 '18 20:12 fabiospampinato

The issue can be fixed in a few lines of code.

You add a second key which allows to specify the project root and code-workspace separately. So we have optionally TWO PATHS: the project root path, and the code workspace. All Projects+ has to do is detect the project path, and open the code workspace if it's provided. That's already the basic behavior and you can fix it by doing almost nothing because you already wrote the code to do it.

If Microsoft adds a new API for workspace in 2020, then update the extension.

As of now, this extension remains broken indefinitely. Because we use workspaces.

Yzrsah avatar Feb 14 '19 04:02 Yzrsah

@Yzrsah I don't think that's a solution, first of all it complicates things, buts most importantly a workspace will usually contain multiple root paths, and we have to know about all of them to make this work.

As I mentioned we could just read each .code-workspace file manually and extract this information, but it would be better if there was a proper API for this https://github.com/Microsoft/vscode/issues/37421

fabiospampinato avatar Feb 14 '19 13:02 fabiospampinato

It looks like the necessary API has been merged: https://github.com/microsoft/vscode/pull/72490 .

wpbrown avatar Aug 07 '19 15:08 wpbrown

Hi! Any news on this issue? It seems that the missing API was added quite a long time ago.

maksim77 avatar Oct 30 '21 19:10 maksim77

I would love to get this functionality working and could help implementing it. I just need a hint about where to start :)

deiga avatar Aug 17 '23 07:08 deiga