mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Merge branch 'master' into sandy081/remoteMRWorkspace
This commit is contained in:
@@ -12,7 +12,7 @@ import * as typeConverters from 'vs/workbench/api/node/extHostTypeConverters';
|
||||
import { CommandsRegistry, ICommandService, ICommandHandler } from 'vs/platform/commands/common/commands';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { EditorViewColumn } from 'vs/workbench/api/shared/editor';
|
||||
import { EditorGroupLayout } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IWindowsService } from 'vs/platform/windows/common/windows';
|
||||
@@ -62,7 +62,7 @@ export class OpenFolderAPICommand {
|
||||
uri = correctedUri;
|
||||
}
|
||||
|
||||
return executor.executeCommand('_files.windowOpen', { folderURIs: [uri], forceNewWindow });
|
||||
return executor.executeCommand('_files.windowOpen', { urisToOpen: [{ uri }], forceNewWindow });
|
||||
}
|
||||
}
|
||||
CommandsRegistry.registerCommand(OpenFolderAPICommand.ID, adjustHandler(OpenFolderAPICommand.execute));
|
||||
|
||||
@@ -219,7 +219,7 @@ export function createApiFactory(
|
||||
});
|
||||
},
|
||||
registerDiffInformationCommand: proposedApiFunction(extension, (id: string, callback: (diff: vscode.LineChange[], ...args: any[]) => any, thisArg?: any): vscode.Disposable => {
|
||||
return extHostCommands.registerCommand(true, id, async (...args: any[]) => {
|
||||
return extHostCommands.registerCommand(true, id, async (...args: any[]): Promise<any> => {
|
||||
let activeTextEditor = extHostEditors.getActiveTextEditor();
|
||||
if (!activeTextEditor) {
|
||||
console.warn('Cannot execute ' + id + ' because there is no active text editor.');
|
||||
@@ -242,9 +242,9 @@ export function createApiFactory(
|
||||
const env: typeof vscode.env = Object.freeze({
|
||||
get machineId() { return initData.telemetryInfo.machineId; },
|
||||
get sessionId() { return initData.telemetryInfo.sessionId; },
|
||||
get language() { return platform.language; },
|
||||
get language() { return platform.language!; },
|
||||
get appName() { return product.nameLong; },
|
||||
get appRoot() { return initData.environment.appRoot.fsPath; },
|
||||
get appRoot() { return initData.environment.appRoot!.fsPath; },
|
||||
get logLevel() {
|
||||
checkProposedApiEnabled(extension);
|
||||
return typeConverters.LogLevel.to(extHostLogService.getLevel());
|
||||
@@ -263,8 +263,8 @@ export function createApiFactory(
|
||||
|
||||
// namespace: extensions
|
||||
const extensions: typeof vscode.extensions = {
|
||||
getExtension(extensionId: string): Extension<any> {
|
||||
let desc = extensionRegistry.getExtensionDescription(extensionId);
|
||||
getExtension(extensionId: string): Extension<any> | undefined {
|
||||
const desc = extensionRegistry.getExtensionDescription(extensionId);
|
||||
if (desc) {
|
||||
return new Extension(extensionService, desc);
|
||||
}
|
||||
@@ -443,7 +443,7 @@ export function createApiFactory(
|
||||
return extHostMessageService.showMessage(extension, Severity.Error, message, first, rest);
|
||||
},
|
||||
showQuickPick(items: any, options: vscode.QuickPickOptions, token?: vscode.CancellationToken): any {
|
||||
return extHostQuickOpen.showQuickPick(items, extension.enableProposedApi, options, token);
|
||||
return extHostQuickOpen.showQuickPick(items, !!extension.enableProposedApi, options, token);
|
||||
},
|
||||
showWorkspaceFolderPick(options: vscode.WorkspaceFolderPickOptions) {
|
||||
return extHostQuickOpen.showWorkspaceFolderPick(options);
|
||||
@@ -851,7 +851,7 @@ class Extension<T> implements vscode.Extension<T> {
|
||||
|
||||
public id: string;
|
||||
public extensionPath: string;
|
||||
public packageJSON: any;
|
||||
public packageJSON: IExtensionDescription;
|
||||
|
||||
constructor(extensionService: ExtHostExtensionService, description: IExtensionDescription) {
|
||||
this._extensionService = extensionService;
|
||||
@@ -866,6 +866,9 @@ class Extension<T> implements vscode.Extension<T> {
|
||||
}
|
||||
|
||||
get exports(): T {
|
||||
if (this.packageJSON.api === 'none') {
|
||||
return undefined;
|
||||
}
|
||||
return <T>this._extensionService.getExtensionExports(this._identifier);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ import { ResourceLabelFormatter } from 'vs/platform/label/common/label';
|
||||
import { LogLevel } from 'vs/platform/log/common/log';
|
||||
import { IMarkerData } from 'vs/platform/markers/common/markers';
|
||||
import { IPickOptions, IQuickInputButton, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { IPatternInfo, IRawFileMatch2, IRawQuery, IRawTextQuery, ISearchCompleteStats } from 'vs/platform/search/common/search';
|
||||
import { IPatternInfo, IRawFileMatch2, IRawQuery, IRawTextQuery, ISearchCompleteStats } from 'vs/workbench/services/search/common/search';
|
||||
import { StatusbarAlignment as MainThreadStatusBarAlignment } from 'vs/platform/statusbar/common/statusbar';
|
||||
import { ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ThemeColor } from 'vs/platform/theme/common/themeService';
|
||||
@@ -48,10 +48,10 @@ import { IRemoteConsoleLog } from 'vs/base/node/console';
|
||||
|
||||
export interface IEnvironment {
|
||||
isExtensionDevelopmentDebug: boolean;
|
||||
appRoot: URI;
|
||||
appSettingsHome: URI;
|
||||
extensionDevelopmentLocationURI: URI;
|
||||
extensionTestsPath: string;
|
||||
appRoot?: URI;
|
||||
appSettingsHome?: URI;
|
||||
extensionDevelopmentLocationURI?: URI;
|
||||
extensionTestsPath?: string;
|
||||
globalStorageHome: URI;
|
||||
}
|
||||
|
||||
@@ -66,11 +66,12 @@ export interface IWorkspaceData extends IStaticWorkspaceData {
|
||||
}
|
||||
|
||||
export interface IInitData {
|
||||
commit: string;
|
||||
commit?: string;
|
||||
parentPid: number;
|
||||
environment: IEnvironment;
|
||||
workspace: IStaticWorkspaceData;
|
||||
workspace?: IStaticWorkspaceData;
|
||||
resolvedExtensions: ExtensionIdentifier[];
|
||||
hostExtensions: ExtensionIdentifier[];
|
||||
extensions: IExtensionDescription[];
|
||||
telemetryInfo: ITelemetryInfo;
|
||||
logLevel: LogLevel;
|
||||
@@ -150,14 +151,14 @@ export interface MainThreadDialogSaveOptions {
|
||||
}
|
||||
|
||||
export interface MainThreadDiaglogsShape extends IDisposable {
|
||||
$showOpenDialog(options: MainThreadDialogOpenOptions): Promise<UriComponents[]>;
|
||||
$showSaveDialog(options: MainThreadDialogSaveOptions): Promise<UriComponents>;
|
||||
$showOpenDialog(options: MainThreadDialogOpenOptions): Promise<UriComponents[] | undefined>;
|
||||
$showSaveDialog(options: MainThreadDialogSaveOptions): Promise<UriComponents | undefined>;
|
||||
}
|
||||
|
||||
export interface MainThreadDecorationsShape extends IDisposable {
|
||||
$registerDecorationProvider(handle: number, label: string): void;
|
||||
$unregisterDecorationProvider(handle: number): void;
|
||||
$onDidChange(handle: number, resources: UriComponents[]): void;
|
||||
$onDidChange(handle: number, resources: UriComponents[] | null): void;
|
||||
}
|
||||
|
||||
export interface MainThreadDocumentContentProvidersShape extends IDisposable {
|
||||
@@ -332,17 +333,17 @@ export interface MainThreadMessageOptions {
|
||||
}
|
||||
|
||||
export interface MainThreadMessageServiceShape extends IDisposable {
|
||||
$showMessage(severity: Severity, message: string, options: MainThreadMessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Promise<number>;
|
||||
$showMessage(severity: Severity, message: string, options: MainThreadMessageOptions, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Promise<number | undefined>;
|
||||
}
|
||||
|
||||
export interface MainThreadOutputServiceShape extends IDisposable {
|
||||
$register(label: string, log: boolean, file?: UriComponents): Promise<string>;
|
||||
$append(channelId: string, value: string): Promise<void>;
|
||||
$update(channelId: string): Promise<void>;
|
||||
$clear(channelId: string, till: number): Promise<void>;
|
||||
$reveal(channelId: string, preserveFocus: boolean): Promise<void>;
|
||||
$close(channelId: string): Promise<void>;
|
||||
$dispose(channelId: string): Promise<void>;
|
||||
$append(channelId: string, value: string): Promise<void> | undefined;
|
||||
$update(channelId: string): Promise<void> | undefined;
|
||||
$clear(channelId: string, till: number): Promise<void> | undefined;
|
||||
$reveal(channelId: string, preserveFocus: boolean): Promise<void> | undefined;
|
||||
$close(channelId: string): Promise<void> | undefined;
|
||||
$dispose(channelId: string): Promise<void> | undefined;
|
||||
}
|
||||
|
||||
export interface MainThreadProgressShape extends IDisposable {
|
||||
@@ -442,7 +443,7 @@ export interface TransferInputBox extends BaseTransferQuickInput {
|
||||
}
|
||||
|
||||
export interface MainThreadQuickOpenShape extends IDisposable {
|
||||
$show(instance: number, options: IPickOptions<TransferQuickPickItems>, token: CancellationToken): Promise<number | number[]>;
|
||||
$show(instance: number, options: IPickOptions<TransferQuickPickItems>, token: CancellationToken): Promise<number | number[] | undefined>;
|
||||
$setItems(instance: number, items: TransferQuickPickItems[]): Promise<void>;
|
||||
$setError(instance: number, error: Error): Promise<void>;
|
||||
$input(options: vscode.InputBoxOptions, validateInput: boolean, token: CancellationToken): Promise<string>;
|
||||
@@ -508,7 +509,7 @@ export interface ExtHostUrlsShape {
|
||||
}
|
||||
|
||||
export interface MainThreadWorkspaceShape extends IDisposable {
|
||||
$startFileSearch(includePattern: string, includeFolder: URI, excludePatternOrDisregardExcludes: string | false, maxResults: number, token: CancellationToken): Promise<UriComponents[]> | undefined;
|
||||
$startFileSearch(includePattern: string | undefined, includeFolder: URI, excludePatternOrDisregardExcludes: string | false, maxResults: number, token: CancellationToken): Promise<UriComponents[]> | undefined;
|
||||
$startTextSearch(query: IPatternInfo, options: ITextQueryBuilderOptions, requestId: number, token: CancellationToken): Promise<vscode.TextSearchComplete>;
|
||||
$checkExists(includes: string[], token: CancellationToken): Promise<boolean>;
|
||||
$saveAll(includeUntitled?: boolean): Promise<boolean>;
|
||||
@@ -549,6 +550,7 @@ export interface MainThreadTaskShape extends IDisposable {
|
||||
|
||||
export interface MainThreadExtensionServiceShape extends IDisposable {
|
||||
$localShowMessage(severity: Severity, msg: string): void;
|
||||
$activateExtension(extensionId: ExtensionIdentifier, activationEvent: string): Promise<void>;
|
||||
$onWillActivateExtension(extensionId: ExtensionIdentifier): void;
|
||||
$onDidActivateExtension(extensionId: ExtensionIdentifier, startup: boolean, codeLoadingTime: number, activateCallTime: number, activateResolvedTime: number, activationEvent: string): void;
|
||||
$onExtensionActivationFailed(extensionId: ExtensionIdentifier): void;
|
||||
@@ -753,7 +755,7 @@ export interface ExtHostExtensionServiceShape {
|
||||
$resolveAuthority(remoteAuthority: string): Promise<ResolvedAuthority>;
|
||||
$startExtensionHost(enabledExtensionIds: ExtensionIdentifier[]): Promise<void>;
|
||||
$activateByEvent(activationEvent: string): Promise<void>;
|
||||
$activate(extensionId: ExtensionIdentifier, activationEvent: string): Promise<void>;
|
||||
$activate(extensionId: ExtensionIdentifier, activationEvent: string): Promise<boolean>;
|
||||
|
||||
$deltaExtensions(toAdd: IExtensionDescription[], toRemove: ExtensionIdentifier[]): Promise<void>;
|
||||
|
||||
@@ -774,7 +776,7 @@ export interface ExtHostFileSystemEventServiceShape {
|
||||
}
|
||||
|
||||
export interface ObjectIdentifier {
|
||||
$ident: number;
|
||||
$ident?: number;
|
||||
}
|
||||
|
||||
export namespace ObjectIdentifier {
|
||||
@@ -871,19 +873,29 @@ export function reviveWorkspaceEditDto(data: WorkspaceEditDto): modes.WorkspaceE
|
||||
return <modes.WorkspaceEdit>data;
|
||||
}
|
||||
|
||||
export type CommandDto = ObjectIdentifier & modes.Command;
|
||||
|
||||
export interface CodeActionDto {
|
||||
title: string;
|
||||
edit?: WorkspaceEditDto;
|
||||
diagnostics?: IMarkerData[];
|
||||
command?: modes.Command;
|
||||
command?: CommandDto;
|
||||
kind?: string;
|
||||
isPreferred?: boolean;
|
||||
}
|
||||
|
||||
export type LinkDto = ObjectIdentifier & modes.ILink;
|
||||
|
||||
export interface CodeLensDto extends ObjectIdentifier {
|
||||
range: IRange;
|
||||
id?: string;
|
||||
command?: CommandDto;
|
||||
}
|
||||
|
||||
export interface ExtHostLanguageFeaturesShape {
|
||||
$provideDocumentSymbols(handle: number, resource: UriComponents, token: CancellationToken): Promise<modes.DocumentSymbol[]>;
|
||||
$provideCodeLenses(handle: number, resource: UriComponents, token: CancellationToken): Promise<modes.ICodeLensSymbol[]>;
|
||||
$resolveCodeLens(handle: number, resource: UriComponents, symbol: modes.ICodeLensSymbol, token: CancellationToken): Promise<modes.ICodeLensSymbol>;
|
||||
$provideCodeLenses(handle: number, resource: UriComponents, token: CancellationToken): Promise<CodeLensDto[]>;
|
||||
$resolveCodeLens(handle: number, resource: UriComponents, symbol: CodeLensDto, token: CancellationToken): Promise<CodeLensDto>;
|
||||
$provideDefinition(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<DefinitionLinkDto[]>;
|
||||
$provideDeclaration(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<DefinitionLinkDto[]>;
|
||||
$provideImplementation(handle: number, resource: UriComponents, position: IPosition, token: CancellationToken): Promise<DefinitionLinkDto[]>;
|
||||
@@ -904,8 +916,8 @@ export interface ExtHostLanguageFeaturesShape {
|
||||
$resolveCompletionItem(handle: number, resource: UriComponents, position: IPosition, suggestion: modes.CompletionItem, token: CancellationToken): Promise<modes.CompletionItem>;
|
||||
$releaseCompletionItems(handle: number, id: number): void;
|
||||
$provideSignatureHelp(handle: number, resource: UriComponents, position: IPosition, context: modes.SignatureHelpContext, token: CancellationToken): Promise<modes.SignatureHelp>;
|
||||
$provideDocumentLinks(handle: number, resource: UriComponents, token: CancellationToken): Promise<modes.ILink[]>;
|
||||
$resolveDocumentLink(handle: number, link: modes.ILink, token: CancellationToken): Promise<modes.ILink>;
|
||||
$provideDocumentLinks(handle: number, resource: UriComponents, token: CancellationToken): Promise<LinkDto[]>;
|
||||
$resolveDocumentLink(handle: number, link: LinkDto, token: CancellationToken): Promise<LinkDto>;
|
||||
$provideDocumentColors(handle: number, resource: UriComponents, token: CancellationToken): Promise<IRawColorInfo[]>;
|
||||
$provideColorPresentations(handle: number, resource: UriComponents, colorInfo: IRawColorInfo, token: CancellationToken): Promise<modes.IColorPresentation[]>;
|
||||
$provideFoldingRanges(handle: number, resource: UriComponents, context: modes.FoldingContext, token: CancellationToken): Promise<modes.FoldingRange[]>;
|
||||
@@ -1028,7 +1040,7 @@ export interface ExtHostDebugServiceShape {
|
||||
$provideDebugAdapter(handle: number, session: IDebugSessionDto): Promise<IAdapterDescriptor>;
|
||||
$acceptDebugSessionStarted(session: IDebugSessionDto): void;
|
||||
$acceptDebugSessionTerminated(session: IDebugSessionDto): void;
|
||||
$acceptDebugSessionActiveChanged(session: IDebugSessionDto): void;
|
||||
$acceptDebugSessionActiveChanged(session: IDebugSessionDto | undefined): void;
|
||||
$acceptDebugSessionCustomEvent(session: IDebugSessionDto, event: any): void;
|
||||
$acceptBreakpointsDelta(delta: IBreakpointsDeltaDto): void;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands
|
||||
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
|
||||
import { CustomCodeAction } from 'vs/workbench/api/node/extHostLanguageFeatures';
|
||||
import { ICommandsExecutor, PreviewHTMLAPICommand, OpenFolderAPICommand, DiffAPICommand, OpenAPICommand, RemoveFromRecentlyOpenedAPICommand, SetEditorLayoutAPICommand } from './apiCommands';
|
||||
import { EditorGroupLayout } from 'vs/workbench/services/group/common/editorGroupsService';
|
||||
import { EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { isFalsyOrEmpty, isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
|
||||
export class ExtHostApiCommands {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ICommandHandlerDescription } from 'vs/platform/commands/common/commands
|
||||
import * as extHostTypes from 'vs/workbench/api/node/extHostTypes';
|
||||
import * as extHostTypeConverter from 'vs/workbench/api/node/extHostTypeConverters';
|
||||
import { cloneAndChange } from 'vs/base/common/objects';
|
||||
import { MainContext, MainThreadCommandsShape, ExtHostCommandsShape, ObjectIdentifier, IMainContext } from './extHost.protocol';
|
||||
import { MainContext, MainThreadCommandsShape, ExtHostCommandsShape, ObjectIdentifier, IMainContext, CommandDto } from './extHost.protocol';
|
||||
import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
|
||||
import { isNonEmptyArray } from 'vs/base/common/arrays';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
@@ -207,15 +207,16 @@ export class CommandsConverter {
|
||||
this._commands.registerCommand(true, this._delegatingCommandId, this._executeConvertedCommand, this);
|
||||
}
|
||||
|
||||
toInternal(command: vscode.Command): modes.Command {
|
||||
toInternal(command: vscode.Command): CommandDto {
|
||||
|
||||
if (!command) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const result: modes.Command = {
|
||||
const result: CommandDto = {
|
||||
$ident: undefined,
|
||||
id: command.command,
|
||||
title: command.title
|
||||
title: command.title,
|
||||
};
|
||||
|
||||
if (command.command && isNonEmptyArray(command.arguments)) {
|
||||
@@ -223,7 +224,7 @@ export class CommandsConverter {
|
||||
// means we don't want to send the arguments around
|
||||
|
||||
const id = this._heap.keep(command);
|
||||
ObjectIdentifier.mixin(result, id);
|
||||
result.$ident = id;
|
||||
|
||||
result.id = this._delegatingCommandId;
|
||||
result.arguments = [id];
|
||||
|
||||
@@ -24,7 +24,7 @@ import { getTerminalLauncher, hasChildProcesses, prepareCommand } from 'vs/workb
|
||||
import { IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { AbstractVariableResolverService } from 'vs/workbench/services/configurationResolver/node/variableResolver';
|
||||
import { ExtHostConfiguration, ExtHostConfigProvider } from './extHostConfiguration';
|
||||
import { convertToVSCPaths, convertToDAPaths } from 'vs/workbench/contrib/debug/common/debugUtils';
|
||||
import { convertToVSCPaths, convertToDAPaths, isDebuggerMainContribution } from 'vs/workbench/contrib/debug/common/debugUtils';
|
||||
import { ExtHostTerminalService } from 'vs/workbench/api/node/extHostTerminalService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver';
|
||||
@@ -128,8 +128,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
const debuggers = <IDebuggerContribution[]>ed.contributes['debuggers'];
|
||||
if (debuggers && debuggers.length > 0) {
|
||||
for (const dbg of debuggers) {
|
||||
// only debugger contributions with a label, program, or runtime attribute are considered a "defining" debugger contribution
|
||||
if (dbg.type && (dbg.label || dbg.program || dbg.runtime)) {
|
||||
if (isDebuggerMainContribution(dbg)) {
|
||||
debugTypes.push(dbg.type);
|
||||
if (dbg.adapterExecutableCommand) {
|
||||
this._aexCommands.set(dbg.type, dbg.adapterExecutableCommand);
|
||||
@@ -607,7 +606,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
|
||||
}
|
||||
}
|
||||
|
||||
public async $acceptDebugSessionActiveChanged(sessionDto: IDebugSessionDto): Promise<void> {
|
||||
public async $acceptDebugSessionActiveChanged(sessionDto: IDebugSessionDto | undefined): Promise<void> {
|
||||
const workspaceProvider = await this._workspaceService.getWorkspaceProvider();
|
||||
this._activeDebugSession = sessionDto ? this.getSession(sessionDto, workspaceProvider) : undefined;
|
||||
this._onDidChangeActiveDebugSession.fire(this._activeDebugSession);
|
||||
|
||||
@@ -46,16 +46,20 @@ export class ExtHostDecorations implements ExtHostDecorationsShape {
|
||||
const result: DecorationReply = Object.create(null);
|
||||
return Promise.all(requests.map(request => {
|
||||
const { handle, uri, id } = request;
|
||||
if (!this._provider.has(handle)) {
|
||||
const entry = this._provider.get(handle);
|
||||
if (!entry) {
|
||||
// might have been unregistered in the meantime
|
||||
return undefined;
|
||||
}
|
||||
const { provider, extensionId } = this._provider.get(handle);
|
||||
const { provider, extensionId } = entry;
|
||||
return Promise.resolve(provider.provideDecoration(URI.revive(uri), token)).then(data => {
|
||||
if (data && data.letter && data.letter.length !== 1) {
|
||||
console.warn(`INVALID decoration from extension '${extensionId.value}'. The 'letter' must be set and be one character, not '${data.letter}'.`);
|
||||
}
|
||||
result[id] = data && <DecorationData>[data.priority, data.bubble, data.title, data.letter, data.color, data.source];
|
||||
if (data) {
|
||||
result[id] = <DecorationData>[data.priority, data.bubble, data.title, data.letter, data.color, data.source];
|
||||
|
||||
}
|
||||
}, err => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
@@ -60,7 +60,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
|
||||
// the actual implementation for #set
|
||||
|
||||
this._checkDisposed();
|
||||
let toSync: vscode.Uri[];
|
||||
let toSync: vscode.Uri[] = [];
|
||||
let hasChanged = true;
|
||||
|
||||
if (first instanceof URI) {
|
||||
@@ -81,7 +81,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
|
||||
} else if (Array.isArray(first)) {
|
||||
// update many rows
|
||||
toSync = [];
|
||||
let lastUri: vscode.Uri;
|
||||
let lastUri: vscode.Uri | undefined;
|
||||
|
||||
// ensure stable-sort
|
||||
mergeSort(first, DiagnosticCollection._compareIndexedTuplesByUri);
|
||||
@@ -255,7 +255,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
|
||||
this._proxy = mainContext.getProxy(MainContext.MainThreadDiagnostics);
|
||||
}
|
||||
|
||||
createDiagnosticCollection(name: string): vscode.DiagnosticCollection {
|
||||
createDiagnosticCollection(name?: string): vscode.DiagnosticCollection {
|
||||
let { _collections, _proxy, _onDidChangeDiagnostics } = this;
|
||||
let owner: string;
|
||||
if (!name) {
|
||||
@@ -272,7 +272,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
|
||||
|
||||
const result = new class extends DiagnosticCollection {
|
||||
constructor() {
|
||||
super(name, owner, ExtHostDiagnostics._maxDiagnosticsPerFile, _proxy, _onDidChangeDiagnostics);
|
||||
super(name!, owner, ExtHostDiagnostics._maxDiagnosticsPerFile, _proxy, _onDidChangeDiagnostics);
|
||||
_collections.set(owner, this);
|
||||
}
|
||||
dispose() {
|
||||
@@ -286,6 +286,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
|
||||
|
||||
getDiagnostics(resource: vscode.Uri): vscode.Diagnostic[];
|
||||
getDiagnostics(): [vscode.Uri, vscode.Diagnostic[]][];
|
||||
getDiagnostics(resource?: vscode.Uri): vscode.Diagnostic[] | [vscode.Uri, vscode.Diagnostic[]][];
|
||||
getDiagnostics(resource?: vscode.Uri): vscode.Diagnostic[] | [vscode.Uri, vscode.Diagnostic[]][] {
|
||||
if (resource) {
|
||||
return this._getDiagnostics(resource);
|
||||
|
||||
@@ -15,15 +15,15 @@ export class ExtHostDialogs {
|
||||
this._proxy = mainContext.getProxy(MainContext.MainThreadDialogs);
|
||||
}
|
||||
|
||||
showOpenDialog(options: vscode.OpenDialogOptions): Promise<URI[]> {
|
||||
showOpenDialog(options: vscode.OpenDialogOptions): Promise<URI[] | undefined> {
|
||||
return this._proxy.$showOpenDialog(options).then(filepaths => {
|
||||
return filepaths && filepaths.map(URI.revive);
|
||||
return filepaths ? filepaths.map(URI.revive) : undefined;
|
||||
});
|
||||
}
|
||||
|
||||
showSaveDialog(options: vscode.SaveDialogOptions): Promise<URI> {
|
||||
showSaveDialog(options: vscode.SaveDialogOptions): Promise<URI | undefined> {
|
||||
return this._proxy.$showSaveDialog(options).then(filepath => {
|
||||
return filepath && URI.revive(filepath);
|
||||
return filepath ? URI.revive(filepath) : undefined;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ const _modeId2WordDefinition = new Map<string, RegExp>();
|
||||
export function setWordDefinitionFor(modeId: string, wordDefinition: RegExp): void {
|
||||
_modeId2WordDefinition.set(modeId, wordDefinition);
|
||||
}
|
||||
export function getWordDefinitionFor(modeId: string): RegExp {
|
||||
export function getWordDefinitionFor(modeId: string): RegExp | undefined {
|
||||
return _modeId2WordDefinition.get(modeId);
|
||||
}
|
||||
|
||||
@@ -131,14 +131,14 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
||||
|
||||
private _lineAt(lineOrPosition: number | vscode.Position): vscode.TextLine {
|
||||
|
||||
let line: number;
|
||||
let line: number | undefined;
|
||||
if (lineOrPosition instanceof Position) {
|
||||
line = lineOrPosition.line;
|
||||
} else if (typeof lineOrPosition === 'number') {
|
||||
line = lineOrPosition;
|
||||
}
|
||||
|
||||
if (line < 0 || line >= this._lines.length) {
|
||||
if (typeof line !== 'number' || line < 0 || line >= this._lines.length) {
|
||||
throw new Error('Illegal value for `line`');
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
||||
if (!result || result.lineNumber !== line || result.text !== this._lines[line]) {
|
||||
|
||||
const text = this._lines[line];
|
||||
const firstNonWhitespaceCharacterIndex = /^(\s*)/.exec(text)[1].length;
|
||||
const firstNonWhitespaceCharacterIndex = /^(\s*)/.exec(text)![1].length;
|
||||
const range = new Range(line, 0, line, text.length);
|
||||
const rangeIncludingLineBreak = line < this._lines.length - 1
|
||||
? new Range(line, 0, line + 1, 0)
|
||||
@@ -170,7 +170,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
||||
private _offsetAt(position: vscode.Position): number {
|
||||
position = this._validatePosition(position);
|
||||
this._ensureLineStarts();
|
||||
return this._lineStarts.getAccumulatedValue(position.line - 1) + position.character;
|
||||
return this._lineStarts!.getAccumulatedValue(position.line - 1) + position.character;
|
||||
}
|
||||
|
||||
private _positionAt(offset: number): vscode.Position {
|
||||
@@ -178,7 +178,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
||||
offset = Math.max(0, offset);
|
||||
|
||||
this._ensureLineStarts();
|
||||
let out = this._lineStarts.getIndexOf(offset);
|
||||
let out = this._lineStarts!.getIndexOf(offset);
|
||||
|
||||
let lineLength = this._lines[out.index].length;
|
||||
|
||||
@@ -238,7 +238,7 @@ export class ExtHostDocumentData extends MirrorTextModel {
|
||||
return new Position(line, character);
|
||||
}
|
||||
|
||||
private _getWordRangeAtPosition(_position: vscode.Position, regexp?: RegExp): vscode.Range {
|
||||
private _getWordRangeAtPosition(_position: vscode.Position, regexp?: RegExp): vscode.Range | undefined {
|
||||
let position = this._validatePosition(_position);
|
||||
|
||||
if (!regexp) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import * as nls from 'vs/nls';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { IExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionDescriptionRegistry } from 'vs/workbench/services/extensions/node/extensionDescriptionRegistry';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
|
||||
@@ -161,6 +160,12 @@ export class EmptyExtension extends ActivatedExtension {
|
||||
}
|
||||
}
|
||||
|
||||
export class HostExtension extends ActivatedExtension {
|
||||
constructor() {
|
||||
super(false, null, ExtensionActivationTimes.NONE, { activate: undefined, deactivate: undefined }, undefined, []);
|
||||
}
|
||||
}
|
||||
|
||||
export class FailedExtension extends ActivatedExtension {
|
||||
constructor(activationError: Error) {
|
||||
super(true, activationError, ExtensionActivationTimes.NONE, { activate: undefined, deactivate: undefined }, undefined, []);
|
||||
@@ -170,7 +175,7 @@ export class FailedExtension extends ActivatedExtension {
|
||||
export interface IExtensionsActivatorHost {
|
||||
showMessage(severity: Severity, message: string): void;
|
||||
|
||||
actualActivateExtension(extensionDescription: IExtensionDescription, reason: ExtensionActivationReason): Promise<ActivatedExtension>;
|
||||
actualActivateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<ActivatedExtension>;
|
||||
}
|
||||
|
||||
export class ExtensionActivatedByEvent {
|
||||
@@ -192,6 +197,7 @@ export class ExtensionsActivator {
|
||||
|
||||
private readonly _registry: ExtensionDescriptionRegistry;
|
||||
private readonly _resolvedExtensionsSet: Set<string>;
|
||||
private readonly _hostExtensionsMap: Map<string, ExtensionIdentifier>;
|
||||
private readonly _host: IExtensionsActivatorHost;
|
||||
private readonly _activatingExtensions: Map<string, Promise<void>>;
|
||||
private readonly _activatedExtensions: Map<string, ActivatedExtension>;
|
||||
@@ -200,10 +206,12 @@ export class ExtensionsActivator {
|
||||
*/
|
||||
private readonly _alreadyActivatedEvents: { [activationEvent: string]: boolean; };
|
||||
|
||||
constructor(registry: ExtensionDescriptionRegistry, resolvedExtensions: ExtensionIdentifier[], host: IExtensionsActivatorHost) {
|
||||
constructor(registry: ExtensionDescriptionRegistry, resolvedExtensions: ExtensionIdentifier[], hostExtensions: ExtensionIdentifier[], host: IExtensionsActivatorHost) {
|
||||
this._registry = registry;
|
||||
this._resolvedExtensionsSet = new Set<string>();
|
||||
resolvedExtensions.forEach((extensionId) => this._resolvedExtensionsSet.add(ExtensionIdentifier.toKey(extensionId)));
|
||||
this._hostExtensionsMap = new Map<string, ExtensionIdentifier>();
|
||||
hostExtensions.forEach((extensionId) => this._hostExtensionsMap.set(ExtensionIdentifier.toKey(extensionId), extensionId));
|
||||
this._host = host;
|
||||
this._activatingExtensions = new Map<string, Promise<void>>();
|
||||
this._activatedExtensions = new Map<string, ActivatedExtension>();
|
||||
@@ -231,7 +239,7 @@ export class ExtensionsActivator {
|
||||
return NO_OP_VOID_PROMISE;
|
||||
}
|
||||
let activateExtensions = this._registry.getExtensionDescriptionsForActivationEvent(activationEvent);
|
||||
return this._activateExtensions(activateExtensions, reason, 0).then(() => {
|
||||
return this._activateExtensions(activateExtensions.map(e => e.identifier), reason).then(() => {
|
||||
this._alreadyActivatedEvents[activationEvent] = true;
|
||||
});
|
||||
}
|
||||
@@ -242,14 +250,20 @@ export class ExtensionsActivator {
|
||||
throw new Error('Extension `' + extensionId + '` is not known');
|
||||
}
|
||||
|
||||
return this._activateExtensions([desc], reason, 0);
|
||||
return this._activateExtensions([desc.identifier], reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle semantics related to dependencies for `currentExtension`.
|
||||
* semantics: `redExtensions` must wait for `greenExtensions`.
|
||||
*/
|
||||
private _handleActivateRequest(currentExtension: IExtensionDescription, greenExtensions: { [id: string]: IExtensionDescription; }, redExtensions: IExtensionDescription[]): void {
|
||||
private _handleActivateRequest(currentExtensionId: ExtensionIdentifier, greenExtensions: { [id: string]: ExtensionIdentifier; }, redExtensions: ExtensionIdentifier[]): void {
|
||||
if (this._hostExtensionsMap.has(ExtensionIdentifier.toKey(currentExtensionId))) {
|
||||
greenExtensions[ExtensionIdentifier.toKey(currentExtensionId)] = currentExtensionId;
|
||||
return;
|
||||
}
|
||||
|
||||
const currentExtension = this._registry.getExtensionDescription(currentExtensionId)!;
|
||||
let depIds = (typeof currentExtension.extensionDependencies === 'undefined' ? [] : currentExtension.extensionDependencies);
|
||||
let currentExtensionGetsGreenLight = true;
|
||||
|
||||
@@ -261,72 +275,71 @@ export class ExtensionsActivator {
|
||||
continue;
|
||||
}
|
||||
|
||||
const depDesc = this._registry.getExtensionDescription(depId);
|
||||
const dep = this._activatedExtensions.get(ExtensionIdentifier.toKey(depId));
|
||||
if (dep && !dep.activationFailed) {
|
||||
// the dependency is already activated OK
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!depDesc) {
|
||||
// Error condition 1: unknown dependency
|
||||
this._host.showMessage(Severity.Error, nls.localize('unknownDep', "Cannot activate extension '{0}' because it depends on extension '{1}', which is not installed or disabled. Please install or enable '{1}' and reload the window.", currentExtension.displayName || currentExtension.identifier.value, depId));
|
||||
const error = new Error(`Unknown dependency '${depId}'`);
|
||||
if (dep && dep.activationFailed) {
|
||||
// Error condition 2: a dependency has already failed activation
|
||||
this._host.showMessage(Severity.Error, nls.localize('failedDep1', "Cannot activate extension '{0}' because it depends on extension '{1}', which failed to activate.", currentExtension.displayName || currentExtension.identifier.value, depId));
|
||||
const error = new Error(`Dependency ${depId} failed to activate`);
|
||||
(<any>error).detail = dep.activationFailedError;
|
||||
this._activatedExtensions.set(ExtensionIdentifier.toKey(currentExtension.identifier), new FailedExtension(error));
|
||||
return;
|
||||
}
|
||||
|
||||
const dep = this._activatedExtensions.get(ExtensionIdentifier.toKey(depId));
|
||||
if (dep) {
|
||||
if (dep.activationFailed) {
|
||||
// Error condition 2: a dependency has already failed activation
|
||||
this._host.showMessage(Severity.Error, nls.localize('failedDep1', "Cannot activate extension '{0}' because it depends on extension '{1}', which failed to activate.", currentExtension.displayName || currentExtension.identifier.value, depId));
|
||||
const error = new Error(`Dependency ${depId} failed to activate`);
|
||||
(<any>error).detail = dep.activationFailedError;
|
||||
this._activatedExtensions.set(ExtensionIdentifier.toKey(currentExtension.identifier), new FailedExtension(error));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (this._hostExtensionsMap.has(ExtensionIdentifier.toKey(depId))) {
|
||||
// must first wait for the dependency to activate
|
||||
currentExtensionGetsGreenLight = false;
|
||||
greenExtensions[ExtensionIdentifier.toKey(depId)] = depDesc;
|
||||
greenExtensions[ExtensionIdentifier.toKey(depId)] = this._hostExtensionsMap.get(ExtensionIdentifier.toKey(depId))!;
|
||||
continue;
|
||||
}
|
||||
|
||||
const depDesc = this._registry.getExtensionDescription(depId);
|
||||
if (depDesc) {
|
||||
// must first wait for the dependency to activate
|
||||
currentExtensionGetsGreenLight = false;
|
||||
greenExtensions[ExtensionIdentifier.toKey(depId)] = depDesc.identifier;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Error condition 1: unknown dependency
|
||||
this._host.showMessage(Severity.Error, nls.localize('unknownDep', "Cannot activate extension '{0}' because it depends on extension '{1}', which is not installed or disabled. Please install or enable '{1}' and reload the window.", currentExtension.displayName || currentExtension.identifier.value, depId));
|
||||
const error = new Error(`Unknown dependency '${depId}'`);
|
||||
this._activatedExtensions.set(ExtensionIdentifier.toKey(currentExtension.identifier), new FailedExtension(error));
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentExtensionGetsGreenLight) {
|
||||
greenExtensions[ExtensionIdentifier.toKey(currentExtension.identifier)] = currentExtension;
|
||||
greenExtensions[ExtensionIdentifier.toKey(currentExtension.identifier)] = currentExtensionId;
|
||||
} else {
|
||||
redExtensions.push(currentExtension);
|
||||
redExtensions.push(currentExtensionId);
|
||||
}
|
||||
}
|
||||
|
||||
private _activateExtensions(extensionDescriptions: IExtensionDescription[], reason: ExtensionActivationReason, recursionLevel: number): Promise<void> {
|
||||
// console.log(recursionLevel, '_activateExtensions: ', extensionDescriptions.map(p => p.id));
|
||||
if (extensionDescriptions.length === 0) {
|
||||
private _activateExtensions(extensionIds: ExtensionIdentifier[], reason: ExtensionActivationReason): Promise<void> {
|
||||
// console.log('_activateExtensions: ', extensionIds.map(p => p.value));
|
||||
if (extensionIds.length === 0) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
extensionDescriptions = extensionDescriptions.filter((p) => !this._activatedExtensions.has(ExtensionIdentifier.toKey(p.identifier)));
|
||||
if (extensionDescriptions.length === 0) {
|
||||
extensionIds = extensionIds.filter((p) => !this._activatedExtensions.has(ExtensionIdentifier.toKey(p)));
|
||||
if (extensionIds.length === 0) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
if (recursionLevel > 10) {
|
||||
// More than 10 dependencies deep => most likely a dependency loop
|
||||
for (let i = 0, len = extensionDescriptions.length; i < len; i++) {
|
||||
// Error condition 3: dependency loop
|
||||
this._host.showMessage(Severity.Error, nls.localize('failedDep2', "Extension '{0}' failed to activate. Reason: more than 10 levels of dependencies (most likely a dependency loop).", extensionDescriptions[i].identifier.value));
|
||||
const error = new Error('More than 10 levels of dependencies (most likely a dependency loop)');
|
||||
this._activatedExtensions.set(ExtensionIdentifier.toKey(extensionDescriptions[i].identifier), new FailedExtension(error));
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
let greenMap: { [id: string]: ExtensionIdentifier; } = Object.create(null),
|
||||
red: ExtensionIdentifier[] = [];
|
||||
|
||||
let greenMap: { [id: string]: IExtensionDescription; } = Object.create(null),
|
||||
red: IExtensionDescription[] = [];
|
||||
|
||||
for (let i = 0, len = extensionDescriptions.length; i < len; i++) {
|
||||
this._handleActivateRequest(extensionDescriptions[i], greenMap, red);
|
||||
for (let i = 0, len = extensionIds.length; i < len; i++) {
|
||||
this._handleActivateRequest(extensionIds[i], greenMap, red);
|
||||
}
|
||||
|
||||
// Make sure no red is also green
|
||||
for (let i = 0, len = red.length; i < len; i++) {
|
||||
const redExtensionKey = ExtensionIdentifier.toKey(red[i].identifier);
|
||||
const redExtensionKey = ExtensionIdentifier.toKey(red[i]);
|
||||
if (greenMap[redExtensionKey]) {
|
||||
delete greenMap[redExtensionKey];
|
||||
}
|
||||
@@ -342,13 +355,13 @@ export class ExtensionsActivator {
|
||||
return Promise.all(green.map((p) => this._activateExtension(p, reason))).then(_ => undefined);
|
||||
}
|
||||
|
||||
return this._activateExtensions(green, reason, recursionLevel + 1).then(_ => {
|
||||
return this._activateExtensions(red, reason, recursionLevel + 1);
|
||||
return this._activateExtensions(green, reason).then(_ => {
|
||||
return this._activateExtensions(red, reason);
|
||||
});
|
||||
}
|
||||
|
||||
private _activateExtension(extensionDescription: IExtensionDescription, reason: ExtensionActivationReason): Promise<void> {
|
||||
const extensionKey = ExtensionIdentifier.toKey(extensionDescription.identifier);
|
||||
private _activateExtension(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<void> {
|
||||
const extensionKey = ExtensionIdentifier.toKey(extensionId);
|
||||
|
||||
if (this._activatedExtensions.has(extensionKey)) {
|
||||
return Promise.resolve(undefined);
|
||||
@@ -359,9 +372,9 @@ export class ExtensionsActivator {
|
||||
return currentlyActivatingExtension;
|
||||
}
|
||||
|
||||
const newlyActivatingExtension = this._host.actualActivateExtension(extensionDescription, reason).then(undefined, (err) => {
|
||||
this._host.showMessage(Severity.Error, nls.localize('activationError', "Activating extension '{0}' failed: {1}.", extensionDescription.identifier.value, err.message));
|
||||
console.error('Activating extension `' + extensionDescription.identifier.value + '` failed: ', err.message);
|
||||
const newlyActivatingExtension = this._host.actualActivateExtension(extensionId, reason).then(undefined, (err) => {
|
||||
this._host.showMessage(Severity.Error, nls.localize('activationError', "Activating extension '{0}' failed: {1}.", extensionId.value, err.message));
|
||||
console.error('Activating extension `' + extensionId.value + '` failed: ', err.message);
|
||||
console.log('Here is the error stack: ', err.stack);
|
||||
// Treat the extension as being empty
|
||||
return new FailedExtension(err);
|
||||
|
||||
@@ -15,7 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { createApiFactory, initializeExtensionApi, IExtensionApiFactory } from 'vs/workbench/api/node/extHost.api.impl';
|
||||
import { ExtHostExtensionServiceShape, IEnvironment, IInitData, IMainContext, MainContext, MainThreadExtensionServiceShape, MainThreadTelemetryShape, MainThreadWorkspaceShape, IStaticWorkspaceData } from 'vs/workbench/api/node/extHost.protocol';
|
||||
import { ExtHostConfiguration } from 'vs/workbench/api/node/extHostConfiguration';
|
||||
import { ActivatedExtension, EmptyExtension, ExtensionActivatedByAPI, ExtensionActivatedByEvent, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionContext, IExtensionMemento, IExtensionModule } from 'vs/workbench/api/node/extHostExtensionActivator';
|
||||
import { ActivatedExtension, EmptyExtension, ExtensionActivatedByAPI, ExtensionActivatedByEvent, ExtensionActivationReason, ExtensionActivationTimes, ExtensionActivationTimesBuilder, ExtensionsActivator, IExtensionAPI, IExtensionContext, IExtensionMemento, IExtensionModule, HostExtension } from 'vs/workbench/api/node/extHostExtensionActivator';
|
||||
import { ExtHostLogService } from 'vs/workbench/api/node/extHostLogService';
|
||||
import { ExtHostStorage } from 'vs/workbench/api/node/extHostStorage';
|
||||
import { ExtHostWorkspace, ExtHostWorkspaceProvider } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
@@ -193,7 +193,11 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
this._registry = new ExtensionDescriptionRegistry(initData.extensions);
|
||||
this._storage = new ExtHostStorage(this._extHostContext);
|
||||
this._storagePath = new ExtensionStoragePath(initData.workspace, initData.environment);
|
||||
this._activator = new ExtensionsActivator(this._registry, initData.resolvedExtensions, {
|
||||
|
||||
const hostExtensions = new Set<string>();
|
||||
initData.hostExtensions.forEach((extensionId) => hostExtensions.add(ExtensionIdentifier.toKey(extensionId)));
|
||||
|
||||
this._activator = new ExtensionsActivator(this._registry, initData.resolvedExtensions, initData.hostExtensions, {
|
||||
showMessage: (severity: Severity, message: string): void => {
|
||||
this._mainThreadExtensionsProxy.$localShowMessage(severity, message);
|
||||
|
||||
@@ -209,7 +213,13 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
}
|
||||
},
|
||||
|
||||
actualActivateExtension: (extensionDescription: IExtensionDescription, reason: ExtensionActivationReason): Promise<ActivatedExtension> => {
|
||||
actualActivateExtension: async (extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<ActivatedExtension> => {
|
||||
if (hostExtensions.has(ExtensionIdentifier.toKey(extensionId))) {
|
||||
let activationEvent = (reason instanceof ExtensionActivatedByEvent ? reason.activationEvent : null);
|
||||
await this._mainThreadExtensionsProxy.$activateExtension(extensionId, activationEvent);
|
||||
return new HostExtension();
|
||||
}
|
||||
const extensionDescription = this._registry.getExtensionDescription(extensionId);
|
||||
return this._activateExtension(extensionDescription, reason);
|
||||
}
|
||||
});
|
||||
@@ -669,11 +679,14 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
);
|
||||
}
|
||||
|
||||
public $activate(extensionId: ExtensionIdentifier, activationEvent: string): Promise<void> {
|
||||
return (
|
||||
this._barrier.wait()
|
||||
.then(_ => this._activateById(extensionId, new ExtensionActivatedByEvent(false, activationEvent)))
|
||||
);
|
||||
public async $activate(extensionId: ExtensionIdentifier, activationEvent: string): Promise<boolean> {
|
||||
await this._barrier.wait();
|
||||
if (!this._registry.getExtensionDescription(extensionId)) {
|
||||
// unknown extension => ignore
|
||||
return false;
|
||||
}
|
||||
await this._activateById(extensionId, new ExtensionActivatedByEvent(false, activationEvent));
|
||||
return true;
|
||||
}
|
||||
|
||||
public async $deltaExtensions(toAdd: IExtensionDescription[], toRemove: ExtensionIdentifier[]): Promise<void> {
|
||||
|
||||
@@ -15,7 +15,7 @@ import { ExtHostDocuments } from 'vs/workbench/api/node/extHostDocuments';
|
||||
import { ExtHostCommands, CommandsConverter } from 'vs/workbench/api/node/extHostCommands';
|
||||
import { ExtHostDiagnostics } from 'vs/workbench/api/node/extHostDiagnostics';
|
||||
import { asPromise } from 'vs/base/common/async';
|
||||
import { MainContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, ObjectIdentifier, IRawColorInfo, IMainContext, IdObject, ISerializedRegExp, ISerializedIndentationRule, ISerializedOnEnterRule, ISerializedLanguageConfiguration, WorkspaceSymbolDto, SuggestResultDto, WorkspaceSymbolsDto, SuggestionDto, CodeActionDto, ISerializedDocumentFilter, WorkspaceEditDto, ISerializedSignatureHelpProviderMetadata } from './extHost.protocol';
|
||||
import { MainContext, MainThreadLanguageFeaturesShape, ExtHostLanguageFeaturesShape, ObjectIdentifier, IRawColorInfo, IMainContext, IdObject, ISerializedRegExp, ISerializedIndentationRule, ISerializedOnEnterRule, ISerializedLanguageConfiguration, WorkspaceSymbolDto, SuggestResultDto, WorkspaceSymbolsDto, SuggestionDto, CodeActionDto, ISerializedDocumentFilter, WorkspaceEditDto, ISerializedSignatureHelpProviderMetadata, LinkDto, CodeLensDto } from './extHost.protocol';
|
||||
import { regExpLeadsToEndlessLoop, regExpFlags } from 'vs/base/common/strings';
|
||||
import { IPosition } from 'vs/editor/common/core/position';
|
||||
import { IRange, Range as EditorRange } from 'vs/editor/common/core/range';
|
||||
@@ -104,24 +104,25 @@ class CodeLensAdapter {
|
||||
private readonly _provider: vscode.CodeLensProvider
|
||||
) { }
|
||||
|
||||
provideCodeLenses(resource: URI, token: CancellationToken): Promise<modes.ICodeLensSymbol[]> {
|
||||
provideCodeLenses(resource: URI, token: CancellationToken): Promise<CodeLensDto[]> {
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
|
||||
return asPromise(() => this._provider.provideCodeLenses(doc, token)).then(lenses => {
|
||||
if (Array.isArray(lenses)) {
|
||||
return lenses.map(lens => {
|
||||
let result: CodeLensDto[] = [];
|
||||
if (isNonEmptyArray(lenses)) {
|
||||
for (const lens of lenses) {
|
||||
const id = this._heapService.keep(lens);
|
||||
return ObjectIdentifier.mixin({
|
||||
result.push(ObjectIdentifier.mixin({
|
||||
range: typeConvert.Range.from(lens.range),
|
||||
command: this._commands.toInternal(lens.command)
|
||||
}, id);
|
||||
});
|
||||
}, id));
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
resolveCodeLens(resource: URI, symbol: modes.ICodeLensSymbol, token: CancellationToken): Promise<modes.ICodeLensSymbol> {
|
||||
resolveCodeLens(resource: URI, symbol: CodeLensDto, token: CancellationToken): Promise<CodeLensDto> {
|
||||
|
||||
const lens = this._heapService.get<vscode.CodeLens>(ObjectIdentifier.of(symbol));
|
||||
if (!lens) {
|
||||
@@ -778,25 +779,24 @@ class LinkProviderAdapter {
|
||||
private readonly _provider: vscode.DocumentLinkProvider
|
||||
) { }
|
||||
|
||||
provideLinks(resource: URI, token: CancellationToken): Promise<modes.ILink[]> {
|
||||
provideLinks(resource: URI, token: CancellationToken): Promise<LinkDto[]> {
|
||||
const doc = this._documents.getDocumentData(resource).document;
|
||||
|
||||
return asPromise(() => this._provider.provideDocumentLinks(doc, token)).then(links => {
|
||||
if (!Array.isArray(links)) {
|
||||
return undefined;
|
||||
}
|
||||
const result: modes.ILink[] = [];
|
||||
const result: LinkDto[] = [];
|
||||
for (const link of links) {
|
||||
let data = typeConvert.DocumentLink.from(link);
|
||||
let id = this._heapService.keep(link);
|
||||
ObjectIdentifier.mixin(data, id);
|
||||
result.push(data);
|
||||
result.push(ObjectIdentifier.mixin(data, id));
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
resolveLink(link: modes.ILink, token: CancellationToken): Promise<modes.ILink> {
|
||||
resolveLink(link: LinkDto, token: CancellationToken): Promise<LinkDto> {
|
||||
if (typeof this._provider.resolveDocumentLink !== 'function') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { MainContext, MainThreadOutputServiceShape, IMainContext, ExtHostOutputS
|
||||
import * as vscode from 'vscode';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { posix } from 'path';
|
||||
import { OutputAppender } from 'vs/platform/output/node/outputAppender';
|
||||
import { OutputAppender } from 'vs/workbench/contrib/output/node/outputAppender';
|
||||
import { toLocalISOString } from 'vs/base/common/date';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
|
||||
@@ -14,7 +14,7 @@ import { StopWatch } from 'vs/base/common/stopwatch';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { compareItemsByScore, IItemAccessor, prepareQuery, ScorerCache } from 'vs/base/parts/quickopen/common/quickOpenScorer';
|
||||
import { ICachedSearchStats, IFileIndexProviderStats, IFileMatch, IFileQuery, IFileSearchStats, IFolderQuery, ISearchCompleteStats } from 'vs/platform/search/common/search';
|
||||
import { ICachedSearchStats, IFileIndexProviderStats, IFileMatch, IFileQuery, IFileSearchStats, IFolderQuery, ISearchCompleteStats } from 'vs/workbench/services/search/common/search';
|
||||
import { IDirectoryEntry, IDirectoryTree, IInternalFileMatch } from 'vs/workbench/services/search/node/fileSearchManager';
|
||||
import { QueryGlobTester, resolvePatternsForProvider } from 'vs/workbench/services/search/node/search';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
@@ -8,7 +8,7 @@ import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import * as extfs from 'vs/base/node/extfs';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IFileQuery, IFolderQuery, IRawFileQuery, IRawQuery, IRawTextQuery, ISearchCompleteStats, ITextQuery } from 'vs/platform/search/common/search';
|
||||
import { IFileQuery, IFolderQuery, IRawFileQuery, IRawQuery, IRawTextQuery, ISearchCompleteStats, ITextQuery } from 'vs/workbench/services/search/common/search';
|
||||
import { FileIndexSearchManager } from 'vs/workbench/api/node/extHostSearch.fileIndex';
|
||||
import { FileSearchManager } from 'vs/workbench/services/search/node/fileSearchManager';
|
||||
import { SearchService } from 'vs/workbench/services/search/node/rawSearchService';
|
||||
|
||||
@@ -195,6 +195,9 @@ namespace TaskDTO {
|
||||
} else {
|
||||
scope = value.scope.uri;
|
||||
}
|
||||
} else {
|
||||
// To continue to support the deprecated task constructor that doesn't take a scope, we must add a scope here:
|
||||
scope = types.TaskScope.Workspace;
|
||||
}
|
||||
if (!definition || !scope) {
|
||||
return undefined;
|
||||
|
||||
@@ -19,6 +19,7 @@ import * as http from 'http';
|
||||
import * as fs from 'fs';
|
||||
import { ExtHostCommands } from 'vs/workbench/api/node/extHostCommands';
|
||||
import { sanitizeProcessEnvironment } from 'vs/base/node/processes';
|
||||
import { IURIToOpen, URIType } from 'vs/platform/windows/common/windows';
|
||||
|
||||
const RENDERER_NO_PROCESS_ID = -1;
|
||||
|
||||
@@ -618,18 +619,16 @@ class CLIServer {
|
||||
|
||||
return this.ipcHandlePath;
|
||||
}
|
||||
private toURIs(strs: string[]): URI[] {
|
||||
const result: URI[] = [];
|
||||
private collectURIToOpen(strs: string[], typeHint: URIType, result: IURIToOpen[]): void {
|
||||
if (Array.isArray(strs)) {
|
||||
for (const s of strs) {
|
||||
try {
|
||||
result.push(URI.parse(s));
|
||||
result.push({ uri: URI.parse(s), typeHint });
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private onRequest(req: http.IncomingMessage, res: http.ServerResponse): void {
|
||||
@@ -642,7 +641,10 @@ class CLIServer {
|
||||
if (folderURIs && folderURIs.length && !forceReuseWindow) {
|
||||
forceNewWindow = true;
|
||||
}
|
||||
this._commands.executeCommand('_files.windowOpen', { folderURIs: this.toURIs(folderURIs), fileURIs: this.toURIs(fileURIs), forceNewWindow, diffMode, addMode, forceReuseWindow });
|
||||
const urisToOpen: IURIToOpen[] = [];
|
||||
this.collectURIToOpen(folderURIs, 'folder', urisToOpen);
|
||||
this.collectURIToOpen(fileURIs, 'file', urisToOpen);
|
||||
this._commands.executeCommand('_files.windowOpen', { urisToOpen, forceNewWindow, diffMode, addMode, forceReuseWindow });
|
||||
}
|
||||
res.writeHead(200);
|
||||
res.end();
|
||||
|
||||
@@ -42,7 +42,7 @@ export class ExtHostEditors implements ExtHostEditorsShape {
|
||||
this._extHostDocumentsAndEditors.onDidChangeActiveTextEditor(e => this._onDidChangeActiveTextEditor.fire(e));
|
||||
}
|
||||
|
||||
getActiveTextEditor(): ExtHostTextEditor {
|
||||
getActiveTextEditor(): ExtHostTextEditor | undefined {
|
||||
return this._extHostDocumentsAndEditors.activeEditor();
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import * as marked from 'vs/base/common/marked/marked';
|
||||
import { parse } from 'vs/base/common/marshalling';
|
||||
import { cloneAndChange } from 'vs/base/common/objects';
|
||||
import { LogLevel as _MainLogLevel } from 'vs/platform/log/common/log';
|
||||
import { coalesce } from 'vs/base/common/arrays';
|
||||
|
||||
export interface PositionLike {
|
||||
line: number;
|
||||
@@ -64,7 +65,10 @@ export namespace Selection {
|
||||
}
|
||||
export namespace Range {
|
||||
|
||||
export function from(range: RangeLike): IRange {
|
||||
export function from(range: undefined): undefined;
|
||||
export function from(range: RangeLike): IRange;
|
||||
export function from(range: RangeLike | undefined): IRange | undefined;
|
||||
export function from(range: RangeLike | undefined): IRange | undefined {
|
||||
if (!range) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -77,7 +81,10 @@ export namespace Range {
|
||||
};
|
||||
}
|
||||
|
||||
export function to(range: IRange): types.Range {
|
||||
export function to(range: undefined): types.Range;
|
||||
export function to(range: IRange): types.Range;
|
||||
export function to(range: IRange | undefined): types.Range | undefined;
|
||||
export function to(range: IRange | undefined): types.Range | undefined {
|
||||
if (!range) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -96,7 +103,7 @@ export namespace Position {
|
||||
}
|
||||
|
||||
export namespace DiagnosticTag {
|
||||
export function from(value: vscode.DiagnosticTag): MarkerTag {
|
||||
export function from(value: vscode.DiagnosticTag): MarkerTag | undefined {
|
||||
switch (value) {
|
||||
case types.DiagnosticTag.Unnecessary:
|
||||
return MarkerTag.Unnecessary;
|
||||
@@ -114,7 +121,7 @@ export namespace Diagnostic {
|
||||
code: isString(value.code) || isNumber(value.code) ? String(value.code) : undefined,
|
||||
severity: DiagnosticSeverity.from(value.severity),
|
||||
relatedInformation: value.relatedInformation && value.relatedInformation.map(DiagnosticRelatedInformation.from),
|
||||
tags: Array.isArray(value.tags) ? value.tags.map(DiagnosticTag.from) : undefined,
|
||||
tags: Array.isArray(value.tags) ? coalesce(value.tags.map(DiagnosticTag.from)) : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -175,7 +182,7 @@ export namespace ViewColumn {
|
||||
return ACTIVE_GROUP; // default is always the active group
|
||||
}
|
||||
|
||||
export function to(position?: EditorViewColumn): vscode.ViewColumn {
|
||||
export function to(position?: EditorViewColumn): vscode.ViewColumn | undefined {
|
||||
if (typeof position === 'number' && position >= 0) {
|
||||
return position + 1; // adjust to index (ViewColumn.ONE => 1)
|
||||
}
|
||||
@@ -226,13 +233,15 @@ export namespace MarkdownString {
|
||||
}
|
||||
|
||||
// extract uris into a separate object
|
||||
res.uris = Object.create(null);
|
||||
const resUris: { [href: string]: UriComponents } = Object.create(null);
|
||||
res.uris = resUris;
|
||||
|
||||
let renderer = new marked.Renderer();
|
||||
renderer.image = renderer.link = (href: string): string => {
|
||||
try {
|
||||
let uri = URI.parse(href, true);
|
||||
uri = uri.with({ query: _uriMassage(uri.query, res.uris) });
|
||||
res.uris[href] = uri;
|
||||
uri = uri.with({ query: _uriMassage(uri.query, resUris) });
|
||||
resUris[href] = uri;
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
@@ -284,10 +293,12 @@ export namespace MarkdownString {
|
||||
|
||||
export function fromRangeOrRangeWithMessage(ranges: vscode.Range[] | vscode.DecorationOptions[]): IDecorationOptions[] {
|
||||
if (isDecorationOptionsArr(ranges)) {
|
||||
return ranges.map(r => {
|
||||
return ranges.map((r): IDecorationOptions => {
|
||||
return {
|
||||
range: Range.from(r.range),
|
||||
hoverMessage: Array.isArray(r.hoverMessage) ? MarkdownString.fromMany(r.hoverMessage) : r.hoverMessage && MarkdownString.from(r.hoverMessage),
|
||||
hoverMessage: Array.isArray(r.hoverMessage)
|
||||
? MarkdownString.fromMany(r.hoverMessage)
|
||||
: (r.hoverMessage ? MarkdownString.from(r.hoverMessage) : undefined),
|
||||
renderOptions: <any> /* URI vs Uri */r.renderOptions
|
||||
};
|
||||
});
|
||||
@@ -318,7 +329,7 @@ export namespace ThemableDecorationAttachmentRenderOptions {
|
||||
}
|
||||
return {
|
||||
contentText: options.contentText,
|
||||
contentIconPath: pathOrURIToURI(options.contentIconPath),
|
||||
contentIconPath: options.contentIconPath ? pathOrURIToURI(options.contentIconPath) : undefined,
|
||||
border: options.border,
|
||||
borderColor: <string | types.ThemeColor>options.borderColor,
|
||||
fontStyle: options.fontStyle,
|
||||
@@ -357,11 +368,11 @@ export namespace ThemableDecorationRenderOptions {
|
||||
color: <string | types.ThemeColor>options.color,
|
||||
opacity: options.opacity,
|
||||
letterSpacing: options.letterSpacing,
|
||||
gutterIconPath: pathOrURIToURI(options.gutterIconPath),
|
||||
gutterIconPath: options.gutterIconPath ? pathOrURIToURI(options.gutterIconPath) : undefined,
|
||||
gutterIconSize: options.gutterIconSize,
|
||||
overviewRulerColor: <string | types.ThemeColor>options.overviewRulerColor,
|
||||
before: ThemableDecorationAttachmentRenderOptions.from(options.before),
|
||||
after: ThemableDecorationAttachmentRenderOptions.from(options.after),
|
||||
before: options.before ? ThemableDecorationAttachmentRenderOptions.from(options.before) : undefined,
|
||||
after: options.after ? ThemableDecorationAttachmentRenderOptions.from(options.after) : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -388,10 +399,10 @@ export namespace DecorationRenderOptions {
|
||||
export function from(options: vscode.DecorationRenderOptions): IDecorationRenderOptions {
|
||||
return {
|
||||
isWholeLine: options.isWholeLine,
|
||||
rangeBehavior: DecorationRangeBehavior.from(options.rangeBehavior),
|
||||
rangeBehavior: options.rangeBehavior ? DecorationRangeBehavior.from(options.rangeBehavior) : undefined,
|
||||
overviewRulerLane: options.overviewRulerLane,
|
||||
light: ThemableDecorationRenderOptions.from(options.light),
|
||||
dark: ThemableDecorationRenderOptions.from(options.dark),
|
||||
light: options.light ? ThemableDecorationRenderOptions.from(options.light) : undefined,
|
||||
dark: options.dark ? ThemableDecorationRenderOptions.from(options.dark) : undefined,
|
||||
|
||||
backgroundColor: <string | types.ThemeColor>options.backgroundColor,
|
||||
outline: options.outline,
|
||||
@@ -411,11 +422,11 @@ export namespace DecorationRenderOptions {
|
||||
color: <string | types.ThemeColor>options.color,
|
||||
opacity: options.opacity,
|
||||
letterSpacing: options.letterSpacing,
|
||||
gutterIconPath: pathOrURIToURI(options.gutterIconPath),
|
||||
gutterIconPath: options.gutterIconPath ? pathOrURIToURI(options.gutterIconPath) : undefined,
|
||||
gutterIconSize: options.gutterIconSize,
|
||||
overviewRulerColor: <string | types.ThemeColor>options.overviewRulerColor,
|
||||
before: ThemableDecorationAttachmentRenderOptions.from(options.before),
|
||||
after: ThemableDecorationAttachmentRenderOptions.from(options.after),
|
||||
before: options.before ? ThemableDecorationAttachmentRenderOptions.from(options.before) : undefined,
|
||||
after: options.after ? ThemableDecorationAttachmentRenderOptions.from(options.after) : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -432,7 +443,7 @@ export namespace TextEdit {
|
||||
|
||||
export function to(edit: modes.TextEdit): types.TextEdit {
|
||||
const result = new types.TextEdit(Range.to(edit.range), edit.text);
|
||||
result.newEol = EndOfLine.to(edit.eol);
|
||||
result.newEol = typeof edit.eol === 'undefined' ? undefined : EndOfLine.to(edit.eol);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -724,9 +735,9 @@ export namespace CompletionItem {
|
||||
result.preselect = suggestion.preselect;
|
||||
result.commitCharacters = suggestion.commitCharacters;
|
||||
result.range = Range.to(suggestion.range);
|
||||
result.keepWhitespace = Boolean(suggestion.insertTextRules & modes.CompletionItemInsertTextRule.KeepWhitespace);
|
||||
result.keepWhitespace = typeof suggestion.insertTextRules === 'undefined' ? false : Boolean(suggestion.insertTextRules & modes.CompletionItemInsertTextRule.KeepWhitespace);
|
||||
// 'inserText'-logic
|
||||
if (suggestion.insertTextRules & modes.CompletionItemInsertTextRule.InsertAsSnippet) {
|
||||
if (typeof suggestion.insertTextRules !== 'undefined' && suggestion.insertTextRules & modes.CompletionItemInsertTextRule.InsertAsSnippet) {
|
||||
result.insertText = new types.SnippetString(suggestion.insertText);
|
||||
} else {
|
||||
result.insertText = suggestion.insertText;
|
||||
@@ -742,7 +753,7 @@ export namespace ParameterInformation {
|
||||
export function from(info: types.ParameterInformation): modes.ParameterInformation {
|
||||
return {
|
||||
label: info.label,
|
||||
documentation: MarkdownString.fromStrict(info.documentation)
|
||||
documentation: info.documentation ? MarkdownString.fromStrict(info.documentation) : undefined
|
||||
};
|
||||
}
|
||||
export function to(info: modes.ParameterInformation): types.ParameterInformation {
|
||||
@@ -758,7 +769,7 @@ export namespace SignatureInformation {
|
||||
export function from(info: types.SignatureInformation): modes.SignatureInformation {
|
||||
return {
|
||||
label: info.label,
|
||||
documentation: MarkdownString.fromStrict(info.documentation),
|
||||
documentation: info.documentation ? MarkdownString.fromStrict(info.documentation) : undefined,
|
||||
parameters: info.parameters && info.parameters.map(ParameterInformation.from)
|
||||
};
|
||||
}
|
||||
@@ -877,7 +888,7 @@ export namespace TextDocumentSaveReason {
|
||||
|
||||
export namespace EndOfLine {
|
||||
|
||||
export function from(eol: vscode.EndOfLine): EndOfLineSequence {
|
||||
export function from(eol: vscode.EndOfLine): EndOfLineSequence | undefined {
|
||||
if (eol === types.EndOfLine.CRLF) {
|
||||
return EndOfLineSequence.CRLF;
|
||||
} else if (eol === types.EndOfLine.LF) {
|
||||
@@ -886,7 +897,7 @@ export namespace EndOfLine {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function to(eol: EndOfLineSequence): vscode.EndOfLine {
|
||||
export function to(eol: EndOfLineSequence): vscode.EndOfLine | undefined {
|
||||
if (eol === EndOfLineSequence.CRLF) {
|
||||
return types.EndOfLine.CRLF;
|
||||
} else if (eol === EndOfLineSequence.LF) {
|
||||
@@ -897,7 +908,7 @@ export namespace EndOfLine {
|
||||
}
|
||||
|
||||
export namespace ProgressLocation {
|
||||
export function from(loc: vscode.ProgressLocation): MainProgressLocation {
|
||||
export function from(loc: vscode.ProgressLocation): MainProgressLocation | undefined {
|
||||
switch (loc) {
|
||||
case types.ProgressLocation.SourceControl: return MainProgressLocation.Scm;
|
||||
case types.ProgressLocation.Window: return MainProgressLocation.Window;
|
||||
@@ -935,7 +946,7 @@ export namespace FoldingRangeKind {
|
||||
|
||||
export namespace TextEditorOptions {
|
||||
|
||||
export function from(options?: vscode.TextDocumentShowOptions): ITextEditorOptions {
|
||||
export function from(options?: vscode.TextDocumentShowOptions): ITextEditorOptions | undefined {
|
||||
if (options) {
|
||||
return {
|
||||
pinned: typeof options.preview === 'boolean' ? !options.preview : undefined,
|
||||
@@ -975,7 +986,7 @@ export namespace GlobPattern {
|
||||
|
||||
export namespace LanguageSelector {
|
||||
|
||||
export function from(selector: vscode.DocumentSelector): languageSelector.LanguageSelector {
|
||||
export function from(selector: vscode.DocumentSelector): languageSelector.LanguageSelector | undefined {
|
||||
if (!selector) {
|
||||
return undefined;
|
||||
} else if (Array.isArray(selector)) {
|
||||
|
||||
@@ -16,6 +16,18 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
|
||||
function es5ClassCompat(target: Function): any {
|
||||
///@ts-ignore
|
||||
function _() { return Reflect.construct(target, arguments, this.constructor); }
|
||||
Object.defineProperty(_, 'name', Object.getOwnPropertyDescriptor(target, 'name')!);
|
||||
///@ts-ignore
|
||||
Object.setPrototypeOf(_, target);
|
||||
///@ts-ignore
|
||||
Object.setPrototypeOf(_.prototype, target.prototype);
|
||||
return _;
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Disposable {
|
||||
|
||||
static from(...inDisposables: { dispose(): any }[]): Disposable {
|
||||
@@ -46,6 +58,7 @@ export class Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Position {
|
||||
|
||||
static Min(...positions: Position[]): Position {
|
||||
@@ -217,6 +230,7 @@ export class Position {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Range {
|
||||
|
||||
static isRange(thing: any): thing is vscode.Range {
|
||||
@@ -351,6 +365,7 @@ export class Range {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Selection extends Range {
|
||||
|
||||
static isSelection(thing: any): thing is Selection {
|
||||
@@ -421,6 +436,7 @@ export enum EndOfLine {
|
||||
CRLF = 2
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class TextEdit {
|
||||
|
||||
static isTextEdit(thing: any): thing is TextEdit {
|
||||
@@ -524,6 +540,7 @@ export interface IFileTextEdit {
|
||||
edit: TextEdit;
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class WorkspaceEdit implements vscode.WorkspaceEdit {
|
||||
|
||||
private _edits = new Array<IFileOperation | IFileTextEdit>();
|
||||
@@ -627,6 +644,7 @@ export class WorkspaceEdit implements vscode.WorkspaceEdit {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SnippetString {
|
||||
|
||||
static isSnippetString(thing: any): thing is SnippetString {
|
||||
@@ -720,6 +738,7 @@ export enum DiagnosticSeverity {
|
||||
Error = 0
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Location {
|
||||
|
||||
static isLocation(thing: any): thing is Location {
|
||||
@@ -758,6 +777,7 @@ export class Location {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class DiagnosticRelatedInformation {
|
||||
|
||||
static is(thing: any): thing is DiagnosticRelatedInformation {
|
||||
@@ -791,6 +811,7 @@ export class DiagnosticRelatedInformation {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Diagnostic {
|
||||
|
||||
range: Range;
|
||||
@@ -835,6 +856,7 @@ export class Diagnostic {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Hover {
|
||||
|
||||
public contents: vscode.MarkdownString[] | vscode.MarkedString[];
|
||||
@@ -864,6 +886,7 @@ export enum DocumentHighlightKind {
|
||||
Write = 2
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class DocumentHighlight {
|
||||
|
||||
range: Range;
|
||||
@@ -911,6 +934,7 @@ export enum SymbolKind {
|
||||
TypeParameter = 25
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SymbolInformation {
|
||||
|
||||
static validate(candidate: SymbolInformation): void {
|
||||
@@ -954,6 +978,7 @@ export class SymbolInformation {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class DocumentSymbol {
|
||||
|
||||
static validate(candidate: DocumentSymbol): void {
|
||||
@@ -993,6 +1018,7 @@ export enum CodeActionTrigger {
|
||||
Manual = 2,
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class CodeAction {
|
||||
title: string;
|
||||
|
||||
@@ -1011,6 +1037,7 @@ export class CodeAction {
|
||||
}
|
||||
|
||||
|
||||
@es5ClassCompat
|
||||
export class CodeActionKind {
|
||||
private static readonly sep = '.';
|
||||
|
||||
@@ -1041,6 +1068,7 @@ export class CodeActionKind {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SelectionRangeKind {
|
||||
|
||||
private static readonly _sep = '.';
|
||||
@@ -1060,6 +1088,7 @@ export class SelectionRangeKind {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SelectionRange {
|
||||
|
||||
kind: SelectionRangeKind;
|
||||
@@ -1072,6 +1101,7 @@ export class SelectionRange {
|
||||
}
|
||||
|
||||
|
||||
@es5ClassCompat
|
||||
export class CodeLens {
|
||||
|
||||
range: Range;
|
||||
@@ -1088,6 +1118,7 @@ export class CodeLens {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class MarkdownString {
|
||||
|
||||
value: string;
|
||||
@@ -1118,6 +1149,7 @@ export class MarkdownString {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class ParameterInformation {
|
||||
|
||||
label: string | [number, number];
|
||||
@@ -1129,6 +1161,7 @@ export class ParameterInformation {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SignatureInformation {
|
||||
|
||||
label: string;
|
||||
@@ -1142,6 +1175,7 @@ export class SignatureInformation {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SignatureHelp {
|
||||
|
||||
signatures: SignatureInformation[];
|
||||
@@ -1166,8 +1200,8 @@ export enum CompletionTriggerKind {
|
||||
}
|
||||
|
||||
export interface CompletionContext {
|
||||
triggerKind: CompletionTriggerKind;
|
||||
triggerCharacter: string;
|
||||
readonly triggerKind: CompletionTriggerKind;
|
||||
readonly triggerCharacter?: string;
|
||||
}
|
||||
|
||||
export enum CompletionItemKind {
|
||||
@@ -1198,19 +1232,20 @@ export enum CompletionItemKind {
|
||||
TypeParameter = 24
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class CompletionItem implements vscode.CompletionItem {
|
||||
|
||||
label: string;
|
||||
kind: CompletionItemKind | undefined;
|
||||
detail: string;
|
||||
documentation: string | MarkdownString;
|
||||
sortText: string;
|
||||
filterText: string;
|
||||
preselect: boolean;
|
||||
detail?: string;
|
||||
documentation?: string | MarkdownString;
|
||||
sortText?: string;
|
||||
filterText?: string;
|
||||
preselect?: boolean;
|
||||
insertText: string | SnippetString;
|
||||
keepWhitespace?: boolean;
|
||||
range: Range;
|
||||
commitCharacters: string[];
|
||||
commitCharacters?: string[];
|
||||
textEdit: TextEdit;
|
||||
additionalTextEdits: TextEdit[];
|
||||
command: vscode.Command;
|
||||
@@ -1235,6 +1270,7 @@ export class CompletionItem implements vscode.CompletionItem {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class CompletionList {
|
||||
|
||||
isIncomplete?: boolean;
|
||||
@@ -1314,7 +1350,7 @@ export enum DecorationRangeBehavior {
|
||||
}
|
||||
|
||||
export namespace TextEditorSelectionChangeKind {
|
||||
export function fromValue(s: string) {
|
||||
export function fromValue(s: string | undefined) {
|
||||
switch (s) {
|
||||
case 'keyboard': return TextEditorSelectionChangeKind.Keyboard;
|
||||
case 'mouse': return TextEditorSelectionChangeKind.Mouse;
|
||||
@@ -1324,6 +1360,7 @@ export namespace TextEditorSelectionChangeKind {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class DocumentLink {
|
||||
|
||||
range: Range;
|
||||
@@ -1342,6 +1379,7 @@ export class DocumentLink {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Color {
|
||||
readonly red: number;
|
||||
readonly green: number;
|
||||
@@ -1358,6 +1396,7 @@ export class Color {
|
||||
|
||||
export type IColorFormat = string | { opaque: string, transparent: string };
|
||||
|
||||
@es5ClassCompat
|
||||
export class ColorInformation {
|
||||
range: Range;
|
||||
|
||||
@@ -1375,6 +1414,7 @@ export class ColorInformation {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class ColorPresentation {
|
||||
label: string;
|
||||
textEdit?: TextEdit;
|
||||
@@ -1416,6 +1456,7 @@ export enum TaskPanelKind {
|
||||
New = 3
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class TaskGroup implements vscode.TaskGroup {
|
||||
|
||||
private _id: string;
|
||||
@@ -1458,6 +1499,7 @@ export class TaskGroup implements vscode.TaskGroup {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class ProcessExecution implements vscode.ProcessExecution {
|
||||
|
||||
private _process: string;
|
||||
@@ -1530,6 +1572,7 @@ export class ProcessExecution implements vscode.ProcessExecution {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class ShellExecution implements vscode.ShellExecution {
|
||||
|
||||
private _commandLine: string;
|
||||
@@ -1626,6 +1669,7 @@ export enum TaskScope {
|
||||
Workspace = 2
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Task implements vscode.Task {
|
||||
|
||||
private static ProcessType: string = 'process';
|
||||
@@ -1858,6 +1902,7 @@ export enum ProgressLocation {
|
||||
Notification = 15
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class TreeItem {
|
||||
|
||||
label?: string | vscode.TreeItemLabel;
|
||||
@@ -1885,6 +1930,7 @@ export enum TreeItemCollapsibleState {
|
||||
Expanded = 2
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class ThemeIcon {
|
||||
static readonly File = new ThemeIcon('file');
|
||||
|
||||
@@ -1897,6 +1943,7 @@ export class ThemeIcon {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class ThemeColor {
|
||||
id: string;
|
||||
constructor(id: string) {
|
||||
@@ -1912,6 +1959,7 @@ export enum ConfigurationTarget {
|
||||
WorkspaceFolder = 3
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class RelativePattern implements IRelativePattern {
|
||||
base: string;
|
||||
baseFolder?: URI;
|
||||
@@ -1944,6 +1992,7 @@ export class RelativePattern implements IRelativePattern {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class Breakpoint {
|
||||
|
||||
private _id: string | undefined;
|
||||
@@ -1974,6 +2023,7 @@ export class Breakpoint {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class SourceBreakpoint extends Breakpoint {
|
||||
readonly location: Location;
|
||||
|
||||
@@ -1986,6 +2036,7 @@ export class SourceBreakpoint extends Breakpoint {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class FunctionBreakpoint extends Breakpoint {
|
||||
readonly functionName: string;
|
||||
|
||||
@@ -1998,6 +2049,7 @@ export class FunctionBreakpoint extends Breakpoint {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class DebugAdapterExecutable implements vscode.DebugAdapterExecutable {
|
||||
readonly command: string;
|
||||
readonly args: string[];
|
||||
@@ -2010,6 +2062,7 @@ export class DebugAdapterExecutable implements vscode.DebugAdapterExecutable {
|
||||
}
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class DebugAdapterServer implements vscode.DebugAdapterServer {
|
||||
readonly port: number;
|
||||
readonly host?: string;
|
||||
@@ -2021,6 +2074,7 @@ export class DebugAdapterServer implements vscode.DebugAdapterServer {
|
||||
}
|
||||
|
||||
/*
|
||||
@es5ClassCompat
|
||||
export class DebugAdapterImplementation implements vscode.DebugAdapterImplementation {
|
||||
readonly implementation: any;
|
||||
|
||||
@@ -2048,6 +2102,7 @@ export enum FileChangeType {
|
||||
Deleted = 3,
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class FileSystemError extends Error {
|
||||
|
||||
static FileExists(messageOrUri?: string | URI): FileSystemError {
|
||||
@@ -2090,6 +2145,7 @@ export class FileSystemError extends Error {
|
||||
|
||||
//#region folding api
|
||||
|
||||
@es5ClassCompat
|
||||
export class FoldingRange {
|
||||
|
||||
start: number;
|
||||
@@ -2125,6 +2181,7 @@ export enum CommentThreadCollapsibleState {
|
||||
Expanded = 1
|
||||
}
|
||||
|
||||
@es5ClassCompat
|
||||
export class QuickInputButtons {
|
||||
|
||||
static readonly Back: vscode.QuickInputButton = { iconPath: 'back.svg' };
|
||||
|
||||
@@ -17,7 +17,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { Severity } from 'vs/platform/notification/common/notification';
|
||||
import { IRawFileMatch2, resultIsMatch } from 'vs/platform/search/common/search';
|
||||
import { IRawFileMatch2, resultIsMatch } from 'vs/workbench/services/search/common/search';
|
||||
import { Workspace, WorkspaceFolder } from 'vs/platform/workspace/common/workspace';
|
||||
import { Range, RelativePattern } from 'vs/workbench/api/node/extHostTypes';
|
||||
import { ITextQueryBuilderOptions } from 'vs/workbench/contrib/search/common/queryBuilder';
|
||||
@@ -57,7 +57,7 @@ interface MutableWorkspaceFolder extends vscode.WorkspaceFolder {
|
||||
|
||||
class ExtHostWorkspaceImpl extends Workspace {
|
||||
|
||||
static toExtHostWorkspace(data: IWorkspaceData, previousConfirmedWorkspace?: ExtHostWorkspaceImpl, previousUnconfirmedWorkspace?: ExtHostWorkspaceImpl): { workspace: ExtHostWorkspaceImpl, added: vscode.WorkspaceFolder[], removed: vscode.WorkspaceFolder[] } {
|
||||
static toExtHostWorkspace(data: IWorkspaceData, previousConfirmedWorkspace?: ExtHostWorkspaceImpl, previousUnconfirmedWorkspace?: ExtHostWorkspaceImpl): { workspace: ExtHostWorkspaceImpl | null, added: vscode.WorkspaceFolder[], removed: vscode.WorkspaceFolder[] } {
|
||||
if (!data) {
|
||||
return { workspace: null, added: [], removed: [] };
|
||||
}
|
||||
@@ -96,7 +96,7 @@ class ExtHostWorkspaceImpl extends Workspace {
|
||||
return { workspace, added, removed };
|
||||
}
|
||||
|
||||
private static _findFolder(workspace: ExtHostWorkspaceImpl, folderUriToFind: URI): MutableWorkspaceFolder {
|
||||
private static _findFolder(workspace: ExtHostWorkspaceImpl, folderUriToFind: URI): MutableWorkspaceFolder | undefined {
|
||||
for (let i = 0; i < workspace.folders.length; i++) {
|
||||
const folder = workspace.workspaceFolders[i];
|
||||
if (isFolderEqual(folder.uri, folderUriToFind)) {
|
||||
@@ -188,7 +188,7 @@ export class ExtHostWorkspaceProvider {
|
||||
private readonly _onDidChangeWorkspace = new Emitter<vscode.WorkspaceFoldersChangeEvent>();
|
||||
|
||||
private _confirmedWorkspace: ExtHostWorkspaceImpl;
|
||||
private _unconfirmedWorkspace: ExtHostWorkspaceImpl;
|
||||
private _unconfirmedWorkspace?: ExtHostWorkspaceImpl;
|
||||
|
||||
private readonly _proxy: MainThreadWorkspaceShape;
|
||||
private readonly _messageService: MainThreadMessageServiceShape;
|
||||
@@ -214,7 +214,7 @@ export class ExtHostWorkspaceProvider {
|
||||
return this._actualWorkspace;
|
||||
}
|
||||
|
||||
get name(): string {
|
||||
get name(): string | undefined {
|
||||
return this._actualWorkspace ? this._actualWorkspace.name : undefined;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ export class ExtHostWorkspaceProvider {
|
||||
return this._unconfirmedWorkspace || this._confirmedWorkspace;
|
||||
}
|
||||
|
||||
getWorkspaceFolders(): vscode.WorkspaceFolder[] {
|
||||
getWorkspaceFolders(): vscode.WorkspaceFolder[] | undefined {
|
||||
if (!this._actualWorkspace) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -300,14 +300,14 @@ export class ExtHostWorkspaceProvider {
|
||||
return this._actualWorkspace.getWorkspaceFolder(uri, resolveParent);
|
||||
}
|
||||
|
||||
resolveWorkspaceFolder(uri: vscode.Uri): vscode.WorkspaceFolder {
|
||||
resolveWorkspaceFolder(uri: vscode.Uri): vscode.WorkspaceFolder | undefined {
|
||||
if (!this._actualWorkspace) {
|
||||
return undefined;
|
||||
}
|
||||
return this._actualWorkspace.resolveWorkspaceFolder(uri);
|
||||
}
|
||||
|
||||
getPath(): string {
|
||||
getPath(): string | undefined {
|
||||
|
||||
// this is legacy from the days before having
|
||||
// multi-root and we keep it only alive if there
|
||||
@@ -324,9 +324,9 @@ export class ExtHostWorkspaceProvider {
|
||||
return folders[0].uri.fsPath;
|
||||
}
|
||||
|
||||
getRelativePath(pathOrUri: string | vscode.Uri, includeWorkspace?: boolean): string {
|
||||
getRelativePath(pathOrUri: string | vscode.Uri, includeWorkspace?: boolean): string | undefined {
|
||||
|
||||
let path: string;
|
||||
let path: string | undefined;
|
||||
if (typeof pathOrUri === 'string') {
|
||||
path = pathOrUri;
|
||||
} else if (typeof pathOrUri !== 'undefined') {
|
||||
@@ -392,8 +392,8 @@ export class ExtHostWorkspaceProvider {
|
||||
findFiles(include: string | RelativePattern, exclude: vscode.GlobPattern, maxResults: number, extensionId: ExtensionIdentifier, token: vscode.CancellationToken = CancellationToken.None): Promise<vscode.Uri[]> {
|
||||
this._logService.trace(`extHostWorkspace#findFiles: fileSearch, extension: ${extensionId.value}, entryPoint: findFiles`);
|
||||
|
||||
let includePattern: string;
|
||||
let includeFolder: URI;
|
||||
let includePattern: string | undefined;
|
||||
let includeFolder: URI | undefined;
|
||||
if (include) {
|
||||
if (typeof include === 'string') {
|
||||
includePattern = include;
|
||||
@@ -405,7 +405,7 @@ export class ExtHostWorkspaceProvider {
|
||||
}
|
||||
}
|
||||
|
||||
let excludePatternOrDisregardExcludes: string | false;
|
||||
let excludePatternOrDisregardExcludes: string | false | undefined;
|
||||
if (exclude === null) {
|
||||
excludePatternOrDisregardExcludes = false;
|
||||
} else if (exclude) {
|
||||
@@ -424,7 +424,7 @@ export class ExtHostWorkspaceProvider {
|
||||
.then(data => Array.isArray(data) ? data.map(URI.revive) : []);
|
||||
}
|
||||
|
||||
findTextInFiles(query: vscode.TextSearchQuery, options: vscode.FindTextInFilesOptions, callback: (result: vscode.TextSearchResult) => void, extensionId: ExtensionIdentifier, token: vscode.CancellationToken = CancellationToken.None): Promise<vscode.TextSearchComplete> {
|
||||
findTextInFiles(query: vscode.TextSearchQuery, options: vscode.FindTextInFilesOptions, callback: (result: vscode.TextSearchResult) => void, extensionId: ExtensionIdentifier, token: vscode.CancellationToken = CancellationToken.None): Promise<vscode.TextSearchComplete | undefined> {
|
||||
this._logService.trace(`extHostWorkspace#findTextInFiles: textSearch, extension: ${extensionId.value}, entryPoint: findTextInFiles`);
|
||||
|
||||
const requestId = this._requestIdProvider.getNext();
|
||||
@@ -456,7 +456,7 @@ export class ExtHostWorkspaceProvider {
|
||||
beforeContext: options.beforeContext,
|
||||
|
||||
includePattern: options.include && globPatternToString(options.include),
|
||||
excludePattern: options.exclude && globPatternToString(options.exclude)
|
||||
excludePattern: options.exclude ? globPatternToString(options.exclude) : undefined
|
||||
};
|
||||
|
||||
let isCanceled = false;
|
||||
@@ -467,7 +467,7 @@ export class ExtHostWorkspaceProvider {
|
||||
}
|
||||
|
||||
const uri = URI.revive(p.resource);
|
||||
p.results.forEach(result => {
|
||||
p.results!.forEach(result => {
|
||||
if (resultIsMatch(result)) {
|
||||
callback(<vscode.TextSearchMatch>{
|
||||
uri,
|
||||
@@ -514,7 +514,7 @@ export class ExtHostWorkspaceProvider {
|
||||
return this._proxy.$saveAll(includeUntitled);
|
||||
}
|
||||
|
||||
resolveProxy(url: string): Promise<string> {
|
||||
resolveProxy(url: string): Promise<string | undefined> {
|
||||
return this._proxy.$resolveProxy(url);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user