diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 058d27c3c4ea85406441fe5b02192292a533a1d6..0c43684266bd74fa288db58774da004b3bbb5e0f 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -39,7 +39,6 @@ import { ExtensionActivationError } from 'vs/workbench/services/extensions/commo import { IRPCProtocol, createExtHostContextProxyIdentifier as createExtId, createMainContextProxyIdentifier as createMainId } from 'vs/workbench/services/extensions/common/proxyIdentifier'; import { IProgressOptions, IProgressStep } from 'vs/platform/progress/common/progress'; import { SaveReason } from 'vs/workbench/services/textfile/common/textfiles'; -import * as vscode from 'vscode'; import { IMarkdownString } from 'vs/base/common/htmlContent'; import { ResolvedAuthority } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; @@ -302,11 +301,13 @@ export interface ISerializedLanguageConfiguration { }; } +export type GlobPattern = string | { base: string; pattern: string }; + export interface ISerializedDocumentFilter { $serialized: true; language?: string; scheme?: string; - pattern?: vscode.GlobPattern; + pattern?: GlobPattern; exclusive?: boolean; } @@ -464,11 +465,20 @@ export interface TransferInputBox extends BaseTransferQuickInput { validationMessage?: string; } +export interface IInputBoxOptions { + value?: string; + valueSelection?: [number, number]; + prompt?: string; + placeHolder?: string; + password?: boolean; + ignoreFocusOut?: boolean; +} + export interface MainThreadQuickOpenShape extends IDisposable { $show(instance: number, options: quickInput.IPickOptions, token: CancellationToken): Promise; $setItems(instance: number, items: TransferQuickPickItems[]): Promise; $setError(instance: number, error: Error): Promise; - $input(options: vscode.InputBoxOptions | undefined, validateInput: boolean, token: CancellationToken): Promise; + $input(options: IInputBoxOptions | undefined, validateInput: boolean, token: CancellationToken): Promise; $createOrUpdate(params: TransferQuickInput): Promise; $dispose(id: number): Promise; } @@ -496,16 +506,27 @@ export interface WebviewPanelShowOptions { readonly preserveFocus?: boolean; } +export interface IWebviewPanelOptions { + readonly enableFindWidget?: boolean; + readonly retainContextWhenHidden?: boolean; +} + +export interface IWebviewOptions { + readonly enableScripts?: boolean; + readonly enableCommandUris?: boolean; + readonly localResourceRoots?: ReadonlyArray; +} + export interface MainThreadWebviewsShape extends IDisposable { - $createWebviewPanel(handle: WebviewPanelHandle, viewType: string, title: string, showOptions: WebviewPanelShowOptions, options: vscode.WebviewPanelOptions & vscode.WebviewOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): void; - $createWebviewCodeInset(handle: WebviewInsetHandle, symbolId: string, options: vscode.WebviewOptions, extensionLocation: UriComponents | undefined): void; + $createWebviewPanel(handle: WebviewPanelHandle, viewType: string, title: string, showOptions: WebviewPanelShowOptions, options: IWebviewPanelOptions & IWebviewOptions, extensionId: ExtensionIdentifier, extensionLocation: UriComponents): void; + $createWebviewCodeInset(handle: WebviewInsetHandle, symbolId: string, options: IWebviewOptions, extensionLocation: UriComponents | undefined): void; $disposeWebview(handle: WebviewPanelHandle): void; $reveal(handle: WebviewPanelHandle, showOptions: WebviewPanelShowOptions): void; $setTitle(handle: WebviewPanelHandle, value: string): void; $setIconPath(handle: WebviewPanelHandle, value: { light: UriComponents, dark: UriComponents } | undefined): void; $setHtml(handle: WebviewPanelHandle | WebviewInsetHandle, value: string): void; - $setOptions(handle: WebviewPanelHandle | WebviewInsetHandle, options: vscode.WebviewOptions): void; + $setOptions(handle: WebviewPanelHandle | WebviewInsetHandle, options: IWebviewOptions): void; $postMessage(handle: WebviewPanelHandle | WebviewInsetHandle, value: any): Promise; $registerSerializer(viewType: string): void; @@ -522,7 +543,7 @@ export interface ExtHostWebviewsShape { $onMessage(handle: WebviewPanelHandle, message: any): void; $onDidChangeWebviewPanelViewState(handle: WebviewPanelHandle, newState: WebviewPanelViewState): void; $onDidDisposeWebviewPanel(handle: WebviewPanelHandle): Promise; - $deserializeWebviewPanel(newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, state: any, position: EditorViewColumn, options: vscode.WebviewOptions): Promise; + $deserializeWebviewPanel(newWebviewHandle: WebviewPanelHandle, viewType: string, title: string, state: any, position: EditorViewColumn, options: IWebviewOptions): Promise; } export interface MainThreadUrlsShape extends IDisposable { @@ -534,9 +555,13 @@ export interface ExtHostUrlsShape { $handleExternalUri(handle: number, uri: UriComponents): Promise; } +export interface ITextSearchComplete { + limitHit?: boolean; +} + export interface MainThreadWorkspaceShape extends IDisposable { $startFileSearch(includePattern: string | undefined, includeFolder: UriComponents | undefined, excludePatternOrDisregardExcludes: string | false | undefined, maxResults: number | undefined, token: CancellationToken): Promise; - $startTextSearch(query: search.IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise; + $startTextSearch(query: search.IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise; $checkExists(includes: string[], token: CancellationToken): Promise; $saveAll(includeUntitled?: boolean): Promise; $updateWorkspaceFolders(extensionName: string, index: number, deleteCount: number, workspaceFoldersToAdd: { uri: UriComponents, name?: string }[]): Promise; @@ -640,6 +665,13 @@ export interface MainThreadSCMShape extends IDisposable { export type DebugSessionUUID = string; +export interface IDebugConfiguration { + type: string; + name: string; + request: string; + [key: string]: any; +} + export interface MainThreadDebugServiceShape extends IDisposable { $registerDebugTypes(debugTypes: string[]): void; $sessionCached(sessionID: string): void; @@ -652,7 +684,7 @@ export interface MainThreadDebugServiceShape extends IDisposable { $unregisterDebugConfigurationProvider(handle: number): void; $unregisterDebugAdapterDescriptorFactory(handle: number): void; $unregisterDebugAdapterTrackerFactory(handle: number): void; - $startDebugging(folder: UriComponents | undefined, nameOrConfig: string | vscode.DebugConfiguration, parentSessionID: string | undefined): Promise; + $startDebugging(folder: UriComponents | undefined, nameOrConfig: string | IDebugConfiguration, parentSessionID: string | undefined): Promise; $customDebugAdapterRequest(id: DebugSessionUUID, command: string, args: any): Promise; $appendDebugConsole(value: string): void; $startBreakpointEvents(): void; diff --git a/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts b/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts index fb84a095c95e1e2a372a9135d3907088ae50060e..26bd529c39b3ca952f6d54c982dc64d9104bcb96 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadQuickOpen.ts @@ -4,8 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { IPickOptions, IInputOptions, IQuickInputService, IQuickInput } from 'vs/platform/quickinput/common/quickInput'; -import { InputBoxOptions } from 'vscode'; -import { ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, TransferQuickPickItems, MainContext, IExtHostContext, TransferQuickInput, TransferQuickInputButton } from 'vs/workbench/api/common/extHost.protocol'; +import { ExtHostContext, MainThreadQuickOpenShape, ExtHostQuickOpenShape, TransferQuickPickItems, MainContext, IExtHostContext, TransferQuickInput, TransferQuickInputButton, IInputBoxOptions } from 'vs/workbench/api/common/extHost.protocol'; import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers'; import { URI } from 'vs/base/common/uri'; import { CancellationToken } from 'vs/base/common/cancellation'; @@ -85,7 +84,7 @@ export class MainThreadQuickOpen implements MainThreadQuickOpenShape { // ---- input - $input(options: InputBoxOptions | undefined, validateInput: boolean, token: CancellationToken): Promise { + $input(options: IInputBoxOptions | undefined, validateInput: boolean, token: CancellationToken): Promise { const inputOptions: IInputOptions = Object.create(null); if (options) { diff --git a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts index bfa2a71a20c7c6811d959ea7b9d4e191583ec6aa..bd3c26a3ad98ab1cfce62819a172747e7c3dbfea 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWebview.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWebview.ts @@ -13,7 +13,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewInsetHandle, WebviewPanelHandle, WebviewPanelShowOptions } from 'vs/workbench/api/common/extHost.protocol'; +import { ExtHostContext, ExtHostWebviewsShape, IExtHostContext, MainContext, MainThreadWebviewsShape, WebviewInsetHandle, WebviewPanelHandle, WebviewPanelShowOptions, IWebviewOptions } from 'vs/workbench/api/common/extHost.protocol'; import { editorGroupToViewColumn, EditorViewColumn, viewColumnToEditorGroup } from 'vs/workbench/api/common/shared/editor'; import { CodeInsetController } from 'vs/workbench/contrib/codeinset/electron-browser/codeInset.contribution'; import { WebviewEditor } from 'vs/workbench/contrib/webview/electron-browser/webviewEditor'; @@ -24,7 +24,6 @@ import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editor import { ACTIVE_GROUP, IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService'; -import * as vscode from 'vscode'; import { extHostNamedCustomer } from '../common/extHostCustomers'; @extHostNamedCustomer(MainContext.MainThreadWebviews) @@ -111,7 +110,7 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews this._telemetryService.publicLog('webviews:createWebviewPanel', { extensionId: extensionId.value }); } - $createWebviewCodeInset(handle: WebviewInsetHandle, symbolId: string, options: vscode.WebviewOptions, extensionLocation: UriComponents): void { + $createWebviewCodeInset(handle: WebviewInsetHandle, symbolId: string, options: IWebviewOptions, extensionLocation: UriComponents): void { // todo@joh main is for the lack of a code-inset service // which we maybe wanna have... this is how it now works // 1) create webview element @@ -173,12 +172,12 @@ export class MainThreadWebviews extends Disposable implements MainThreadWebviews } } - public $setOptions(handle: WebviewPanelHandle | WebviewInsetHandle, options: vscode.WebviewOptions): void { + public $setOptions(handle: WebviewPanelHandle | WebviewInsetHandle, options: IWebviewOptions): void { if (typeof handle === 'number') { - this.getWebviewElement(handle).options = reviveWebviewOptions(options); + this.getWebviewElement(handle).options = reviveWebviewOptions(options as any /*todo@mat */); } else { const webview = this.getWebview(handle); - webview.setOptions(reviveWebviewOptions(options)); + webview.setOptions(reviveWebviewOptions(options as any /*todo@mat */)); } } diff --git a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts index 9ac82ab2d7ac925faf18906eea264b677c0f1365..385ade35ce48cbe77fe1899fedcb33b2fb7d681b 100644 --- a/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts +++ b/src/vs/workbench/api/electron-browser/mainThreadWorkspace.ts @@ -21,8 +21,7 @@ import { ITextQueryBuilderOptions, QueryBuilder } from 'vs/workbench/contrib/sea import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions'; import { ITextFileService } from 'vs/workbench/services/textfile/common/textfiles'; import { IWorkspaceEditingService } from 'vs/workbench/services/workspace/common/workspaceEditing'; -import { ExtHostContext, ExtHostWorkspaceShape, IExtHostContext, MainContext, MainThreadWorkspaceShape, IWorkspaceData } from '../common/extHost.protocol'; -import { TextSearchComplete } from 'vscode'; +import { ExtHostContext, ExtHostWorkspaceShape, IExtHostContext, MainContext, MainThreadWorkspaceShape, IWorkspaceData, ITextSearchComplete } from '../common/extHost.protocol'; @extHostNamedCustomer(MainContext.MainThreadWorkspace) export class MainThreadWorkspace implements MainThreadWorkspaceShape { @@ -148,7 +147,7 @@ export class MainThreadWorkspace implements MainThreadWorkspaceShape { }); } - $startTextSearch(pattern: IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise { + $startTextSearch(pattern: IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise { const workspace = this._contextService.getWorkspace(); const folders = workspace.folders.map(folder => folder.uri); diff --git a/tslint.json b/tslint.json index c5388e2d4aaea35bb79d652d8169e8bf0b2bc5cc..3a7841fe5cce048db6a2482e76f7c808371f0e53 100644 --- a/tslint.json +++ b/tslint.json @@ -376,7 +376,7 @@ ] }, { - "target": "**/vs/workbench/api/common/extHost.protocol.ts", + "target": "**/vs/workbench/api/common/**", "restrictions": [ "**/vs/base/common/**", "**/vs/platform/*/common/**", @@ -385,8 +385,7 @@ "**/vs/workbench/api/common/**", "**/vs/workbench/common/**", "**/vs/workbench/services/*/common/**", - "**/vs/workbench/contrib/*/common/**", - "vscode" + "**/vs/workbench/contrib/*/common/**" ] }, {