From 04750498693d138952be1c526a92923596372782 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Thu, 22 Feb 2018 10:58:32 +0100 Subject: [PATCH] Fix #43271 --- extensions/log/package.json | 5 ----- src/vs/workbench/parts/output/common/output.ts | 16 +++++++++++++--- .../parts/output/common/outputLinkProvider.ts | 4 ++-- .../electron-browser/output.contribution.ts | 10 +++++++++- .../output/electron-browser/outputServices.ts | 9 +++++---- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/extensions/log/package.json b/extensions/log/package.json index ab8b0da1c9d..b0c0122fd39 100644 --- a/extensions/log/package.json +++ b/extensions/log/package.json @@ -24,11 +24,6 @@ } ], "grammars": [ - { - "language": "Log", - "scopeName": "text.log", - "path": "./syntaxes/log.tmLanguage.json" - }, { "language": "log", "scopeName": "text.log", diff --git a/src/vs/workbench/parts/output/common/output.ts b/src/vs/workbench/parts/output/common/output.ts index 16786934caa..a81b9c68c42 100644 --- a/src/vs/workbench/parts/output/common/output.ts +++ b/src/vs/workbench/parts/output/common/output.ts @@ -22,14 +22,24 @@ export const OUTPUT_MIME = 'text/x-code-output'; export const OUTPUT_SCHEME = 'output'; /** - * Output resource scheme. + * Id used by the output editor. + */ +export const OUTPUT_MODE_ID = 'Log'; + +/** + * Mime type used by the log output editor. + */ +export const LOG_MIME = 'text/x-code-log-output'; + +/** + * Log resource scheme. */ export const LOG_SCHEME = 'log'; /** - * Id used by the output editor. + * Id used by the log output editor. */ -export const OUTPUT_MODE_ID = 'Log'; +export const LOG_MODE_ID = 'log'; /** * Output panel id diff --git a/src/vs/workbench/parts/output/common/outputLinkProvider.ts b/src/vs/workbench/parts/output/common/outputLinkProvider.ts index 8f2b9dba601..8014d8bd950 100644 --- a/src/vs/workbench/parts/output/common/outputLinkProvider.ts +++ b/src/vs/workbench/parts/output/common/outputLinkProvider.ts @@ -11,7 +11,7 @@ import { RunOnceScheduler, wireCancellationToken } from 'vs/base/common/async'; import { IModelService } from 'vs/editor/common/services/modelService'; import { LinkProviderRegistry, ILink } from 'vs/editor/common/modes'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; -import { OUTPUT_MODE_ID } from 'vs/workbench/parts/output/common/output'; +import { OUTPUT_MODE_ID, LOG_MODE_ID } from 'vs/workbench/parts/output/common/output'; import { MonacoWebWorker, createWebWorker } from 'vs/editor/common/services/webWorker'; import { ICreateData, OutputLinkComputer } from 'vs/workbench/parts/output/common/outputLinkComputer'; import { IDisposable, dispose } from 'vs/base/common/lifecycle'; @@ -44,7 +44,7 @@ export class OutputLinkProvider { const folders = this.contextService.getWorkspace().folders; if (folders.length > 0) { if (!this.linkProviderRegistration) { - this.linkProviderRegistration = LinkProviderRegistry.register({ language: OUTPUT_MODE_ID, scheme: '*' }, { + this.linkProviderRegistration = LinkProviderRegistry.register([{ language: OUTPUT_MODE_ID, scheme: '*' }, { language: LOG_MODE_ID, scheme: '*' }], { provideLinks: (model, token): Thenable => { return wireCancellationToken(token, this.provideLinks(model.uri)); } diff --git a/src/vs/workbench/parts/output/electron-browser/output.contribution.ts b/src/vs/workbench/parts/output/electron-browser/output.contribution.ts index e989b92d769..3f4518913ff 100644 --- a/src/vs/workbench/parts/output/electron-browser/output.contribution.ts +++ b/src/vs/workbench/parts/output/electron-browser/output.contribution.ts @@ -13,7 +13,7 @@ import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { OutputService, LogContentProvider } from 'vs/workbench/parts/output/electron-browser/outputServices'; import { ToggleOutputAction, ClearOutputAction } from 'vs/workbench/parts/output/browser/outputActions'; -import { OUTPUT_MODE_ID, OUTPUT_MIME, OUTPUT_PANEL_ID, IOutputService, CONTEXT_IN_OUTPUT, LOG_SCHEME, COMMAND_OPEN_LOG_VIEWER } from 'vs/workbench/parts/output/common/output'; +import { OUTPUT_MODE_ID, OUTPUT_MIME, OUTPUT_PANEL_ID, IOutputService, CONTEXT_IN_OUTPUT, LOG_SCHEME, COMMAND_OPEN_LOG_VIEWER, LOG_MODE_ID, LOG_MIME } from 'vs/workbench/parts/output/common/output'; import { PanelRegistry, Extensions, PanelDescriptor } from 'vs/workbench/browser/panel'; import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; @@ -39,6 +39,14 @@ ModesRegistry.registerLanguage({ mimetypes: [OUTPUT_MIME] }); +// Register Log Output Mode +ModesRegistry.registerLanguage({ + id: LOG_MODE_ID, + extensions: [], + aliases: [null], + mimetypes: [LOG_MIME] +}); + // Register Output Panel Registry.as(Extensions.Panels).registerPanel(new PanelDescriptor( OutputPanel, diff --git a/src/vs/workbench/parts/output/electron-browser/outputServices.ts b/src/vs/workbench/parts/output/electron-browser/outputServices.ts index 2b642f95a58..546e3855152 100644 --- a/src/vs/workbench/parts/output/electron-browser/outputServices.ts +++ b/src/vs/workbench/parts/output/electron-browser/outputServices.ts @@ -16,7 +16,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; import { Registry } from 'vs/platform/registry/common/platform'; import { EditorOptions } from 'vs/workbench/common/editor'; -import { IOutputChannelIdentifier, IOutputChannel, IOutputService, Extensions, OUTPUT_PANEL_ID, IOutputChannelRegistry, OUTPUT_SCHEME, OUTPUT_MIME, MAX_OUTPUT_LENGTH, LOG_SCHEME } from 'vs/workbench/parts/output/common/output'; +import { IOutputChannelIdentifier, IOutputChannel, IOutputService, Extensions, OUTPUT_PANEL_ID, IOutputChannelRegistry, OUTPUT_SCHEME, OUTPUT_MIME, MAX_OUTPUT_LENGTH, LOG_SCHEME, LOG_MIME } from 'vs/workbench/parts/output/common/output'; import { OutputPanel } from 'vs/workbench/parts/output/browser/outputPanel'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IModelService } from 'vs/editor/common/services/modelService'; @@ -134,6 +134,7 @@ abstract class AbstractFileOutputChannel extends Disposable { constructor( protected readonly outputChannelIdentifier: IOutputChannelIdentifier, private readonly modelUri: URI, + private mimeType: string, protected fileService: IFileService, protected modelService: IModelService, protected modeService: IModeService, @@ -166,7 +167,7 @@ abstract class AbstractFileOutputChannel extends Disposable { if (this.model) { this.model.setValue(content); } else { - this.model = this.modelService.createModel(content, this.modeService.getOrCreateMode(OUTPUT_MIME), this.modelUri); + this.model = this.modelService.createModel(content, this.modeService.getOrCreateMode(this.mimeType), this.modelUri); this.onModelCreated(this.model); const disposables: IDisposable[] = []; disposables.push(this.model.onWillDispose(() => { @@ -217,7 +218,7 @@ class OutputChannelBackedByFile extends AbstractFileOutputChannel implements Out @IModeService modeService: IModeService, @ILogService logService: ILogService ) { - super({ ...outputChannelIdentifier, file: URI.file(paths.join(outputDir, `${outputChannelIdentifier.id}.log`)) }, modelUri, fileService, modelService, modeService); + super({ ...outputChannelIdentifier, file: URI.file(paths.join(outputDir, `${outputChannelIdentifier.id}.log`)) }, modelUri, OUTPUT_MIME, fileService, modelService, modeService); // Use one rotating file to check for main file reset this.outputWriter = new RotatingLogger(this.id, this.file.fsPath, 1024 * 1024 * 30, 1); @@ -363,7 +364,7 @@ class FileOutputChannel extends AbstractFileOutputChannel implements OutputChann @IModeService modeService: IModeService, @ILogService logService: ILogService, ) { - super(outputChannelIdentifier, modelUri, fileService, modelService, modeService); + super(outputChannelIdentifier, modelUri, LOG_MIME, fileService, modelService, modeService); this.fileHandler = this._register(new OutputFileListener(this.file)); this._register(this.fileHandler.onDidContentChange(() => this.onDidContentChange())); -- GitLab