Skip to content

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
@sumneko sumneko merged commit 32b5981 into LuaLS:master Feb 6, 2025
11 checks passed
@tomlau10 tomlau10 deleted the feat/workspaceFolder_var_sub branch February 6, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants