forked from microsoft/vscode-python
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add package name to output (microsoft#12683)
- Loading branch information
Showing
5 changed files
with
111 additions
and
9 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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import * as vscode from 'vscode'; | ||
import * as localize from '../common/utils/localize'; | ||
import { IJupyterServerUri, IJupyterUriProvider, JupyterServerUriHandle } from './types'; | ||
|
||
/** | ||
* This class wraps an IJupyterUriProvider provided by another extension. It allows us to show | ||
* extra data on the other extension's UI. | ||
*/ | ||
export class JupyterUriProviderWrapper implements IJupyterUriProvider { | ||
constructor(private readonly provider: IJupyterUriProvider, private packageName: string) {} | ||
public get id() { | ||
return this.provider.id; | ||
} | ||
public getQuickPickEntryItems(): vscode.QuickPickItem[] { | ||
return this.provider.getQuickPickEntryItems().map((q) => { | ||
return { | ||
...q, | ||
// Add the package name onto the description | ||
description: localize.DataScience.uriProviderDescriptionFormat().format( | ||
q.description || '', | ||
this.packageName | ||
), | ||
original: q | ||
}; | ||
}); | ||
} | ||
public handleQuickPick( | ||
item: vscode.QuickPickItem, | ||
back: boolean | ||
): Promise<JupyterServerUriHandle | 'back' | undefined> { | ||
// tslint:disable-next-line: no-any | ||
if ((item as any).original) { | ||
// tslint:disable-next-line: no-any | ||
return this.provider.handleQuickPick((item as any).original, back); | ||
} | ||
return this.provider.handleQuickPick(item, back); | ||
} | ||
|
||
public getServerUri(handle: JupyterServerUriHandle): Promise<IJupyterServerUri> { | ||
return this.provider.getServerUri(handle); | ||
} | ||
} |
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