-
Notifications
You must be signed in to change notification settings - Fork 770
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exports a function for use by other extensions. When I'm creating a Go-related VSCode extension, being able to reuse this extension's configuration and certain helper functions would be very useful. Additionally, users expect Go-related extensions to respect `go.*` configuration options, and have reported issues when they don't. This change exports `getBinPath`. With this function, Go-related extensions don't have to reinvent the wheel when it comes to installing and configuring Go tools. Updates #233 Change-Id: I9edf7f87437492182e8562aa107b643ca01a1202 GitHub-Last-Rev: 0171541 GitHub-Pull-Request: #1642 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/336509 Reviewed-by: Hyang-Ah Hana Kim <[email protected]> Trust: Hyang-Ah Hana Kim <[email protected]> Trust: Suzy Mueller <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]>
- Loading branch information
1 parent
8a4731f
commit 4e7f6f5
Showing
4 changed files
with
54 additions
and
3 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright 2021 The Go Authors. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for license information. | ||
*--------------------------------------------------------*/ | ||
|
||
import { Uri } from 'vscode'; | ||
export { ToolAtVersion } from './goTools'; | ||
|
||
export interface CommandInvocation { | ||
binPath: string; | ||
args?: string[]; | ||
env?: Object; | ||
cwd?: string; | ||
} | ||
|
||
export interface ExtensionAPI { | ||
settings: { | ||
/** | ||
* Returns the execution command corresponding to the specified resource, taking into account | ||
* any workspace-specific settings for the workspace to which this resource belongs. | ||
*/ | ||
getExecutionCommand(toolName: string, resource?: Uri): CommandInvocation | undefined; | ||
}; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/*--------------------------------------------------------- | ||
* Copyright 2021 The Go Authors. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE in the project root for license information. | ||
*--------------------------------------------------------*/ | ||
|
||
import { Uri } from 'vscode'; | ||
import { CommandInvocation, ExtensionAPI } from './export'; | ||
import { getBinPathWithExplanation } from './util'; | ||
|
||
const api: ExtensionAPI = { | ||
settings: { | ||
getExecutionCommand(toolName: string, resource?: Uri): CommandInvocation | undefined { | ||
const { binPath } = getBinPathWithExplanation(toolName, true, resource); | ||
return { binPath }; | ||
} | ||
} | ||
}; | ||
|
||
export default api; |
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