提交 04750498 编写于 作者: S Sandeep Somavarapu

Fix #43271

上级 ca58c21b
......@@ -24,11 +24,6 @@
}
],
"grammars": [
{
"language": "Log",
"scopeName": "text.log",
"path": "./syntaxes/log.tmLanguage.json"
},
{
"language": "log",
"scopeName": "text.log",
......
......@@ -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
......
......@@ -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<ILink[]> => {
return wireCancellationToken(token, this.provideLinks(model.uri));
}
......
......@@ -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<PanelRegistry>(Extensions.Panels).registerPanel(new PanelDescriptor(
OutputPanel,
......
......@@ -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()));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册