Skip to content

Commit 3025d1f

Browse files
authored
feat: Add limited support for virtual workspaces (#930)
* 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
1 parent 89b7d55 commit 3025d1f

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

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

7+
## [1.34.0]
8+
9+
- Partial support for virtual workspaces
10+
711
## [1.33.1]
812

913
- Fix editor title run/debug button.

package.json

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@
165165
"restrictedConfigurations": [
166166
"php.debug.executablePath"
167167
]
168+
},
169+
"virtualWorkspaces": {
170+
"supported": "limited",
171+
"description": "In virtual workspaces, PHP process cannot be started, but can listen for incoming connections."
168172
}
169173
},
170174
"contributes": {
@@ -211,7 +215,7 @@
211215
"cwd": {
212216
"type": "string",
213217
"description": "Absolute path to the working directory of the program being debugged. Default is the current workspace.",
214-
"default": "${workspaceRoot}"
218+
"default": "${workspaceFolder}"
215219
},
216220
"runtimeExecutable": {
217221
"type": "string",
@@ -527,23 +531,23 @@
527531
"editor/title/run": [
528532
{
529533
"command": "extension.php-debug.runEditorContents",
530-
"when": "resourceLangId == php && !inDiffEditor",
534+
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file",
531535
"group": "navigation@1"
532536
},
533537
{
534538
"command": "extension.php-debug.debugEditorContents",
535-
"when": "resourceLangId == php && !inDiffEditor",
539+
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file",
536540
"group": "navigation@2"
537541
}
538542
],
539543
"commandPalette": [
540544
{
541545
"command": "extension.php-debug.debugEditorContents",
542-
"when": "resourceLangId == php && !inDiffEditor"
546+
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file"
543547
},
544548
{
545549
"command": "extension.php-debug.runEditorContents",
546-
"when": "resourceLangId == php && !inDiffEditor"
550+
"when": "resourceLangId == php && !inDiffEditor && resourceScheme == file"
547551
}
548552
]
549553
},

src/extension.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,29 @@ export function activate(context: vscode.ExtensionContext) {
7171
}
7272
}
7373
}
74+
if (folder && folder.uri.scheme !== 'file') {
75+
// replace
76+
if (debugConfiguration.pathMappings) {
77+
for (const key in debugConfiguration.pathMappings) {
78+
debugConfiguration.pathMappings[key] = debugConfiguration.pathMappings[key].replace(
79+
'${workspaceFolder}',
80+
folder.uri.toString()
81+
)
82+
}
83+
}
84+
// The following path are currently NOT mapped
85+
/*
86+
debugConfiguration.skipEntryPaths = debugConfiguration.skipEntryPaths?.map(v =>
87+
v.replace('${workspaceFolder}', folder.uri.toString())
88+
)
89+
debugConfiguration.skipFiles = debugConfiguration.skipFiles?.map(v =>
90+
v.replace('${workspaceFolder}', folder.uri.toString())
91+
)
92+
debugConfiguration.ignore = debugConfiguration.ignore?.map(v =>
93+
v.replace('${workspaceFolder}', folder.uri.toString())
94+
)
95+
*/
96+
}
7497
return debugConfiguration
7598
},
7699
})

0 commit comments

Comments
 (0)