This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 646
Update #workspaceRoot variables reference #1977
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
381a500
${workspaceRoot} -> ${workspaceFolder}
torn4dom4n 2f23d92
${workspaceRoot} -> ${workspaceFolder}
torn4dom4n d5b7426
Update variables reference
torn4dom4n 676cf6b
${workspaceRoot} -> ${workspaceFolder}
torn4dom4n c92911b
${workspaceRoot} -> ${workspaceFolder}
torn4dom4n 8affa8d
Support both workspaceRoot and workspaceFolder
ramya-rao-a File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -350,16 +350,16 @@ function resolveToolsGopath(): string { | |
|
||
let toolsGopathForWorkspace = vscode.workspace.getConfiguration('go')['toolsGopath'] || ''; | ||
|
||
// In case of single root, use resolvePath to resolve ~ and ${workspaceRoot} | ||
// In case of single root | ||
if (!vscode.workspace.workspaceFolders || vscode.workspace.workspaceFolders.length <= 1) { | ||
return resolvePath(toolsGopathForWorkspace); | ||
} | ||
|
||
// In case of multi-root, resolve ~ and ignore ${workspaceRoot} | ||
// In case of multi-root, resolve ~ and ${workspaceFolder} | ||
if (toolsGopathForWorkspace.startsWith('~')) { | ||
toolsGopathForWorkspace = path.join(os.homedir(), toolsGopathForWorkspace.substr(1)); | ||
} | ||
if (toolsGopathForWorkspace && toolsGopathForWorkspace.trim() && !/\${workspaceRoot}/.test(toolsGopathForWorkspace)) { | ||
if (toolsGopathForWorkspace && toolsGopathForWorkspace.trim() && !/\${workspaceFolder}/.test(toolsGopathForWorkspace)) { | ||
return toolsGopathForWorkspace; | ||
} | ||
|
||
|
@@ -502,21 +502,21 @@ export function timeout(millis): Promise<void> { | |
} | ||
|
||
/** | ||
* Exapnds ~ to homedir in non-Windows platform and resolves ${workspaceRoot} | ||
* Exapnds ~ to homedir in non-Windows platform and resolves ${workspaceFolder} | ||
*/ | ||
export function resolvePath(inputPath: string, workspaceRoot?: string): string { | ||
export function resolvePath(inputPath: string, workspaceFolder?: string): string { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
if (!inputPath || !inputPath.trim()) return inputPath; | ||
|
||
if (!workspaceRoot && vscode.workspace.workspaceFolders) { | ||
if (!workspaceFolder && vscode.workspace.workspaceFolders) { | ||
if (vscode.workspace.workspaceFolders.length === 1) { | ||
workspaceRoot = vscode.workspace.rootPath; | ||
workspaceFolder = vscode.workspace.rootPath; | ||
} else if (vscode.window.activeTextEditor && vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri)) { | ||
workspaceRoot = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri.fsPath; | ||
workspaceFolder = vscode.workspace.getWorkspaceFolder(vscode.window.activeTextEditor.document.uri).uri.fsPath; | ||
} | ||
} | ||
|
||
if (workspaceRoot) { | ||
inputPath = inputPath.replace(/\${workspaceRoot}/g, workspaceRoot).replace(/\${workspaceFolder}/g, workspaceRoot); | ||
if (workspaceFolder) { | ||
inputPath = inputPath.replace(/\${workspaceFolder}/g, workspaceFolder); | ||
} | ||
return resolveHomeDir(inputPath); | ||
} | ||
|
@@ -890,4 +890,3 @@ export function cleanupTempDir() { | |
} | ||
tmpDir = undefined; | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should support both
$workspaceRoot
and$workspaceFolder
here. Not everyone would have updated their settings.