Skip to content

Commit 3a91503

Browse files
firelizzard18h9jiang
authored andcommitted
src/extensionAPI: expose isPreview
Expose isPreview - whether the extension is running in preview mode (e.g. a prerelease version) - in the extension API. Also, fix a typo. Updates #3651. Change-Id: I991d3118d2f7786facb43d8252bf3e4fb294118d Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/653115 Reviewed-by: Hongxiang Jiang <[email protected]> kokoro-CI: kokoro <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Madeline Kalil <[email protected]>
1 parent 8115161 commit 3a91503

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

extension/src/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class ExtensionInfo {
3737
readonly appName: string;
3838
/** True if the extension runs in preview mode (e.g. Nightly, prerelease) */
3939
readonly isPreview: boolean;
40-
/** True if the extension runs in well-kwnon cloud IDEs */
40+
/** True if the extension runs in well-known cloud IDEs */
4141
readonly isInCloudIDE: boolean;
4242

4343
constructor() {

extension/src/export.d.ts

+13
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ export interface CommandInvocation {
1010
binPath: string;
1111
}
1212

13+
/**
14+
* The API we expose to other extensions.
15+
*
16+
* @example
17+
* const Go = await vscode.extensions
18+
* .getExtension<ExtensionAPI>('golang.go')
19+
* .then(x => x.activate());
20+
*
21+
* console.log(`Go extension is a ${Go.isPreview ? 'preview' : 'release'} version`);
22+
*/
1323
export interface ExtensionAPI {
24+
/** True if the extension is running in preview mode (e.g. prerelease) */
25+
isPreview: boolean;
26+
1427
settings: {
1528
/**
1629
* Returns the execution command corresponding to the specified resource, taking into account

extension/src/extensionAPI.ts

+3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@
66
import { Uri } from 'vscode';
77
import { CommandInvocation, ExtensionAPI } from './export';
88
import { getBinPathWithExplanation } from './util';
9+
import { extensionInfo } from './config';
910

1011
const api: ExtensionAPI = {
12+
isPreview: extensionInfo.isPreview,
13+
1114
settings: {
1215
getExecutionCommand(toolName: string, resource?: Uri): CommandInvocation | undefined {
1316
const { binPath } = getBinPathWithExplanation(toolName, true, resource);

0 commit comments

Comments
 (0)