@codingame/monaco-vscode-output-service-override 4.4.1 → 4.5.0-improve-code-splitting.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/output.js +3 -2
- package/package.json +8 -5
- package/vscode/src/vs/workbench/contrib/output/browser/output.contribution.js +17 -13
- package/vscode/src/vs/workbench/contrib/output/browser/outputLinkProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/output/browser/outputServices.js +9 -8
- package/vscode/src/vs/workbench/contrib/output/browser/outputView.js +12 -12
- package/vscode/src/vs/workbench/contrib/output/common/outputChannelModel.js +328 -0
- package/vscode/src/vs/workbench/contrib/output/common/outputChannelModelService.js +32 -0
package/output.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
2
|
import { OutputService } from './vscode/src/vs/workbench/contrib/output/browser/outputServices.js';
|
|
3
|
-
import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
4
|
-
import {
|
|
3
|
+
import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output.service';
|
|
4
|
+
import { OutputChannelModelService } from './vscode/src/vs/workbench/contrib/output/common/outputChannelModelService.js';
|
|
5
|
+
import { IOutputChannelModelService } from 'vscode/vscode/vs/workbench/contrib/output/common/outputChannelModelService.service';
|
|
5
6
|
import getServiceOverride$1 from '@codingame/monaco-vscode-log-service-override';
|
|
6
7
|
import './vscode/src/vs/workbench/contrib/output/browser/output.contribution.js';
|
|
7
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-output-service-override",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0-improve-code-splitting.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -17,16 +17,19 @@
|
|
|
17
17
|
"main": "index.js",
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@4.4.1",
|
|
22
|
-
"@codingame/monaco-vscode-log-service-override": "4.4.1"
|
|
23
|
-
},
|
|
24
20
|
"exports": {
|
|
25
21
|
".": {
|
|
26
22
|
"default": "./index.js"
|
|
27
23
|
},
|
|
24
|
+
"./vscode/*": {
|
|
25
|
+
"default": "./vscode/src/*.js"
|
|
26
|
+
},
|
|
28
27
|
"./worker": {
|
|
29
28
|
"default": "./worker.js"
|
|
30
29
|
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"vscode": "npm:@codingame/monaco-vscode-api@4.5.0-improve-code-splitting.1",
|
|
33
|
+
"@codingame/monaco-vscode-log-service-override": "4.5.0-improve-code-splitting.1"
|
|
31
34
|
}
|
|
32
35
|
}
|
|
@@ -6,25 +6,29 @@ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
|
6
6
|
import { registerAction2, Action2, MenuId, MenuRegistry } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
7
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
8
8
|
import './outputServices.js';
|
|
9
|
-
import { OUTPUT_MODE_ID, OUTPUT_MIME, LOG_MODE_ID, LOG_MIME, OUTPUT_VIEW_ID,
|
|
9
|
+
import { OUTPUT_MODE_ID, OUTPUT_MIME, LOG_MODE_ID, LOG_MIME, OUTPUT_VIEW_ID, ACTIVE_OUTPUT_CHANNEL_CONTEXT, Extensions as Extensions$1, CONTEXT_IN_OUTPUT, CONTEXT_OUTPUT_SCROLL_LOCK, CONTEXT_ACTIVE_FILE_OUTPUT, CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE, CONTEXT_ACTIVE_OUTPUT_LEVEL, CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
10
|
+
import { IOutputService } from 'vscode/vscode/vs/workbench/services/output/common/output.service';
|
|
10
11
|
import { OutputViewPane } from './outputView.js';
|
|
11
|
-
import { Extensions as Extensions$
|
|
12
|
+
import { Extensions as Extensions$2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
12
13
|
import { Extensions } from 'vscode/vscode/vs/workbench/common/views';
|
|
13
|
-
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
|
|
14
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
14
15
|
import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
15
|
-
import { Extensions as Extensions$
|
|
16
|
-
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput';
|
|
17
|
-
import {
|
|
16
|
+
import { Extensions as Extensions$3 } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
17
|
+
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
18
|
+
import { AUX_WINDOW_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
19
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
18
20
|
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
19
21
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
20
22
|
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
21
23
|
import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
22
24
|
import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
|
|
23
25
|
import { Disposable, toDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
24
|
-
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
26
|
+
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
27
|
+
import { AccessibilitySignal } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService';
|
|
28
|
+
import { IAccessibilitySignalService } from 'vscode/vscode/vs/platform/accessibilitySignal/browser/accessibilitySignalService.service';
|
|
29
|
+
import { LogLevelToLocalizedString, LogLevelToString, LogLevel } from 'vscode/vscode/vs/platform/log/common/log';
|
|
30
|
+
import { ILoggerService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
31
|
+
import { IDefaultLogLevelsService } from 'vscode/vscode/vs/workbench/contrib/logs/common/defaultLogLevels.service';
|
|
28
32
|
|
|
29
33
|
ModesRegistry.registerLanguage({
|
|
30
34
|
id: OUTPUT_MODE_ID,
|
|
@@ -159,7 +163,7 @@ let OutputContribution = class OutputContribution extends Disposable {
|
|
|
159
163
|
}
|
|
160
164
|
};
|
|
161
165
|
registerOutputChannels(this.outputService.getChannelDescriptors());
|
|
162
|
-
const outputChannelRegistry = ( Registry.as(Extensions$
|
|
166
|
+
const outputChannelRegistry = ( Registry.as(Extensions$1.OutputChannels));
|
|
163
167
|
this._register(outputChannelRegistry.onDidRegisterChannel(e => {
|
|
164
168
|
const channel = this.outputService.getChannelDescriptor(e);
|
|
165
169
|
if (channel) {
|
|
@@ -588,8 +592,8 @@ OutputContribution = ( __decorate([
|
|
|
588
592
|
( __param(1, IEditorService)),
|
|
589
593
|
( __param(2, IFilesConfigurationService))
|
|
590
594
|
], OutputContribution));
|
|
591
|
-
( Registry.as(Extensions$
|
|
592
|
-
( Registry.as(Extensions$
|
|
595
|
+
( Registry.as(Extensions$2.Workbench)).registerWorkbenchContribution(OutputContribution, 3 );
|
|
596
|
+
( Registry.as(Extensions$3.Configuration)).registerConfiguration({
|
|
593
597
|
id: 'output',
|
|
594
598
|
order: 30,
|
|
595
599
|
title: ( localizeWithPath(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
3
3
|
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
4
|
-
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
4
|
+
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
5
5
|
import { OUTPUT_MODE_ID, LOG_MODE_ID } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
6
6
|
import { createWebWorker } from 'vscode/vscode/vs/editor/browser/services/webWorker';
|
|
7
7
|
import { dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
@@ -3,19 +3,20 @@ import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
|
3
3
|
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
4
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
5
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
6
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
7
7
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
8
8
|
import { OUTPUT_SCHEME, LOG_MIME, OUTPUT_MIME, ACTIVE_OUTPUT_CHANNEL_CONTEXT, CONTEXT_ACTIVE_FILE_OUTPUT, CONTEXT_ACTIVE_OUTPUT_LEVEL_SETTABLE, CONTEXT_ACTIVE_OUTPUT_LEVEL, CONTEXT_ACTIVE_OUTPUT_LEVEL_IS_DEFAULT, Extensions, OUTPUT_VIEW_ID } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
9
9
|
import { OutputLinkProvider } from './outputLinkProvider.js';
|
|
10
10
|
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
11
|
+
import { LogLevelToString } from 'vscode/vscode/vs/platform/log/common/log';
|
|
12
|
+
import { ILogService, ILoggerService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
13
|
+
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
14
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
15
|
+
import { IOutputChannelModelService } from 'vscode/vscode/vs/workbench/contrib/output/common/outputChannelModelService.service';
|
|
15
16
|
import { ILanguageService } from 'vscode/vscode/vs/editor/common/languages/language';
|
|
16
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
17
|
-
import { SetLogLevelAction } from 'vscode/vscode/vs/workbench/contrib/logs/common/logsActions';
|
|
18
|
-
import { IDefaultLogLevelsService } from 'vscode/vscode/vs/workbench/contrib/logs/common/defaultLogLevels';
|
|
17
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
18
|
+
import { SetLogLevelAction } from '@codingame/monaco-vscode-log-service-override/vscode/vs/workbench/contrib/logs/common/logsActions';
|
|
19
|
+
import { IDefaultLogLevelsService } from 'vscode/vscode/vs/workbench/contrib/logs/common/defaultLogLevels.service';
|
|
19
20
|
|
|
20
21
|
const OUTPUT_ACTIVE_CHANNEL_KEY = 'output.activechannel';
|
|
21
22
|
let OutputChannel = class OutputChannel extends Disposable {
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import './output.css.js';
|
|
3
3
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
5
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
4
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
5
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
6
6
|
import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
7
7
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
8
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
9
9
|
import { AbstractTextResourceEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/textResourceEditor';
|
|
10
10
|
import { CONTEXT_OUTPUT_SCROLL_LOCK, OUTPUT_VIEW_ID, CONTEXT_IN_OUTPUT } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
11
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
12
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
13
|
-
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
14
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
11
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
12
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
13
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
14
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
15
15
|
import { ViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
16
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
17
|
-
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
18
|
-
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
16
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
17
|
+
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
18
|
+
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
|
|
19
19
|
import { TextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
|
|
20
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
20
|
+
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
21
21
|
import { Dimension } from 'vscode/vscode/vs/base/browser/dom';
|
|
22
22
|
import { createCancelablePromise } from 'vscode/vscode/vs/base/common/async';
|
|
23
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
23
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
24
24
|
import { ResourceContextKey } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
25
25
|
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
26
26
|
import { computeEditorAriaLabel } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
3
|
+
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
4
|
+
import { IEditorWorkerService } from 'vscode/vscode/vs/editor/common/services/editorWorker';
|
|
5
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
6
|
+
import { ThrottledDelayer, Promises } from 'vscode/vscode/vs/base/common/async';
|
|
7
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
8
|
+
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
9
|
+
import { Disposable, MutableDisposable, toDisposable, dispose } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
10
|
+
import { isNumber } from 'vscode/vscode/vs/base/common/types';
|
|
11
|
+
import { EditOperation } from 'vscode/vscode/vs/editor/common/core/editOperation';
|
|
12
|
+
import { Position } from 'vscode/vscode/vs/editor/common/core/position';
|
|
13
|
+
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
14
|
+
import { VSBuffer } from 'vscode/vscode/vs/base/common/buffer';
|
|
15
|
+
import { ILogService, ILoggerService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
16
|
+
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
17
|
+
import { OutputChannelUpdateMode } from 'vscode/vscode/vs/workbench/services/output/common/output';
|
|
18
|
+
import { isCancellationError } from 'vscode/vscode/vs/base/common/errors';
|
|
19
|
+
|
|
20
|
+
class OutputFileListener extends Disposable {
|
|
21
|
+
constructor(file, fileService, logService) {
|
|
22
|
+
super();
|
|
23
|
+
this.file = file;
|
|
24
|
+
this.fileService = fileService;
|
|
25
|
+
this.logService = logService;
|
|
26
|
+
this._onDidContentChange = ( new Emitter());
|
|
27
|
+
this.onDidContentChange = this._onDidContentChange.event;
|
|
28
|
+
this.watching = false;
|
|
29
|
+
this.syncDelayer = ( new ThrottledDelayer(500));
|
|
30
|
+
}
|
|
31
|
+
watch(eTag) {
|
|
32
|
+
if (!this.watching) {
|
|
33
|
+
this.etag = eTag;
|
|
34
|
+
this.poll();
|
|
35
|
+
this.logService.trace('Started polling', ( this.file.toString()));
|
|
36
|
+
this.watching = true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
poll() {
|
|
40
|
+
const loop = () => this.doWatch().then(() => this.poll());
|
|
41
|
+
this.syncDelayer.trigger(loop).catch(error => {
|
|
42
|
+
if (!isCancellationError(error)) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async doWatch() {
|
|
48
|
+
const stat = await this.fileService.stat(this.file);
|
|
49
|
+
if (stat.etag !== this.etag) {
|
|
50
|
+
this.etag = stat.etag;
|
|
51
|
+
this._onDidContentChange.fire(stat.size);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
unwatch() {
|
|
55
|
+
if (this.watching) {
|
|
56
|
+
this.syncDelayer.cancel();
|
|
57
|
+
this.watching = false;
|
|
58
|
+
this.logService.trace('Stopped polling', ( this.file.toString()));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
dispose() {
|
|
62
|
+
this.unwatch();
|
|
63
|
+
super.dispose();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
let FileOutputChannelModel = class FileOutputChannelModel extends Disposable {
|
|
67
|
+
constructor(modelUri, language, file, fileService, modelService, logService, editorWorkerService) {
|
|
68
|
+
super();
|
|
69
|
+
this.modelUri = modelUri;
|
|
70
|
+
this.language = language;
|
|
71
|
+
this.file = file;
|
|
72
|
+
this.fileService = fileService;
|
|
73
|
+
this.modelService = modelService;
|
|
74
|
+
this.editorWorkerService = editorWorkerService;
|
|
75
|
+
this._onDispose = this._register(( new Emitter()));
|
|
76
|
+
this.onDispose = this._onDispose.event;
|
|
77
|
+
this.etag = '';
|
|
78
|
+
this.loadModelPromise = null;
|
|
79
|
+
this.model = null;
|
|
80
|
+
this.modelUpdateInProgress = false;
|
|
81
|
+
this.modelUpdateCancellationSource = this._register(( new MutableDisposable()));
|
|
82
|
+
this.appendThrottler = this._register(( new ThrottledDelayer(300)));
|
|
83
|
+
this.startOffset = 0;
|
|
84
|
+
this.endOffset = 0;
|
|
85
|
+
this.fileHandler = this._register(( new OutputFileListener(this.file, this.fileService, logService)));
|
|
86
|
+
this._register(this.fileHandler.onDidContentChange(size => this.onDidContentChange(size)));
|
|
87
|
+
this._register(toDisposable(() => this.fileHandler.unwatch()));
|
|
88
|
+
}
|
|
89
|
+
append(message) {
|
|
90
|
+
throw new Error('Not supported');
|
|
91
|
+
}
|
|
92
|
+
replace(message) {
|
|
93
|
+
throw new Error('Not supported');
|
|
94
|
+
}
|
|
95
|
+
clear() {
|
|
96
|
+
this.update(OutputChannelUpdateMode.Clear, this.endOffset, true);
|
|
97
|
+
}
|
|
98
|
+
update(mode, till, immediate) {
|
|
99
|
+
const loadModelPromise = this.loadModelPromise ? this.loadModelPromise : Promise.resolve();
|
|
100
|
+
loadModelPromise.then(() => this.doUpdate(mode, till, immediate));
|
|
101
|
+
}
|
|
102
|
+
loadModel() {
|
|
103
|
+
this.loadModelPromise = Promises.withAsyncBody(async (c, e) => {
|
|
104
|
+
try {
|
|
105
|
+
let content = '';
|
|
106
|
+
if (await this.fileService.exists(this.file)) {
|
|
107
|
+
const fileContent = await this.fileService.readFile(this.file, { position: this.startOffset });
|
|
108
|
+
this.endOffset = this.startOffset + fileContent.value.byteLength;
|
|
109
|
+
this.etag = fileContent.etag;
|
|
110
|
+
content = ( fileContent.value.toString());
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.startOffset = 0;
|
|
114
|
+
this.endOffset = 0;
|
|
115
|
+
}
|
|
116
|
+
c(this.createModel(content));
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
e(error);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return this.loadModelPromise;
|
|
123
|
+
}
|
|
124
|
+
createModel(content) {
|
|
125
|
+
if (this.model) {
|
|
126
|
+
this.model.setValue(content);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
this.model = this.modelService.createModel(content, this.language, this.modelUri);
|
|
130
|
+
this.fileHandler.watch(this.etag);
|
|
131
|
+
const disposable = this.model.onWillDispose(() => {
|
|
132
|
+
this.cancelModelUpdate();
|
|
133
|
+
this.fileHandler.unwatch();
|
|
134
|
+
this.model = null;
|
|
135
|
+
dispose(disposable);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return this.model;
|
|
139
|
+
}
|
|
140
|
+
doUpdate(mode, till, immediate) {
|
|
141
|
+
if (mode === OutputChannelUpdateMode.Clear || mode === OutputChannelUpdateMode.Replace) {
|
|
142
|
+
this.startOffset = this.endOffset = isNumber(till) ? till : this.endOffset;
|
|
143
|
+
this.cancelModelUpdate();
|
|
144
|
+
}
|
|
145
|
+
if (!this.model) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
this.modelUpdateInProgress = true;
|
|
149
|
+
if (!this.modelUpdateCancellationSource.value) {
|
|
150
|
+
this.modelUpdateCancellationSource.value = ( new CancellationTokenSource());
|
|
151
|
+
}
|
|
152
|
+
const token = this.modelUpdateCancellationSource.value.token;
|
|
153
|
+
if (mode === OutputChannelUpdateMode.Clear) {
|
|
154
|
+
this.clearContent(this.model);
|
|
155
|
+
}
|
|
156
|
+
else if (mode === OutputChannelUpdateMode.Replace) {
|
|
157
|
+
this.replacePromise = this.replaceContent(this.model, token).finally(() => this.replacePromise = undefined);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
this.appendContent(this.model, immediate, token);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
clearContent(model) {
|
|
164
|
+
this.doUpdateModel(model, [EditOperation.delete(model.getFullModelRange())], VSBuffer.fromString(''));
|
|
165
|
+
}
|
|
166
|
+
appendContent(model, immediate, token) {
|
|
167
|
+
this.appendThrottler.trigger(async () => {
|
|
168
|
+
if (token.isCancellationRequested) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
if (this.replacePromise) {
|
|
172
|
+
try {
|
|
173
|
+
await this.replacePromise;
|
|
174
|
+
}
|
|
175
|
+
catch (e) { }
|
|
176
|
+
if (token.isCancellationRequested) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const contentToAppend = await this.getContentToUpdate();
|
|
181
|
+
if (token.isCancellationRequested) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const lastLine = model.getLineCount();
|
|
185
|
+
const lastLineMaxColumn = model.getLineMaxColumn(lastLine);
|
|
186
|
+
const edits = [EditOperation.insert(( new Position(lastLine, lastLineMaxColumn)), ( contentToAppend.toString()))];
|
|
187
|
+
this.doUpdateModel(model, edits, contentToAppend);
|
|
188
|
+
}, immediate ? 0 : undefined).catch(error => {
|
|
189
|
+
if (!isCancellationError(error)) {
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
async replaceContent(model, token) {
|
|
195
|
+
const contentToReplace = await this.getContentToUpdate();
|
|
196
|
+
if (token.isCancellationRequested) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const edits = await this.getReplaceEdits(model, ( contentToReplace.toString()));
|
|
200
|
+
if (token.isCancellationRequested) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
this.doUpdateModel(model, edits, contentToReplace);
|
|
204
|
+
}
|
|
205
|
+
async getReplaceEdits(model, contentToReplace) {
|
|
206
|
+
if (!contentToReplace) {
|
|
207
|
+
return [EditOperation.delete(model.getFullModelRange())];
|
|
208
|
+
}
|
|
209
|
+
if (contentToReplace !== model.getValue()) {
|
|
210
|
+
const edits = await this.editorWorkerService.computeMoreMinimalEdits(model.uri, [{ text: ( contentToReplace.toString()), range: model.getFullModelRange() }]);
|
|
211
|
+
if (edits?.length) {
|
|
212
|
+
return ( edits.map(edit => EditOperation.replace(Range.lift(edit.range), edit.text)));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
doUpdateModel(model, edits, content) {
|
|
218
|
+
if (edits.length) {
|
|
219
|
+
model.applyEdits(edits);
|
|
220
|
+
}
|
|
221
|
+
this.endOffset = this.endOffset + content.byteLength;
|
|
222
|
+
this.modelUpdateInProgress = false;
|
|
223
|
+
}
|
|
224
|
+
cancelModelUpdate() {
|
|
225
|
+
this.modelUpdateCancellationSource.value?.cancel();
|
|
226
|
+
this.modelUpdateCancellationSource.value = undefined;
|
|
227
|
+
this.appendThrottler.cancel();
|
|
228
|
+
this.replacePromise = undefined;
|
|
229
|
+
this.modelUpdateInProgress = false;
|
|
230
|
+
}
|
|
231
|
+
async getContentToUpdate() {
|
|
232
|
+
const content = await this.fileService.readFile(this.file, { position: this.endOffset });
|
|
233
|
+
this.etag = content.etag;
|
|
234
|
+
return content.value;
|
|
235
|
+
}
|
|
236
|
+
onDidContentChange(size) {
|
|
237
|
+
if (this.model) {
|
|
238
|
+
if (!this.modelUpdateInProgress) {
|
|
239
|
+
if (isNumber(size) && this.endOffset > size) {
|
|
240
|
+
this.update(OutputChannelUpdateMode.Clear, 0, true);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
this.update(OutputChannelUpdateMode.Append, undefined, false );
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
isVisible() {
|
|
247
|
+
return !!this.model;
|
|
248
|
+
}
|
|
249
|
+
dispose() {
|
|
250
|
+
this._onDispose.fire();
|
|
251
|
+
super.dispose();
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
FileOutputChannelModel = ( __decorate([
|
|
255
|
+
( __param(3, IFileService)),
|
|
256
|
+
( __param(4, IModelService)),
|
|
257
|
+
( __param(5, ILogService)),
|
|
258
|
+
( __param(6, IEditorWorkerService))
|
|
259
|
+
], FileOutputChannelModel));
|
|
260
|
+
let OutputChannelBackedByFile = class OutputChannelBackedByFile extends FileOutputChannelModel {
|
|
261
|
+
constructor(id, modelUri, language, file, fileService, modelService, loggerService, logService, editorWorkerService) {
|
|
262
|
+
super(modelUri, language, file, fileService, modelService, logService, editorWorkerService);
|
|
263
|
+
this.logger = loggerService.createLogger(file, { logLevel: 'always', donotRotate: true, donotUseFormatters: true, hidden: true });
|
|
264
|
+
this._offset = 0;
|
|
265
|
+
}
|
|
266
|
+
append(message) {
|
|
267
|
+
this.write(message);
|
|
268
|
+
this.update(OutputChannelUpdateMode.Append, undefined, this.isVisible());
|
|
269
|
+
}
|
|
270
|
+
replace(message) {
|
|
271
|
+
const till = this._offset;
|
|
272
|
+
this.write(message);
|
|
273
|
+
this.update(OutputChannelUpdateMode.Replace, till, true);
|
|
274
|
+
}
|
|
275
|
+
write(content) {
|
|
276
|
+
this._offset += VSBuffer.fromString(content).byteLength;
|
|
277
|
+
this.logger.info(content);
|
|
278
|
+
if (this.isVisible()) {
|
|
279
|
+
this.logger.flush();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
OutputChannelBackedByFile = ( __decorate([
|
|
284
|
+
( __param(4, IFileService)),
|
|
285
|
+
( __param(5, IModelService)),
|
|
286
|
+
( __param(6, ILoggerService)),
|
|
287
|
+
( __param(7, ILogService)),
|
|
288
|
+
( __param(8, IEditorWorkerService))
|
|
289
|
+
], OutputChannelBackedByFile));
|
|
290
|
+
let DelegatedOutputChannelModel = class DelegatedOutputChannelModel extends Disposable {
|
|
291
|
+
constructor(id, modelUri, language, outputDir, instantiationService, fileService) {
|
|
292
|
+
super();
|
|
293
|
+
this.instantiationService = instantiationService;
|
|
294
|
+
this.fileService = fileService;
|
|
295
|
+
this._onDispose = this._register(( new Emitter()));
|
|
296
|
+
this.onDispose = this._onDispose.event;
|
|
297
|
+
this.outputChannelModel = this.createOutputChannelModel(id, modelUri, language, outputDir);
|
|
298
|
+
}
|
|
299
|
+
async createOutputChannelModel(id, modelUri, language, outputDirPromise) {
|
|
300
|
+
const outputDir = await outputDirPromise;
|
|
301
|
+
const file = joinPath(outputDir, `${id.replace(/[\\/:\*\?"<>\|]/g, '')}.log`);
|
|
302
|
+
await this.fileService.createFile(file);
|
|
303
|
+
const outputChannelModel = this._register(this.instantiationService.createInstance(OutputChannelBackedByFile, id, modelUri, language, file));
|
|
304
|
+
this._register(outputChannelModel.onDispose(() => this._onDispose.fire()));
|
|
305
|
+
return outputChannelModel;
|
|
306
|
+
}
|
|
307
|
+
append(output) {
|
|
308
|
+
this.outputChannelModel.then(outputChannelModel => outputChannelModel.append(output));
|
|
309
|
+
}
|
|
310
|
+
update(mode, till, immediate) {
|
|
311
|
+
this.outputChannelModel.then(outputChannelModel => outputChannelModel.update(mode, till, immediate));
|
|
312
|
+
}
|
|
313
|
+
loadModel() {
|
|
314
|
+
return this.outputChannelModel.then(outputChannelModel => outputChannelModel.loadModel());
|
|
315
|
+
}
|
|
316
|
+
clear() {
|
|
317
|
+
this.outputChannelModel.then(outputChannelModel => outputChannelModel.clear());
|
|
318
|
+
}
|
|
319
|
+
replace(value) {
|
|
320
|
+
this.outputChannelModel.then(outputChannelModel => outputChannelModel.replace(value));
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
DelegatedOutputChannelModel = ( __decorate([
|
|
324
|
+
( __param(4, IInstantiationService)),
|
|
325
|
+
( __param(5, IFileService))
|
|
326
|
+
], DelegatedOutputChannelModel));
|
|
327
|
+
|
|
328
|
+
export { DelegatedOutputChannelModel, FileOutputChannelModel };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
3
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
5
|
+
import { toLocalISOString } from 'vscode/vscode/vs/base/common/date';
|
|
6
|
+
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
7
|
+
import { FileOutputChannelModel, DelegatedOutputChannelModel } from './outputChannelModel.js';
|
|
8
|
+
|
|
9
|
+
let OutputChannelModelService = class OutputChannelModelService {
|
|
10
|
+
constructor(fileService, instantiationService, environmentService) {
|
|
11
|
+
this.fileService = fileService;
|
|
12
|
+
this.instantiationService = instantiationService;
|
|
13
|
+
this._outputDir = null;
|
|
14
|
+
this.outputLocation = joinPath(environmentService.windowLogsPath, `output_${toLocalISOString(( new Date())).replace(/-|:|\.\d+Z$/g, '')}`);
|
|
15
|
+
}
|
|
16
|
+
createOutputChannelModel(id, modelUri, language, file) {
|
|
17
|
+
return file ? this.instantiationService.createInstance(FileOutputChannelModel, modelUri, language, file) : this.instantiationService.createInstance(DelegatedOutputChannelModel, id, modelUri, language, this.outputDir);
|
|
18
|
+
}
|
|
19
|
+
get outputDir() {
|
|
20
|
+
if (!this._outputDir) {
|
|
21
|
+
this._outputDir = this.fileService.createFolder(this.outputLocation).then(() => this.outputLocation);
|
|
22
|
+
}
|
|
23
|
+
return this._outputDir;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
OutputChannelModelService = ( __decorate([
|
|
27
|
+
( __param(0, IFileService)),
|
|
28
|
+
( __param(1, IInstantiationService)),
|
|
29
|
+
( __param(2, IWorkbenchEnvironmentService))
|
|
30
|
+
], OutputChannelModelService));
|
|
31
|
+
|
|
32
|
+
export { OutputChannelModelService };
|