mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 19:18:59 +01:00
fixes #39806
This commit is contained in:
@@ -58,6 +58,7 @@ import { ExtHostDecorations } from 'vs/workbench/api/node/extHostDecorations';
|
||||
import { toGlobPattern, toLanguageSelector } from 'vs/workbench/api/node/extHostTypeConverters';
|
||||
import { ExtensionActivatedByAPI } from 'vs/workbench/api/node/extHostExtensionActivator';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export interface IExtensionApiFactory {
|
||||
(extension: IExtensionDescription): typeof vscode;
|
||||
@@ -81,7 +82,8 @@ export function createApiFactory(
|
||||
threadService: ExtHostThreadService,
|
||||
extHostWorkspace: ExtHostWorkspace,
|
||||
extHostConfiguration: ExtHostConfiguration,
|
||||
extensionService: ExtHostExtensionService
|
||||
extensionService: ExtHostExtensionService,
|
||||
logService: ILogService
|
||||
): IExtensionApiFactory {
|
||||
|
||||
// Addressable instances
|
||||
@@ -92,7 +94,7 @@ export function createApiFactory(
|
||||
const extHostDocumentContentProviders = threadService.set(ExtHostContext.ExtHostDocumentContentProviders, new ExtHostDocumentContentProvider(threadService, extHostDocumentsAndEditors));
|
||||
const extHostDocumentSaveParticipant = threadService.set(ExtHostContext.ExtHostDocumentSaveParticipant, new ExtHostDocumentSaveParticipant(extHostDocuments, threadService.get(MainContext.MainThreadEditors)));
|
||||
const extHostEditors = threadService.set(ExtHostContext.ExtHostEditors, new ExtHostEditors(threadService, extHostDocumentsAndEditors));
|
||||
const extHostCommands = threadService.set(ExtHostContext.ExtHostCommands, new ExtHostCommands(threadService, extHostHeapService));
|
||||
const extHostCommands = threadService.set(ExtHostContext.ExtHostCommands, new ExtHostCommands(threadService, extHostHeapService, logService));
|
||||
const extHostTreeViews = threadService.set(ExtHostContext.ExtHostTreeViews, new ExtHostTreeViews(threadService.get(MainContext.MainThreadTreeViews), extHostCommands));
|
||||
threadService.set(ExtHostContext.ExtHostWorkspace, extHostWorkspace);
|
||||
const extHostDebugService = threadService.set(ExtHostContext.ExtHostDebugService, new ExtHostDebugService(threadService, extHostWorkspace));
|
||||
@@ -103,7 +105,7 @@ export function createApiFactory(
|
||||
const extHostFileSystemEvent = threadService.set(ExtHostContext.ExtHostFileSystemEventService, new ExtHostFileSystemEventService());
|
||||
const extHostQuickOpen = threadService.set(ExtHostContext.ExtHostQuickOpen, new ExtHostQuickOpen(threadService, extHostWorkspace, extHostCommands));
|
||||
const extHostTerminalService = threadService.set(ExtHostContext.ExtHostTerminalService, new ExtHostTerminalService(threadService));
|
||||
const extHostSCM = threadService.set(ExtHostContext.ExtHostSCM, new ExtHostSCM(threadService, extHostCommands));
|
||||
const extHostSCM = threadService.set(ExtHostContext.ExtHostSCM, new ExtHostSCM(threadService, extHostCommands, logService));
|
||||
const extHostTask = threadService.set(ExtHostContext.ExtHostTask, new ExtHostTask(threadService, extHostWorkspace));
|
||||
const extHostWindow = threadService.set(ExtHostContext.ExtHostWindow, new ExtHostWindow(threadService));
|
||||
threadService.set(ExtHostContext.ExtHostExtensionService, extensionService);
|
||||
|
||||
@@ -15,7 +15,7 @@ import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
import * as modes from 'vs/editor/common/modes';
|
||||
import * as vscode from 'vscode';
|
||||
import { log, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
interface CommandHandler {
|
||||
callback: Function;
|
||||
@@ -36,7 +36,8 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
heapService: ExtHostHeapService
|
||||
heapService: ExtHostHeapService,
|
||||
private logService: ILogService
|
||||
) {
|
||||
this._proxy = mainContext.get(MainContext.MainThreadCommands);
|
||||
this._converter = new CommandsConverter(this, heapService);
|
||||
@@ -50,8 +51,8 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
this._argumentProcessors.push(processor);
|
||||
}
|
||||
|
||||
@log(LogLevel.Trace, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
|
||||
registerCommand(id: string, callback: <T>(...args: any[]) => T | Thenable<T>, thisArg?: any, description?: ICommandHandlerDescription): extHostTypes.Disposable {
|
||||
this.logService.trace('ExtHostCommands#registerCommand', id);
|
||||
|
||||
if (!id.trim().length) {
|
||||
throw new Error('invalid id');
|
||||
@@ -71,8 +72,8 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
});
|
||||
}
|
||||
|
||||
@log(LogLevel.Trace, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
|
||||
executeCommand<T>(id: string, ...args: any[]): Thenable<T> {
|
||||
this.logService.trace('ExtHostCommands#executeCommand', id);
|
||||
|
||||
if (this._commands.has(id)) {
|
||||
// we stay inside the extension host and support
|
||||
@@ -136,8 +137,9 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
}
|
||||
}
|
||||
|
||||
@log(LogLevel.Trace, 'ExtHostCommands', (msg, filterUnderscoreCommands) => `${msg}(${filterUnderscoreCommands})`)
|
||||
getCommands(filterUnderscoreCommands: boolean = false): Thenable<string[]> {
|
||||
this.logService.trace('ExtHostCommands#getCommands', filterUnderscoreCommands);
|
||||
|
||||
return this._proxy.$getCommands().then(result => {
|
||||
if (filterUnderscoreCommands) {
|
||||
result = result.filter(command => command[0] !== '_');
|
||||
|
||||
@@ -21,6 +21,7 @@ import { ExtHostWorkspace } from 'vs/workbench/api/node/extHostWorkspace';
|
||||
import { realpath } from 'fs';
|
||||
import { TernarySearchTree } from 'vs/base/common/map';
|
||||
import { Barrier } from 'vs/base/common/async';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
class ExtensionMemento implements IExtensionMemento {
|
||||
|
||||
@@ -125,7 +126,8 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
constructor(initData: IInitData,
|
||||
threadService: ExtHostThreadService,
|
||||
extHostWorkspace: ExtHostWorkspace,
|
||||
extHostConfiguration: ExtHostConfiguration
|
||||
extHostConfiguration: ExtHostConfiguration,
|
||||
logService: ILogService
|
||||
) {
|
||||
this._barrier = new Barrier();
|
||||
this._registry = new ExtensionDescriptionRegistry(initData.extensions);
|
||||
@@ -137,7 +139,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
this._activator = null;
|
||||
|
||||
// initialize API first (i.e. do not release barrier until the API is initialized)
|
||||
const apiFactory = createApiFactory(initData, threadService, extHostWorkspace, extHostConfiguration, this);
|
||||
const apiFactory = createApiFactory(initData, threadService, extHostWorkspace, extHostConfiguration, this, logService);
|
||||
|
||||
initializeExtensionApi(this, apiFactory).then(() => {
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import { sortedDiff } from 'vs/base/common/arrays';
|
||||
import { comparePaths } from 'vs/base/common/comparers';
|
||||
import * as vscode from 'vscode';
|
||||
import { ISplice } from 'vs/base/common/sequence';
|
||||
import { log, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
type ProviderHandle = number;
|
||||
type GroupHandle = number;
|
||||
@@ -444,7 +444,8 @@ export class ExtHostSCM {
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
private _commands: ExtHostCommands
|
||||
private _commands: ExtHostCommands,
|
||||
@ILogService private logService: ILogService
|
||||
) {
|
||||
this._proxy = mainContext.get(MainContext.MainThreadSCM);
|
||||
|
||||
@@ -487,8 +488,9 @@ export class ExtHostSCM {
|
||||
});
|
||||
}
|
||||
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, extension, id, label, rootUri) => `${msg}(${extension.id}, ${id}, ${label}, ${rootUri})`)
|
||||
createSourceControl(extension: IExtensionDescription, id: string, label: string, rootUri: vscode.Uri | undefined): vscode.SourceControl {
|
||||
this.logService.trace('ExtHostSCM#createSourceControl', extension.id, id, label, rootUri);
|
||||
|
||||
const handle = ExtHostSCM._handlePool++;
|
||||
const sourceControl = new ExtHostSourceControl(this._proxy, this._commands, id, label, rootUri);
|
||||
this._sourceControls.set(handle, sourceControl);
|
||||
@@ -501,8 +503,9 @@ export class ExtHostSCM {
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, extension) => `${msg}(${extension.id})`)
|
||||
getLastInputBox(extension: IExtensionDescription): ExtHostSCMInputBox {
|
||||
this.logService.trace('ExtHostSCM#getLastInputBox', extension.id);
|
||||
|
||||
const sourceControls = this._sourceControlsByExtension.get(extension.id);
|
||||
const sourceControl = sourceControls && sourceControls[sourceControls.length - 1];
|
||||
const inputBox = sourceControl && sourceControl.inputBox;
|
||||
@@ -510,8 +513,9 @@ export class ExtHostSCM {
|
||||
return inputBox;
|
||||
}
|
||||
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, handle, uri) => `${msg}(${handle}, ${uri})`)
|
||||
$provideOriginalResource(sourceControlHandle: number, uri: URI): TPromise<URI> {
|
||||
this.logService.trace('ExtHostSCM#$provideOriginalResource', sourceControlHandle, uri);
|
||||
|
||||
const sourceControl = this._sourceControls.get(sourceControlHandle);
|
||||
|
||||
if (!sourceControl || !sourceControl.quickDiffProvider) {
|
||||
@@ -524,8 +528,9 @@ export class ExtHostSCM {
|
||||
});
|
||||
}
|
||||
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, handle) => `${msg}(${handle})`)
|
||||
$onInputBoxValueChange(sourceControlHandle: number, value: string): TPromise<void> {
|
||||
this.logService.trace('ExtHostSCM#$onInputBoxValueChange', sourceControlHandle);
|
||||
|
||||
const sourceControl = this._sourceControls.get(sourceControlHandle);
|
||||
|
||||
if (!sourceControl) {
|
||||
@@ -536,8 +541,9 @@ export class ExtHostSCM {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, h1, h2, h3) => `${msg}(${h1}, ${h2}, ${h3})`)
|
||||
async $executeResourceCommand(sourceControlHandle: number, groupHandle: number, handle: number): TPromise<void> {
|
||||
this.logService.trace('ExtHostSCM#$executeResourceCommand', sourceControlHandle, groupHandle, handle);
|
||||
|
||||
const sourceControl = this._sourceControls.get(sourceControlHandle);
|
||||
|
||||
if (!sourceControl) {
|
||||
|
||||
Reference in New Issue
Block a user