@codingame/monaco-vscode-debug-service-override 3.2.3 → 4.1.0
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/debug.js +4 -4
- package/package.json +2 -2
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/override/vs/platform/dialogs/common/dialogs.js +0 -8
- package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +0 -73
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +0 -1011
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +0 -970
- package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +0 -347
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +0 -324
- package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +0 -432
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +0 -1039
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +0 -649
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +0 -64
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +0 -636
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +0 -725
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +0 -398
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +0 -206
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +0 -80
- package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +0 -169
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +0 -1271
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +0 -1305
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +0 -115
- package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +0 -77
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +0 -307
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +0 -31
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +0 -378
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +0 -267
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +0 -808
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +0 -121
- package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +0 -141
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +0 -262
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +0 -669
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +0 -709
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +0 -992
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +0 -48
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +0 -348
- package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +0 -119
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +0 -763
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +0 -501
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +0 -162
- package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +0 -21
- package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +0 -17
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +0 -110
- package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +0 -62
- package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +0 -460
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +0 -162
- package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +0 -36
- package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +0 -148
- package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +0 -289
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +0 -87
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +0 -64
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +0 -311
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +0 -28
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import './media/exceptionWidget.css.js';
|
|
3
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
4
|
-
import { append, isAncestorOfActiveElement, $ as $$1 } from 'vscode/vscode/vs/base/browser/dom';
|
|
5
|
-
import { ZoneWidget } from 'vscode/vscode/vs/editor/contrib/zoneWidget/browser/zoneWidget';
|
|
6
|
-
import { EDITOR_CONTRIBUTION_ID } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
7
|
-
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
8
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
9
|
-
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
10
|
-
import { registerColor } from 'vscode/vscode/vs/platform/theme/common/colorRegistry';
|
|
11
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
12
|
-
import { LinkDetector } from './linkDetector.js';
|
|
13
|
-
import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
|
|
14
|
-
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
15
|
-
import { widgetClose } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
16
|
-
|
|
17
|
-
const $ = $$1;
|
|
18
|
-
const debugExceptionWidgetBorder = registerColor('debugExceptionWidget.border', { dark: '#a31515', light: '#a31515', hcDark: '#a31515', hcLight: '#a31515' }, ( localizeWithPath(
|
|
19
|
-
'vs/workbench/contrib/debug/browser/exceptionWidget',
|
|
20
|
-
'debugExceptionWidgetBorder',
|
|
21
|
-
'Exception widget border color.'
|
|
22
|
-
)));
|
|
23
|
-
const debugExceptionWidgetBackground = registerColor('debugExceptionWidget.background', { dark: '#420b0d', light: '#f1dfde', hcDark: '#420b0d', hcLight: '#f1dfde' }, ( localizeWithPath(
|
|
24
|
-
'vs/workbench/contrib/debug/browser/exceptionWidget',
|
|
25
|
-
'debugExceptionWidgetBackground',
|
|
26
|
-
'Exception widget background color.'
|
|
27
|
-
)));
|
|
28
|
-
let ExceptionWidget = class ExceptionWidget extends ZoneWidget {
|
|
29
|
-
constructor(editor, exceptionInfo, debugSession, themeService, instantiationService) {
|
|
30
|
-
super(editor, { showFrame: true, showArrow: true, isAccessible: true, frameWidth: 1, className: 'exception-widget-container' });
|
|
31
|
-
this.exceptionInfo = exceptionInfo;
|
|
32
|
-
this.debugSession = debugSession;
|
|
33
|
-
this.instantiationService = instantiationService;
|
|
34
|
-
this.applyTheme(themeService.getColorTheme());
|
|
35
|
-
this._disposables.add(themeService.onDidColorThemeChange(this.applyTheme.bind(this)));
|
|
36
|
-
this.create();
|
|
37
|
-
const onDidLayoutChangeScheduler = ( new RunOnceScheduler(() => this._doLayout(undefined, undefined), 50));
|
|
38
|
-
this._disposables.add(this.editor.onDidLayoutChange(() => onDidLayoutChangeScheduler.schedule()));
|
|
39
|
-
this._disposables.add(onDidLayoutChangeScheduler);
|
|
40
|
-
}
|
|
41
|
-
applyTheme(theme) {
|
|
42
|
-
this.backgroundColor = theme.getColor(debugExceptionWidgetBackground);
|
|
43
|
-
const frameColor = theme.getColor(debugExceptionWidgetBorder);
|
|
44
|
-
this.style({
|
|
45
|
-
arrowColor: frameColor,
|
|
46
|
-
frameColor: frameColor
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
_applyStyles() {
|
|
50
|
-
if (this.container) {
|
|
51
|
-
this.container.style.backgroundColor = this.backgroundColor ? ( this.backgroundColor.toString()) : '';
|
|
52
|
-
}
|
|
53
|
-
super._applyStyles();
|
|
54
|
-
}
|
|
55
|
-
_fillContainer(container) {
|
|
56
|
-
this.setCssClass('exception-widget');
|
|
57
|
-
const fontInfo = this.editor.getOption(50 );
|
|
58
|
-
container.style.fontSize = `${fontInfo.fontSize}px`;
|
|
59
|
-
container.style.lineHeight = `${fontInfo.lineHeight}px`;
|
|
60
|
-
container.tabIndex = 0;
|
|
61
|
-
const title = $('.title');
|
|
62
|
-
const label = $('.label');
|
|
63
|
-
append(title, label);
|
|
64
|
-
const actions = $('.actions');
|
|
65
|
-
append(title, actions);
|
|
66
|
-
label.textContent = this.exceptionInfo.id ? ( localizeWithPath(
|
|
67
|
-
'vs/workbench/contrib/debug/browser/exceptionWidget',
|
|
68
|
-
'exceptionThrownWithId',
|
|
69
|
-
'Exception has occurred: {0}',
|
|
70
|
-
this.exceptionInfo.id
|
|
71
|
-
)) : ( localizeWithPath(
|
|
72
|
-
'vs/workbench/contrib/debug/browser/exceptionWidget',
|
|
73
|
-
'exceptionThrown',
|
|
74
|
-
'Exception has occurred.'
|
|
75
|
-
));
|
|
76
|
-
let ariaLabel = label.textContent;
|
|
77
|
-
const actionBar = ( new ActionBar(actions));
|
|
78
|
-
actionBar.push(( new Action('editor.closeExceptionWidget', ( localizeWithPath('vs/workbench/contrib/debug/browser/exceptionWidget', 'close', "Close")), ThemeIcon.asClassName(widgetClose), true, async () => {
|
|
79
|
-
const contribution = this.editor.getContribution(EDITOR_CONTRIBUTION_ID);
|
|
80
|
-
contribution?.closeExceptionWidget();
|
|
81
|
-
})), { label: false, icon: true });
|
|
82
|
-
append(container, title);
|
|
83
|
-
if (this.exceptionInfo.description) {
|
|
84
|
-
const description = $('.description');
|
|
85
|
-
description.textContent = this.exceptionInfo.description;
|
|
86
|
-
ariaLabel += ', ' + this.exceptionInfo.description;
|
|
87
|
-
append(container, description);
|
|
88
|
-
}
|
|
89
|
-
if (this.exceptionInfo.details && this.exceptionInfo.details.stackTrace) {
|
|
90
|
-
const stackTrace = $('.stack-trace');
|
|
91
|
-
const linkDetector = this.instantiationService.createInstance(LinkDetector);
|
|
92
|
-
const linkedStackTrace = linkDetector.linkify(this.exceptionInfo.details.stackTrace, true, this.debugSession ? this.debugSession.root : undefined);
|
|
93
|
-
stackTrace.appendChild(linkedStackTrace);
|
|
94
|
-
append(container, stackTrace);
|
|
95
|
-
ariaLabel += ', ' + this.exceptionInfo.details.stackTrace;
|
|
96
|
-
}
|
|
97
|
-
container.setAttribute('aria-label', ariaLabel);
|
|
98
|
-
}
|
|
99
|
-
_doLayout(_heightInPixel, _widthInPixel) {
|
|
100
|
-
this.container.style.height = 'initial';
|
|
101
|
-
const lineHeight = this.editor.getOption(67 );
|
|
102
|
-
const arrowHeight = Math.round(lineHeight / 3);
|
|
103
|
-
const computedLinesNumber = Math.ceil((this.container.offsetHeight + arrowHeight) / lineHeight);
|
|
104
|
-
this._relayout(computedLinesNumber);
|
|
105
|
-
}
|
|
106
|
-
focus() {
|
|
107
|
-
this.container?.focus();
|
|
108
|
-
}
|
|
109
|
-
hasFocus() {
|
|
110
|
-
if (!this.container) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
return isAncestorOfActiveElement(this.container);
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
ExceptionWidget = ( __decorate([
|
|
117
|
-
( __param(3, IThemeService)),
|
|
118
|
-
( __param(4, IInstantiationService))
|
|
119
|
-
], ExceptionWidget));
|
|
120
|
-
|
|
121
|
-
export { ExceptionWidget };
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
3
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
|
-
import { ExtensionHostDebugChannelClient, ExtensionHostDebugBroadcastChannel } from '../../../../platform/debug/common/extensionHostDebugIpc.js';
|
|
5
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
6
|
-
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
7
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
8
|
-
import { isFolderToOpen, isWorkspaceToOpen } from 'vscode/vscode/vs/platform/window/common/window';
|
|
9
|
-
import { toWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, hasWorkspaceFileExtension, IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
10
|
-
import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService';
|
|
11
|
-
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
12
|
-
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
|
|
13
|
-
|
|
14
|
-
var BrowserExtensionHostDebugService_1;
|
|
15
|
-
let BrowserExtensionHostDebugService = class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient {
|
|
16
|
-
static { BrowserExtensionHostDebugService_1 = this; }
|
|
17
|
-
static { this.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY = 'debug.lastExtensionDevelopmentWorkspace'; }
|
|
18
|
-
constructor(remoteAgentService, environmentService, logService, hostService, contextService, storageService, fileService) {
|
|
19
|
-
const connection = remoteAgentService.getConnection();
|
|
20
|
-
let channel;
|
|
21
|
-
if (connection) {
|
|
22
|
-
channel = connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
channel = { call: async () => undefined, listen: () => Event.None };
|
|
26
|
-
}
|
|
27
|
-
super(channel);
|
|
28
|
-
this.storageService = storageService;
|
|
29
|
-
this.fileService = fileService;
|
|
30
|
-
if (environmentService.options && environmentService.options.workspaceProvider) {
|
|
31
|
-
this.workspaceProvider = environmentService.options.workspaceProvider;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
this.workspaceProvider = { open: async () => true, workspace: undefined, trusted: undefined };
|
|
35
|
-
logService.warn('Extension Host Debugging not available due to missing workspace provider.');
|
|
36
|
-
}
|
|
37
|
-
this._register(this.onReload(event => {
|
|
38
|
-
if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
|
|
39
|
-
hostService.reload();
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
this._register(this.onClose(event => {
|
|
43
|
-
if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
|
|
44
|
-
hostService.close();
|
|
45
|
-
}
|
|
46
|
-
}));
|
|
47
|
-
if (environmentService.isExtensionDevelopment && !environmentService.extensionTestsLocationURI) {
|
|
48
|
-
const workspaceId = toWorkspaceIdentifier(contextService.getWorkspace());
|
|
49
|
-
if (isSingleFolderWorkspaceIdentifier(workspaceId) || isWorkspaceIdentifier(workspaceId)) {
|
|
50
|
-
const serializedWorkspace = isSingleFolderWorkspaceIdentifier(workspaceId) ? { folderUri: workspaceId.uri.toJSON() } : { workspaceUri: workspaceId.configPath.toJSON() };
|
|
51
|
-
storageService.store(BrowserExtensionHostDebugService_1.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY, JSON.stringify(serializedWorkspace), 0 , 1 );
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
storageService.remove(BrowserExtensionHostDebugService_1.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY, 0 );
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async openExtensionDevelopmentHostWindow(args, _debugRenderer) {
|
|
59
|
-
const environment = ( new Map());
|
|
60
|
-
const fileUriArg = this.findArgument('file-uri', args);
|
|
61
|
-
if (fileUriArg && !hasWorkspaceFileExtension(fileUriArg)) {
|
|
62
|
-
environment.set('openFile', fileUriArg);
|
|
63
|
-
}
|
|
64
|
-
const copyArgs = [
|
|
65
|
-
'extensionDevelopmentPath',
|
|
66
|
-
'extensionTestsPath',
|
|
67
|
-
'extensionEnvironment',
|
|
68
|
-
'debugId',
|
|
69
|
-
'inspect-brk-extensions',
|
|
70
|
-
'inspect-extensions',
|
|
71
|
-
];
|
|
72
|
-
for (const argName of copyArgs) {
|
|
73
|
-
const value = this.findArgument(argName, args);
|
|
74
|
-
if (value) {
|
|
75
|
-
environment.set(argName, value);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
let debugWorkspace = undefined;
|
|
79
|
-
const folderUriArg = this.findArgument('folder-uri', args);
|
|
80
|
-
if (folderUriArg) {
|
|
81
|
-
debugWorkspace = { folderUri: ( URI.parse(folderUriArg)) };
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
const fileUriArg = this.findArgument('file-uri', args);
|
|
85
|
-
if (fileUriArg && hasWorkspaceFileExtension(fileUriArg)) {
|
|
86
|
-
debugWorkspace = { workspaceUri: ( URI.parse(fileUriArg)) };
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const extensionTestsPath = this.findArgument('extensionTestsPath', args);
|
|
90
|
-
if (!debugWorkspace && !extensionTestsPath) {
|
|
91
|
-
const lastExtensionDevelopmentWorkspace = this.storageService.get(BrowserExtensionHostDebugService_1.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY, 0 );
|
|
92
|
-
if (lastExtensionDevelopmentWorkspace) {
|
|
93
|
-
try {
|
|
94
|
-
const serializedWorkspace = JSON.parse(lastExtensionDevelopmentWorkspace);
|
|
95
|
-
if (serializedWorkspace.workspaceUri) {
|
|
96
|
-
debugWorkspace = { workspaceUri: URI.revive(serializedWorkspace.workspaceUri) };
|
|
97
|
-
}
|
|
98
|
-
else if (serializedWorkspace.folderUri) {
|
|
99
|
-
debugWorkspace = { folderUri: URI.revive(serializedWorkspace.folderUri) };
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
catch (error) {
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (debugWorkspace) {
|
|
107
|
-
const debugWorkspaceResource = isFolderToOpen(debugWorkspace) ? debugWorkspace.folderUri : isWorkspaceToOpen(debugWorkspace) ? debugWorkspace.workspaceUri : undefined;
|
|
108
|
-
if (debugWorkspaceResource) {
|
|
109
|
-
const workspaceExists = await this.fileService.exists(debugWorkspaceResource);
|
|
110
|
-
if (!workspaceExists) {
|
|
111
|
-
debugWorkspace = undefined;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
const success = await this.workspaceProvider.open(debugWorkspace, {
|
|
116
|
-
reuse: false,
|
|
117
|
-
payload: Array.from(environment.entries())
|
|
118
|
-
});
|
|
119
|
-
return { success };
|
|
120
|
-
}
|
|
121
|
-
findArgument(key, args) {
|
|
122
|
-
for (const a of args) {
|
|
123
|
-
const k = `--${key}=`;
|
|
124
|
-
if (a.indexOf(k) === 0) {
|
|
125
|
-
return a.substring(k.length);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return undefined;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
BrowserExtensionHostDebugService = BrowserExtensionHostDebugService_1 = ( __decorate([
|
|
132
|
-
( __param(0, IRemoteAgentService)),
|
|
133
|
-
( __param(1, IBrowserWorkbenchEnvironmentService)),
|
|
134
|
-
( __param(2, ILogService)),
|
|
135
|
-
( __param(3, IHostService)),
|
|
136
|
-
( __param(4, IWorkspaceContextService)),
|
|
137
|
-
( __param(5, IStorageService)),
|
|
138
|
-
( __param(6, IFileService))
|
|
139
|
-
], BrowserExtensionHostDebugService));
|
|
140
|
-
|
|
141
|
-
export { BrowserExtensionHostDebugService };
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
3
|
-
import { normalize, posix, join } from 'vscode/vscode/vs/base/common/path';
|
|
4
|
-
import { isWindows, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
5
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
6
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
7
|
-
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
8
|
-
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
9
|
-
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
|
|
10
|
-
import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
|
|
11
|
-
import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
12
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
13
|
-
import { ITunnelService } from 'vscode/vscode/vs/platform/tunnel/common/tunnel';
|
|
14
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
15
|
-
import { getWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
16
|
-
|
|
17
|
-
const CONTROL_CODES = '\\u0000-\\u0020\\u007f-\\u009f';
|
|
18
|
-
const WEB_LINK_REGEX = ( new RegExp(
|
|
19
|
-
'(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s' + CONTROL_CODES + '"]{2,}[^\\s' + CONTROL_CODES + '"\')}\\],:;.!?]',
|
|
20
|
-
'ug'
|
|
21
|
-
));
|
|
22
|
-
const WIN_ABSOLUTE_PATH = /(?:[a-zA-Z]:(?:(?:\\|\/)[\w\.-]*)+)/;
|
|
23
|
-
const WIN_RELATIVE_PATH = /(?:(?:\~|\.)(?:(?:\\|\/)[\w\.-]*)+)/;
|
|
24
|
-
const WIN_PATH = ( new RegExp(`(${WIN_ABSOLUTE_PATH.source}|${WIN_RELATIVE_PATH.source})`));
|
|
25
|
-
const POSIX_PATH = /((?:\~|\.)?(?:\/[\w\.-]*)+)/;
|
|
26
|
-
const LINE_COLUMN = /(?:\:([\d]+))?(?:\:([\d]+))?/;
|
|
27
|
-
const PATH_LINK_REGEX = ( new RegExp(
|
|
28
|
-
`${isWindows ? WIN_PATH.source : POSIX_PATH.source}${LINE_COLUMN.source}`,
|
|
29
|
-
'g'
|
|
30
|
-
));
|
|
31
|
-
const LINE_COLUMN_REGEX = /:([\d]+)(?::([\d]+))?$/;
|
|
32
|
-
const MAX_LENGTH = 2000;
|
|
33
|
-
let LinkDetector = class LinkDetector {
|
|
34
|
-
constructor(editorService, fileService, openerService, pathService, tunnelService, environmentService, configurationService) {
|
|
35
|
-
this.editorService = editorService;
|
|
36
|
-
this.fileService = fileService;
|
|
37
|
-
this.openerService = openerService;
|
|
38
|
-
this.pathService = pathService;
|
|
39
|
-
this.tunnelService = tunnelService;
|
|
40
|
-
this.environmentService = environmentService;
|
|
41
|
-
this.configurationService = configurationService;
|
|
42
|
-
}
|
|
43
|
-
linkify(text, splitLines, workspaceFolder, includeFulltext) {
|
|
44
|
-
if (splitLines) {
|
|
45
|
-
const lines = text.split('\n');
|
|
46
|
-
for (let i = 0; i < lines.length - 1; i++) {
|
|
47
|
-
lines[i] = lines[i] + '\n';
|
|
48
|
-
}
|
|
49
|
-
if (!lines[lines.length - 1]) {
|
|
50
|
-
lines.pop();
|
|
51
|
-
}
|
|
52
|
-
const elements = ( lines.map(line => this.linkify(line, false, workspaceFolder, includeFulltext)));
|
|
53
|
-
if (elements.length === 1) {
|
|
54
|
-
return elements[0];
|
|
55
|
-
}
|
|
56
|
-
const container = document.createElement('span');
|
|
57
|
-
elements.forEach(e => container.appendChild(e));
|
|
58
|
-
return container;
|
|
59
|
-
}
|
|
60
|
-
const container = document.createElement('span');
|
|
61
|
-
for (const part of this.detectLinks(text)) {
|
|
62
|
-
try {
|
|
63
|
-
switch (part.kind) {
|
|
64
|
-
case 'text':
|
|
65
|
-
container.appendChild(document.createTextNode(part.value));
|
|
66
|
-
break;
|
|
67
|
-
case 'web':
|
|
68
|
-
container.appendChild(this.createWebLink(includeFulltext ? text : undefined, part.value));
|
|
69
|
-
break;
|
|
70
|
-
case 'path': {
|
|
71
|
-
const path = part.captures[0];
|
|
72
|
-
const lineNumber = part.captures[1] ? Number(part.captures[1]) : 0;
|
|
73
|
-
const columnNumber = part.captures[2] ? Number(part.captures[2]) : 0;
|
|
74
|
-
container.appendChild(this.createPathLink(includeFulltext ? text : undefined, part.value, path, lineNumber, columnNumber, workspaceFolder));
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
container.appendChild(document.createTextNode(part.value));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return container;
|
|
84
|
-
}
|
|
85
|
-
createWebLink(fulltext, url) {
|
|
86
|
-
const link = this.createLink(url);
|
|
87
|
-
let uri = ( URI.parse(url));
|
|
88
|
-
const lineCol = LINE_COLUMN_REGEX.exec(uri.path);
|
|
89
|
-
if (lineCol) {
|
|
90
|
-
uri = uri.with({
|
|
91
|
-
path: uri.path.slice(0, lineCol.index),
|
|
92
|
-
fragment: `L${lineCol[0].slice(1)}`
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
this.decorateLink(link, uri, fulltext, async () => {
|
|
96
|
-
if (uri.scheme === Schemas.file) {
|
|
97
|
-
const fsPath = uri.fsPath;
|
|
98
|
-
const path = await this.pathService.path;
|
|
99
|
-
const fileUrl = normalize(((path.sep === posix.sep) && isWindows) ? fsPath.replace(/\\/g, posix.sep) : fsPath);
|
|
100
|
-
const fileUri = ( URI.parse(fileUrl));
|
|
101
|
-
const exists = await this.fileService.exists(fileUri);
|
|
102
|
-
if (!exists) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
await this.editorService.openEditor({
|
|
106
|
-
resource: fileUri,
|
|
107
|
-
options: {
|
|
108
|
-
pinned: true,
|
|
109
|
-
selection: lineCol ? { startLineNumber: +lineCol[1], startColumn: +lineCol[2] } : undefined,
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.openerService.open(url, { allowTunneling: (!!this.environmentService.remoteAuthority && this.configurationService.getValue('remote.forwardOnOpen')) });
|
|
115
|
-
});
|
|
116
|
-
return link;
|
|
117
|
-
}
|
|
118
|
-
createPathLink(fulltext, text, path, lineNumber, columnNumber, workspaceFolder) {
|
|
119
|
-
if (path[0] === '/' && path[1] === '/') {
|
|
120
|
-
return document.createTextNode(text);
|
|
121
|
-
}
|
|
122
|
-
const options = { selection: { startLineNumber: lineNumber, startColumn: columnNumber } };
|
|
123
|
-
if (path[0] === '.') {
|
|
124
|
-
if (!workspaceFolder) {
|
|
125
|
-
return document.createTextNode(text);
|
|
126
|
-
}
|
|
127
|
-
const uri = workspaceFolder.toResource(path);
|
|
128
|
-
const link = this.createLink(text);
|
|
129
|
-
this.decorateLink(link, uri, fulltext, (preserveFocus) => this.editorService.openEditor({ resource: uri, options: { ...options, preserveFocus } }));
|
|
130
|
-
return link;
|
|
131
|
-
}
|
|
132
|
-
if (path[0] === '~') {
|
|
133
|
-
const userHome = this.pathService.resolvedUserHome;
|
|
134
|
-
if (userHome) {
|
|
135
|
-
path = join(userHome.fsPath, path.substring(1));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const link = this.createLink(text);
|
|
139
|
-
link.tabIndex = 0;
|
|
140
|
-
const uri = URI.file(normalize(path));
|
|
141
|
-
this.fileService.stat(uri).then(stat => {
|
|
142
|
-
if (stat.isDirectory) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
this.decorateLink(link, uri, fulltext, (preserveFocus) => this.editorService.openEditor({ resource: uri, options: { ...options, preserveFocus } }));
|
|
146
|
-
}).catch(() => {
|
|
147
|
-
});
|
|
148
|
-
return link;
|
|
149
|
-
}
|
|
150
|
-
createLink(text) {
|
|
151
|
-
const link = document.createElement('a');
|
|
152
|
-
link.textContent = text;
|
|
153
|
-
return link;
|
|
154
|
-
}
|
|
155
|
-
decorateLink(link, uri, fulltext, onClick) {
|
|
156
|
-
link.classList.add('link');
|
|
157
|
-
const followLink = this.tunnelService.canTunnel(uri) ? ( localizeWithPath(
|
|
158
|
-
'vs/workbench/contrib/debug/browser/linkDetector',
|
|
159
|
-
'followForwardedLink',
|
|
160
|
-
"follow link using forwarded port"
|
|
161
|
-
)) : ( localizeWithPath(
|
|
162
|
-
'vs/workbench/contrib/debug/browser/linkDetector',
|
|
163
|
-
'followLink',
|
|
164
|
-
"follow link"
|
|
165
|
-
));
|
|
166
|
-
link.title = fulltext
|
|
167
|
-
? (isMacintosh ? ( localizeWithPath(
|
|
168
|
-
'vs/workbench/contrib/debug/browser/linkDetector',
|
|
169
|
-
'fileLinkWithPathMac',
|
|
170
|
-
"Cmd + click to {0}\n{1}",
|
|
171
|
-
followLink,
|
|
172
|
-
fulltext
|
|
173
|
-
)) : ( localizeWithPath(
|
|
174
|
-
'vs/workbench/contrib/debug/browser/linkDetector',
|
|
175
|
-
'fileLinkWithPath',
|
|
176
|
-
"Ctrl + click to {0}\n{1}",
|
|
177
|
-
followLink,
|
|
178
|
-
fulltext
|
|
179
|
-
)))
|
|
180
|
-
: (isMacintosh ? ( localizeWithPath(
|
|
181
|
-
'vs/workbench/contrib/debug/browser/linkDetector',
|
|
182
|
-
'fileLinkMac',
|
|
183
|
-
"Cmd + click to {0}",
|
|
184
|
-
followLink
|
|
185
|
-
)) : ( localizeWithPath(
|
|
186
|
-
'vs/workbench/contrib/debug/browser/linkDetector',
|
|
187
|
-
'fileLink',
|
|
188
|
-
"Ctrl + click to {0}",
|
|
189
|
-
followLink
|
|
190
|
-
)));
|
|
191
|
-
link.onmousemove = (event) => { link.classList.toggle('pointer', isMacintosh ? event.metaKey : event.ctrlKey); };
|
|
192
|
-
link.onmouseleave = () => link.classList.remove('pointer');
|
|
193
|
-
link.onclick = (event) => {
|
|
194
|
-
const selection = getWindow(link).getSelection();
|
|
195
|
-
if (!selection || selection.type === 'Range') {
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
if (!(isMacintosh ? event.metaKey : event.ctrlKey)) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
event.preventDefault();
|
|
202
|
-
event.stopImmediatePropagation();
|
|
203
|
-
onClick(false);
|
|
204
|
-
};
|
|
205
|
-
link.onkeydown = e => {
|
|
206
|
-
const event = ( new StandardKeyboardEvent(e));
|
|
207
|
-
if (event.keyCode === 3 || event.keyCode === 10 ) {
|
|
208
|
-
event.preventDefault();
|
|
209
|
-
event.stopPropagation();
|
|
210
|
-
onClick(event.keyCode === 10 );
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
detectLinks(text) {
|
|
215
|
-
if (text.length > MAX_LENGTH) {
|
|
216
|
-
return [{ kind: 'text', value: text, captures: [] }];
|
|
217
|
-
}
|
|
218
|
-
const regexes = [WEB_LINK_REGEX, PATH_LINK_REGEX];
|
|
219
|
-
const kinds = ['web', 'path'];
|
|
220
|
-
const result = [];
|
|
221
|
-
const splitOne = (text, regexIndex) => {
|
|
222
|
-
if (regexIndex >= regexes.length) {
|
|
223
|
-
result.push({ value: text, kind: 'text', captures: [] });
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
const regex = regexes[regexIndex];
|
|
227
|
-
let currentIndex = 0;
|
|
228
|
-
let match;
|
|
229
|
-
regex.lastIndex = 0;
|
|
230
|
-
while ((match = regex.exec(text)) !== null) {
|
|
231
|
-
const stringBeforeMatch = text.substring(currentIndex, match.index);
|
|
232
|
-
if (stringBeforeMatch) {
|
|
233
|
-
splitOne(stringBeforeMatch, regexIndex + 1);
|
|
234
|
-
}
|
|
235
|
-
const value = match[0];
|
|
236
|
-
result.push({
|
|
237
|
-
value: value,
|
|
238
|
-
kind: kinds[regexIndex],
|
|
239
|
-
captures: match.slice(1)
|
|
240
|
-
});
|
|
241
|
-
currentIndex = match.index + value.length;
|
|
242
|
-
}
|
|
243
|
-
const stringAfterMatches = text.substring(currentIndex);
|
|
244
|
-
if (stringAfterMatches) {
|
|
245
|
-
splitOne(stringAfterMatches, regexIndex + 1);
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
splitOne(text, 0);
|
|
249
|
-
return result;
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
LinkDetector = ( __decorate([
|
|
253
|
-
( __param(0, IEditorService)),
|
|
254
|
-
( __param(1, IFileService)),
|
|
255
|
-
( __param(2, IOpenerService)),
|
|
256
|
-
( __param(3, IPathService)),
|
|
257
|
-
( __param(4, ITunnelService)),
|
|
258
|
-
( __param(5, IWorkbenchEnvironmentService)),
|
|
259
|
-
( __param(6, IConfigurationService))
|
|
260
|
-
], LinkDetector));
|
|
261
|
-
|
|
262
|
-
export { LinkDetector };
|