Skip to content

Commit cc0dec5

Browse files
Merge pull request #38 from bjrmatos/fix/37-improve-multiroot-support
fix error when active text editor does not belong to any of the workspace folders of a multiroot workspace
2 parents 7492e39 + d44ffc2 commit cc0dec5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

extension/util.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ const getWorkspace = (context) => {
7575
const relative = path.relative(wsFolder.uri.fsPath, vscode.window.activeTextEditor.document.uri.path)
7676
return relative && !relative.startsWith('..') && !path.isAbsolute(relative)
7777
})
78+
79+
// The file that is active does not belong to any of the workspace folders, so let's use the first workspace
80+
if (!root) {
81+
root = vscode.workspace.workspaceFolders[0]
82+
}
83+
7884
workspace = root && root.uri ? root.uri.fsPath : null
7985
} else {
8086
// No file was open, so just grab the first available workspace

0 commit comments

Comments
 (0)