Skip to content

Commit

Permalink
feat: Add limited support for virtual workspaces (#930)
Browse files Browse the repository at this point in the history
* Add limited support for virtual workspaces. Override ${workspaceFolder} variable substitution.

* Do not show run/debug menu icon when on virtual FS. Change deprecated ${workspaceRoot} default.

* Prepare replace for currently un-mapped configuration variables.

* CHANGELOG
  • Loading branch information
zobo committed Nov 7, 2023
1 parent 89b7d55 commit 3025d1f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.34.0]

- Partial support for virtual workspaces

## [1.33.1]

- Fix editor title run/debug button.
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
"restrictedConfigurations": [
"php.debug.executablePath"
]
},
"virtualWorkspaces": {
"supported": "limited",
"description": "In virtual workspaces, PHP process cannot be started, but can listen for incoming connections."
}
},
"contributes": {
Expand Down Expand Up @@ -211,7 +215,7 @@
"cwd": {
"type": "string",
"description": "Absolute path to the working directory of the program being debugged. Default is the current workspace.",
"default": "${workspaceRoot}"
"default": "${workspaceFolder}"
},
"runtimeExecutable": {
"type": "string",
Expand Down Expand Up @@ -527,23 +531,23 @@
"editor/title/run": [
{
"command": "extension.php-debug.runEditorContents",
"when": "resourceLangId == php && !inDiffEditor",
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file",
"group": "navigation@1"
},
{
"command": "extension.php-debug.debugEditorContents",
"when": "resourceLangId == php && !inDiffEditor",
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file",
"group": "navigation@2"
}
],
"commandPalette": [
{
"command": "extension.php-debug.debugEditorContents",
"when": "resourceLangId == php && !inDiffEditor"
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file"
},
{
"command": "extension.php-debug.runEditorContents",
"when": "resourceLangId == php && !inDiffEditor"
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file"
}
]
},
Expand Down
23 changes: 23 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,29 @@ export function activate(context: vscode.ExtensionContext) {
}
}
}
if (folder && folder.uri.scheme !== 'file') {
// replace
if (debugConfiguration.pathMappings) {
for (const key in debugConfiguration.pathMappings) {
debugConfiguration.pathMappings[key] = debugConfiguration.pathMappings[key].replace(
'${workspaceFolder}',
folder.uri.toString()
)
}
}
// The following path are currently NOT mapped
/*
debugConfiguration.skipEntryPaths = debugConfiguration.skipEntryPaths?.map(v =>
v.replace('${workspaceFolder}', folder.uri.toString())
)
debugConfiguration.skipFiles = debugConfiguration.skipFiles?.map(v =>
v.replace('${workspaceFolder}', folder.uri.toString())
)
debugConfiguration.ignore = debugConfiguration.ignore?.map(v =>
v.replace('${workspaceFolder}', folder.uri.toString())
)
*/
}
return debugConfiguration
},
})
Expand Down

0 comments on commit 3025d1f

Please sign in to comment.