mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 11:08:51 +01:00
Merge pull request #39365 from Microsoft/joao/spdlog
Introduce a log service across all processes
This commit is contained in:
@@ -57,7 +57,6 @@ import { FileChangeType, FileType } from 'vs/platform/files/common/files';
|
||||
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 { ILogService } from 'vs/platform/log/common/log';
|
||||
import { isFalsyOrEmpty } from 'vs/base/common/arrays';
|
||||
|
||||
export interface IExtensionApiFactory {
|
||||
@@ -82,8 +81,7 @@ export function createApiFactory(
|
||||
threadService: ExtHostThreadService,
|
||||
extHostWorkspace: ExtHostWorkspace,
|
||||
extHostConfiguration: ExtHostConfiguration,
|
||||
extensionService: ExtHostExtensionService,
|
||||
logService: ILogService
|
||||
extensionService: ExtHostExtensionService
|
||||
): IExtensionApiFactory {
|
||||
|
||||
// Addressable instances
|
||||
@@ -94,7 +92,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, logService));
|
||||
const extHostCommands = threadService.set(ExtHostContext.ExtHostCommands, new ExtHostCommands(threadService, extHostHeapService));
|
||||
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));
|
||||
@@ -105,7 +103,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, logService));
|
||||
const extHostSCM = threadService.set(ExtHostContext.ExtHostSCM, new ExtHostSCM(threadService, extHostCommands));
|
||||
const extHostTask = threadService.set(ExtHostContext.ExtHostTask, new ExtHostTask(threadService, extHostWorkspace));
|
||||
const extHostWindow = threadService.set(ExtHostContext.ExtHostWindow, new ExtHostWindow(threadService));
|
||||
threadService.set(ExtHostContext.ExtHostExtensionService, extensionService);
|
||||
|
||||
@@ -76,6 +76,7 @@ export interface IInitData {
|
||||
extensions: IExtensionDescription[];
|
||||
configuration: IConfigurationInitData;
|
||||
telemetryInfo: ITelemetryInfo;
|
||||
windowId: number;
|
||||
args: ParsedArgs;
|
||||
execPath: string;
|
||||
}
|
||||
|
||||
@@ -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 { ILogService, log, LogLevel } from 'vs/platform/log/common/log';
|
||||
import { log, LogLevel } from 'vs/platform/log/common/log';
|
||||
|
||||
interface CommandHandler {
|
||||
callback: Function;
|
||||
@@ -36,9 +36,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
heapService: ExtHostHeapService,
|
||||
// @ts-ignore
|
||||
@ILogService private logService: ILogService
|
||||
heapService: ExtHostHeapService
|
||||
) {
|
||||
this._proxy = mainContext.get(MainContext.MainThreadCommands);
|
||||
this._converter = new CommandsConverter(this, heapService);
|
||||
@@ -52,7 +50,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
this._argumentProcessors.push(processor);
|
||||
}
|
||||
|
||||
@log(LogLevel.TRACE, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
|
||||
@log(LogLevel.Trace, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
|
||||
registerCommand(id: string, callback: <T>(...args: any[]) => T | Thenable<T>, thisArg?: any, description?: ICommandHandlerDescription): extHostTypes.Disposable {
|
||||
|
||||
if (!id.trim().length) {
|
||||
@@ -73,7 +71,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
});
|
||||
}
|
||||
|
||||
@log(LogLevel.TRACE, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
|
||||
@log(LogLevel.Trace, 'ExtHostCommands', (msg, id) => `${msg}(${id})`)
|
||||
executeCommand<T>(id: string, ...args: any[]): Thenable<T> {
|
||||
|
||||
if (this._commands.has(id)) {
|
||||
@@ -138,7 +136,7 @@ export class ExtHostCommands implements ExtHostCommandsShape {
|
||||
}
|
||||
}
|
||||
|
||||
@log(LogLevel.TRACE, 'ExtHostCommands', (msg, filterUnderscoreCommands) => `${msg}(${filterUnderscoreCommands})`)
|
||||
@log(LogLevel.Trace, 'ExtHostCommands', (msg, filterUnderscoreCommands) => `${msg}(${filterUnderscoreCommands})`)
|
||||
getCommands(filterUnderscoreCommands: boolean = false): Thenable<string[]> {
|
||||
return this._proxy.$getCommands().then(result => {
|
||||
if (filterUnderscoreCommands) {
|
||||
|
||||
@@ -21,7 +21,6 @@ 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 {
|
||||
|
||||
@@ -126,8 +125,7 @@ export class ExtHostExtensionService implements ExtHostExtensionServiceShape {
|
||||
constructor(initData: IInitData,
|
||||
threadService: ExtHostThreadService,
|
||||
extHostWorkspace: ExtHostWorkspace,
|
||||
extHostConfiguration: ExtHostConfiguration,
|
||||
logService: ILogService
|
||||
extHostConfiguration: ExtHostConfiguration
|
||||
) {
|
||||
this._barrier = new Barrier();
|
||||
this._registry = new ExtensionDescriptionRegistry(initData.extensions);
|
||||
@@ -139,7 +137,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, logService);
|
||||
const apiFactory = createApiFactory(initData, threadService, extHostWorkspace, extHostConfiguration, this);
|
||||
|
||||
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, ILogService } from 'vs/platform/log/common/log';
|
||||
import { log, LogLevel } from 'vs/platform/log/common/log';
|
||||
|
||||
type ProviderHandle = number;
|
||||
type GroupHandle = number;
|
||||
@@ -444,9 +444,7 @@ export class ExtHostSCM {
|
||||
|
||||
constructor(
|
||||
mainContext: IMainContext,
|
||||
private _commands: ExtHostCommands,
|
||||
// @ts-ignore
|
||||
@ILogService private logService: ILogService
|
||||
private _commands: ExtHostCommands
|
||||
) {
|
||||
this._proxy = mainContext.get(MainContext.MainThreadSCM);
|
||||
|
||||
@@ -489,7 +487,7 @@ export class ExtHostSCM {
|
||||
});
|
||||
}
|
||||
|
||||
@log(LogLevel.TRACE, 'ExtHostSCM', (msg, extension, id, label, rootUri) => `${msg}(${extension.id}, ${id}, ${label}, ${rootUri})`)
|
||||
@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 {
|
||||
const handle = ExtHostSCM._handlePool++;
|
||||
const sourceControl = new ExtHostSourceControl(this._proxy, this._commands, id, label, rootUri);
|
||||
@@ -503,7 +501,7 @@ export class ExtHostSCM {
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
@log(LogLevel.TRACE, 'ExtHostSCM', (msg, extension) => `${msg}(${extension.id})`)
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, extension) => `${msg}(${extension.id})`)
|
||||
getLastInputBox(extension: IExtensionDescription): ExtHostSCMInputBox {
|
||||
const sourceControls = this._sourceControlsByExtension.get(extension.id);
|
||||
const sourceControl = sourceControls && sourceControls[sourceControls.length - 1];
|
||||
@@ -512,7 +510,7 @@ export class ExtHostSCM {
|
||||
return inputBox;
|
||||
}
|
||||
|
||||
@log(LogLevel.TRACE, 'ExtHostSCM', (msg, handle, uri) => `${msg}(${handle}, ${uri})`)
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, handle, uri) => `${msg}(${handle}, ${uri})`)
|
||||
$provideOriginalResource(sourceControlHandle: number, uri: URI): TPromise<URI> {
|
||||
const sourceControl = this._sourceControls.get(sourceControlHandle);
|
||||
|
||||
@@ -526,7 +524,7 @@ export class ExtHostSCM {
|
||||
});
|
||||
}
|
||||
|
||||
@log(LogLevel.TRACE, 'ExtHostSCM', (msg, handle) => `${msg}(${handle})`)
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, handle) => `${msg}(${handle})`)
|
||||
$onInputBoxValueChange(sourceControlHandle: number, value: string): TPromise<void> {
|
||||
const sourceControl = this._sourceControls.get(sourceControlHandle);
|
||||
|
||||
@@ -538,7 +536,7 @@ export class ExtHostSCM {
|
||||
return TPromise.as(null);
|
||||
}
|
||||
|
||||
@log(LogLevel.TRACE, 'ExtHostSCM', (msg, h1, h2, h3) => `${msg}(${h1}, ${h2}, ${h3})`)
|
||||
@log(LogLevel.Trace, 'ExtHostSCM', (msg, h1, h2, h3) => `${msg}(${h1}, ${h2}, ${h3})`)
|
||||
async $executeResourceCommand(sourceControlHandle: number, groupHandle: number, handle: number): TPromise<void> {
|
||||
const sourceControl = this._sourceControls.get(sourceControlHandle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user