Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add variable substitution support for vscode's ${workspaceFolder:x} #3053

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tomlau10
Copy link
Contributor

@tomlau10 tomlau10 commented Jan 25, 2025

resolves #2987


implementation details: #2987 (comment)

  • workspace folder names are captured from client's initialization request param workspaceFolders[].name
  • if provided, it is then stored into the created workspace.scope object
  • finally when resolving a ${workspaceFolder:x} path placeholder
    use the decoded uri of the workspace.scope object that having x as the folder name
    (which becomes absolute path of that folder)

Example

  • a dummy _.code-workspace
{
	"folders": [
		{
			"name": "root",
			"path": "."
		},
		{
			"name": "client",
			"path": "client"
		},
		{
			"name": "server",
			"path": "server"
		}
	],
	"settings": {
		"Lua.workspace.library": [
			"${workspaceFolder:client}",
		]
	}
}
  • upon inspecting log file, the client is sending the following to server during init
  workspaceFolders = { {
      name = "root",
      uri = "file:///c%3A/Users/TomLau/test"
    }, {
      name = "client",
      uri = "file:///c%3A/Users/TomLau/test/client"
    }, {
      name = "server",
      uri = "file:///c%3A/Users/TomLau/test/server"
    } }
  • therefore ${workspaceFolder:client} will be resolved as furi.decode('file:///c%3A/Users/TomLau/test/client')
    which becomes C:\Users\TomLau\test\client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[VS Code] Cannot use scoped workspace folder variables in multiroot workspaces to define paths
1 participant