@codingame/monaco-vscode-debug-service-override 1.82.4 → 1.82.5-next.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/debug.d.ts +5 -0
- package/debug.js +24 -0
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/package.json +2 -2
- package/vscode/src/vs/editor/common/services/languageFeaturesService.js +44 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +200 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +785 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +399 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +1298 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +178 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +960 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +497 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +347 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +299 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +400 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +827 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +621 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +60 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +527 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +681 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +356 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +206 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +82 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +143 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +1174 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +1144 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +106 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +68 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +275 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +314 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +168 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +663 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +105 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +231 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +631 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +695 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +953 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +48 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +336 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +98 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +575 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +415 -0
- package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +102 -0
- package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +21 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +17 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +100 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +59 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +1482 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +346 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugSource.js +123 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +175 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +36 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +117 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +260 -0
- package/vscode/src/vs/workbench/contrib/debug/common/disassemblyViewInput.js +27 -0
- package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +83 -0
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +283 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +305 -0
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +28 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverSchema.js +176 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolverUtils.js +12 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/exceptionWidget.css.js';
|
|
3
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
5
|
+
import { ZoneWidget } from 'monaco-editor/esm/vs/editor/contrib/zoneWidget/browser/zoneWidget.js';
|
|
6
|
+
import { EDITOR_CONTRIBUTION_ID } from 'vscode/vscode/vs/workbench/contrib/debug/common/debug';
|
|
7
|
+
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
8
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
9
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
10
|
+
import { registerColor } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
11
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
12
|
+
import { LinkDetector } from './linkDetector.js';
|
|
13
|
+
import { ActionBar } from 'monaco-editor/esm/vs/base/browser/ui/actionbar/actionbar.js';
|
|
14
|
+
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
15
|
+
import { widgetClose } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
16
|
+
|
|
17
|
+
const $ = dom.$;
|
|
18
|
+
const debugExceptionWidgetBorder = registerColor('debugExceptionWidget.border', { dark: '#a31515', light: '#a31515', hcDark: '#a31515', hcLight: '#a31515' }, ( nls.localize('debugExceptionWidgetBorder', 'Exception widget border color.')));
|
|
19
|
+
const debugExceptionWidgetBackground = registerColor('debugExceptionWidget.background', { dark: '#420b0d', light: '#f1dfde', hcDark: '#420b0d', hcLight: '#f1dfde' }, ( nls.localize('debugExceptionWidgetBackground', 'Exception widget background color.')));
|
|
20
|
+
let ExceptionWidget = class ExceptionWidget extends ZoneWidget {
|
|
21
|
+
constructor(editor, exceptionInfo, debugSession, themeService, instantiationService) {
|
|
22
|
+
super(editor, { showFrame: true, showArrow: true, isAccessible: true, frameWidth: 1, className: 'exception-widget-container' });
|
|
23
|
+
this.exceptionInfo = exceptionInfo;
|
|
24
|
+
this.debugSession = debugSession;
|
|
25
|
+
this.instantiationService = instantiationService;
|
|
26
|
+
this.applyTheme(themeService.getColorTheme());
|
|
27
|
+
this._disposables.add(themeService.onDidColorThemeChange(this.applyTheme.bind(this)));
|
|
28
|
+
this.create();
|
|
29
|
+
const onDidLayoutChangeScheduler = ( new RunOnceScheduler(() => this._doLayout(undefined, undefined), 50));
|
|
30
|
+
this._disposables.add(this.editor.onDidLayoutChange(() => onDidLayoutChangeScheduler.schedule()));
|
|
31
|
+
this._disposables.add(onDidLayoutChangeScheduler);
|
|
32
|
+
}
|
|
33
|
+
applyTheme(theme) {
|
|
34
|
+
this.backgroundColor = theme.getColor(debugExceptionWidgetBackground);
|
|
35
|
+
const frameColor = theme.getColor(debugExceptionWidgetBorder);
|
|
36
|
+
this.style({
|
|
37
|
+
arrowColor: frameColor,
|
|
38
|
+
frameColor: frameColor
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
_applyStyles() {
|
|
42
|
+
if (this.container) {
|
|
43
|
+
this.container.style.backgroundColor = this.backgroundColor ? ( this.backgroundColor.toString()) : '';
|
|
44
|
+
}
|
|
45
|
+
super._applyStyles();
|
|
46
|
+
}
|
|
47
|
+
_fillContainer(container) {
|
|
48
|
+
this.setCssClass('exception-widget');
|
|
49
|
+
const fontInfo = this.editor.getOption(49 );
|
|
50
|
+
container.style.fontSize = `${fontInfo.fontSize}px`;
|
|
51
|
+
container.style.lineHeight = `${fontInfo.lineHeight}px`;
|
|
52
|
+
container.tabIndex = 0;
|
|
53
|
+
const title = $('.title');
|
|
54
|
+
const label = $('.label');
|
|
55
|
+
dom.append(title, label);
|
|
56
|
+
const actions = $('.actions');
|
|
57
|
+
dom.append(title, actions);
|
|
58
|
+
label.textContent = this.exceptionInfo.id ? ( nls.localize(
|
|
59
|
+
'exceptionThrownWithId',
|
|
60
|
+
'Exception has occurred: {0}',
|
|
61
|
+
this.exceptionInfo.id
|
|
62
|
+
)) : ( nls.localize('exceptionThrown', 'Exception has occurred.'));
|
|
63
|
+
let ariaLabel = label.textContent;
|
|
64
|
+
const actionBar = ( new ActionBar(actions));
|
|
65
|
+
actionBar.push(( new Action('editor.closeExceptionWidget', ( nls.localize('close', "Close")), ThemeIcon.asClassName(widgetClose), true, async () => {
|
|
66
|
+
const contribution = this.editor.getContribution(EDITOR_CONTRIBUTION_ID);
|
|
67
|
+
contribution?.closeExceptionWidget();
|
|
68
|
+
})), { label: false, icon: true });
|
|
69
|
+
dom.append(container, title);
|
|
70
|
+
if (this.exceptionInfo.description) {
|
|
71
|
+
const description = $('.description');
|
|
72
|
+
description.textContent = this.exceptionInfo.description;
|
|
73
|
+
ariaLabel += ', ' + this.exceptionInfo.description;
|
|
74
|
+
dom.append(container, description);
|
|
75
|
+
}
|
|
76
|
+
if (this.exceptionInfo.details && this.exceptionInfo.details.stackTrace) {
|
|
77
|
+
const stackTrace = $('.stack-trace');
|
|
78
|
+
const linkDetector = this.instantiationService.createInstance(LinkDetector);
|
|
79
|
+
const linkedStackTrace = linkDetector.linkify(this.exceptionInfo.details.stackTrace, true, this.debugSession ? this.debugSession.root : undefined);
|
|
80
|
+
stackTrace.appendChild(linkedStackTrace);
|
|
81
|
+
dom.append(container, stackTrace);
|
|
82
|
+
ariaLabel += ', ' + this.exceptionInfo.details.stackTrace;
|
|
83
|
+
}
|
|
84
|
+
container.setAttribute('aria-label', ariaLabel);
|
|
85
|
+
}
|
|
86
|
+
_doLayout(_heightInPixel, _widthInPixel) {
|
|
87
|
+
this.container.style.height = 'initial';
|
|
88
|
+
const lineHeight = this.editor.getOption(65 );
|
|
89
|
+
const arrowHeight = Math.round(lineHeight / 3);
|
|
90
|
+
const computedLinesNumber = Math.ceil((this.container.offsetHeight + arrowHeight) / lineHeight);
|
|
91
|
+
this._relayout(computedLinesNumber);
|
|
92
|
+
}
|
|
93
|
+
focus() {
|
|
94
|
+
this.container?.focus();
|
|
95
|
+
}
|
|
96
|
+
hasFocus() {
|
|
97
|
+
return dom.isAncestor(document.activeElement, this.container);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
ExceptionWidget = ( __decorate([
|
|
101
|
+
( __param(3, IThemeService)),
|
|
102
|
+
( __param(4, IInstantiationService))
|
|
103
|
+
], ExceptionWidget));
|
|
104
|
+
|
|
105
|
+
export { ExceptionWidget };
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
3
|
+
import * as path from 'monaco-editor/esm/vs/base/common/path.js';
|
|
4
|
+
import * as platform from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
5
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
6
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
7
|
+
import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
|
|
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 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
|
|
12
|
+
import { localize } from 'monaco-editor/esm/vs/nls.js';
|
|
13
|
+
import { ITunnelService } from 'vscode/vscode/vs/platform/tunnel/common/tunnel';
|
|
14
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
15
|
+
|
|
16
|
+
const CONTROL_CODES = '\\u0000-\\u0020\\u007f-\\u009f';
|
|
17
|
+
const WEB_LINK_REGEX = ( new RegExp(
|
|
18
|
+
'(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\\/\\/|data:|www\\.)[^\\s' + CONTROL_CODES + '"]{2,}[^\\s' + CONTROL_CODES + '"\')}\\],:;.!?]',
|
|
19
|
+
'ug'
|
|
20
|
+
));
|
|
21
|
+
const WIN_ABSOLUTE_PATH = /(?:[a-zA-Z]:(?:(?:\\|\/)[\w\.-]*)+)/;
|
|
22
|
+
const WIN_RELATIVE_PATH = /(?:(?:\~|\.)(?:(?:\\|\/)[\w\.-]*)+)/;
|
|
23
|
+
const WIN_PATH = ( new RegExp(`(${WIN_ABSOLUTE_PATH.source}|${WIN_RELATIVE_PATH.source})`));
|
|
24
|
+
const POSIX_PATH = /((?:\~|\.)?(?:\/[\w\.-]*)+)/;
|
|
25
|
+
const LINE_COLUMN = /(?:\:([\d]+))?(?:\:([\d]+))?/;
|
|
26
|
+
const PATH_LINK_REGEX = ( new RegExp(
|
|
27
|
+
`${platform.isWindows ? WIN_PATH.source : POSIX_PATH.source}${LINE_COLUMN.source}`,
|
|
28
|
+
'g'
|
|
29
|
+
));
|
|
30
|
+
const LINE_COLUMN_REGEX = /:([\d]+)(?::([\d]+))?$/;
|
|
31
|
+
const MAX_LENGTH = 2000;
|
|
32
|
+
let LinkDetector = class LinkDetector {
|
|
33
|
+
constructor(editorService, fileService, openerService, pathService, tunnelService, environmentService, configurationService) {
|
|
34
|
+
this.editorService = editorService;
|
|
35
|
+
this.fileService = fileService;
|
|
36
|
+
this.openerService = openerService;
|
|
37
|
+
this.pathService = pathService;
|
|
38
|
+
this.tunnelService = tunnelService;
|
|
39
|
+
this.environmentService = environmentService;
|
|
40
|
+
this.configurationService = configurationService;
|
|
41
|
+
}
|
|
42
|
+
linkify(text, splitLines, workspaceFolder, includeFulltext) {
|
|
43
|
+
if (splitLines) {
|
|
44
|
+
const lines = text.split('\n');
|
|
45
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
|
46
|
+
lines[i] = lines[i] + '\n';
|
|
47
|
+
}
|
|
48
|
+
if (!lines[lines.length - 1]) {
|
|
49
|
+
lines.pop();
|
|
50
|
+
}
|
|
51
|
+
const elements = ( lines.map(line => this.linkify(line, false, workspaceFolder, includeFulltext)));
|
|
52
|
+
if (elements.length === 1) {
|
|
53
|
+
return elements[0];
|
|
54
|
+
}
|
|
55
|
+
const container = document.createElement('span');
|
|
56
|
+
elements.forEach(e => container.appendChild(e));
|
|
57
|
+
return container;
|
|
58
|
+
}
|
|
59
|
+
const container = document.createElement('span');
|
|
60
|
+
for (const part of this.detectLinks(text)) {
|
|
61
|
+
try {
|
|
62
|
+
switch (part.kind) {
|
|
63
|
+
case 'text':
|
|
64
|
+
container.appendChild(document.createTextNode(part.value));
|
|
65
|
+
break;
|
|
66
|
+
case 'web':
|
|
67
|
+
container.appendChild(this.createWebLink(includeFulltext ? text : undefined, part.value));
|
|
68
|
+
break;
|
|
69
|
+
case 'path': {
|
|
70
|
+
const path = part.captures[0];
|
|
71
|
+
const lineNumber = part.captures[1] ? Number(part.captures[1]) : 0;
|
|
72
|
+
const columnNumber = part.captures[2] ? Number(part.captures[2]) : 0;
|
|
73
|
+
container.appendChild(this.createPathLink(includeFulltext ? text : undefined, part.value, path, lineNumber, columnNumber, workspaceFolder));
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
container.appendChild(document.createTextNode(part.value));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return container;
|
|
83
|
+
}
|
|
84
|
+
createWebLink(fulltext, url) {
|
|
85
|
+
const link = this.createLink(url);
|
|
86
|
+
let uri = ( URI.parse(url));
|
|
87
|
+
const lineCol = LINE_COLUMN_REGEX.exec(uri.path);
|
|
88
|
+
if (lineCol) {
|
|
89
|
+
uri = uri.with({
|
|
90
|
+
path: uri.path.slice(0, lineCol.index),
|
|
91
|
+
fragment: `L${lineCol[0].slice(1)}`
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
this.decorateLink(link, uri, fulltext, async () => {
|
|
95
|
+
if (uri.scheme === Schemas.file) {
|
|
96
|
+
const fsPath = uri.fsPath;
|
|
97
|
+
const path$1 = await this.pathService.path;
|
|
98
|
+
const fileUrl = path.normalize(((path$1.sep === path.posix.sep) && platform.isWindows) ? fsPath.replace(/\\/g, path.posix.sep) : fsPath);
|
|
99
|
+
const fileUri = ( URI.parse(fileUrl));
|
|
100
|
+
const exists = await this.fileService.exists(fileUri);
|
|
101
|
+
if (!exists) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
await this.editorService.openEditor({
|
|
105
|
+
resource: fileUri,
|
|
106
|
+
options: {
|
|
107
|
+
pinned: true,
|
|
108
|
+
selection: lineCol ? { startLineNumber: +lineCol[1], startColumn: +lineCol[2] } : undefined,
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this.openerService.open(url, { allowTunneling: (!!this.environmentService.remoteAuthority && this.configurationService.getValue('remote.forwardOnOpen')) });
|
|
114
|
+
});
|
|
115
|
+
return link;
|
|
116
|
+
}
|
|
117
|
+
createPathLink(fulltext, text, path$1, lineNumber, columnNumber, workspaceFolder) {
|
|
118
|
+
if (path$1[0] === '/' && path$1[1] === '/') {
|
|
119
|
+
return document.createTextNode(text);
|
|
120
|
+
}
|
|
121
|
+
const options = { selection: { startLineNumber: lineNumber, startColumn: columnNumber } };
|
|
122
|
+
if (path$1[0] === '.') {
|
|
123
|
+
if (!workspaceFolder) {
|
|
124
|
+
return document.createTextNode(text);
|
|
125
|
+
}
|
|
126
|
+
const uri = workspaceFolder.toResource(path$1);
|
|
127
|
+
const link = this.createLink(text);
|
|
128
|
+
this.decorateLink(link, uri, fulltext, (preserveFocus) => this.editorService.openEditor({ resource: uri, options: { ...options, preserveFocus } }));
|
|
129
|
+
return link;
|
|
130
|
+
}
|
|
131
|
+
if (path$1[0] === '~') {
|
|
132
|
+
const userHome = this.pathService.resolvedUserHome;
|
|
133
|
+
if (userHome) {
|
|
134
|
+
path$1 = path.join(userHome.fsPath, path$1.substring(1));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const link = this.createLink(text);
|
|
138
|
+
link.tabIndex = 0;
|
|
139
|
+
const uri = URI.file(path.normalize(path$1));
|
|
140
|
+
this.fileService.stat(uri).then(stat => {
|
|
141
|
+
if (stat.isDirectory) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this.decorateLink(link, uri, fulltext, (preserveFocus) => this.editorService.openEditor({ resource: uri, options: { ...options, preserveFocus } }));
|
|
145
|
+
}).catch(() => {
|
|
146
|
+
});
|
|
147
|
+
return link;
|
|
148
|
+
}
|
|
149
|
+
createLink(text) {
|
|
150
|
+
const link = document.createElement('a');
|
|
151
|
+
link.textContent = text;
|
|
152
|
+
return link;
|
|
153
|
+
}
|
|
154
|
+
decorateLink(link, uri, fulltext, onClick) {
|
|
155
|
+
link.classList.add('link');
|
|
156
|
+
const followLink = this.tunnelService.canTunnel(uri) ? ( localize('followForwardedLink', "follow link using forwarded port")) : ( localize('followLink', "follow link"));
|
|
157
|
+
link.title = fulltext
|
|
158
|
+
? (platform.isMacintosh ? ( localize('fileLinkWithPathMac', "Cmd + click to {0}\n{1}", followLink, fulltext)) : ( localize('fileLinkWithPath', "Ctrl + click to {0}\n{1}", followLink, fulltext)))
|
|
159
|
+
: (platform.isMacintosh ? ( localize('fileLinkMac', "Cmd + click to {0}", followLink)) : ( localize('fileLink', "Ctrl + click to {0}", followLink)));
|
|
160
|
+
link.onmousemove = (event) => { link.classList.toggle('pointer', platform.isMacintosh ? event.metaKey : event.ctrlKey); };
|
|
161
|
+
link.onmouseleave = () => link.classList.remove('pointer');
|
|
162
|
+
link.onclick = (event) => {
|
|
163
|
+
const selection = window.getSelection();
|
|
164
|
+
if (!selection || selection.type === 'Range') {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!(platform.isMacintosh ? event.metaKey : event.ctrlKey)) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
event.stopImmediatePropagation();
|
|
172
|
+
onClick(false);
|
|
173
|
+
};
|
|
174
|
+
link.onkeydown = e => {
|
|
175
|
+
const event = ( new StandardKeyboardEvent(e));
|
|
176
|
+
if (event.keyCode === 3 || event.keyCode === 10 ) {
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
event.stopPropagation();
|
|
179
|
+
onClick(event.keyCode === 10 );
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
detectLinks(text) {
|
|
184
|
+
if (text.length > MAX_LENGTH) {
|
|
185
|
+
return [{ kind: 'text', value: text, captures: [] }];
|
|
186
|
+
}
|
|
187
|
+
const regexes = [WEB_LINK_REGEX, PATH_LINK_REGEX];
|
|
188
|
+
const kinds = ['web', 'path'];
|
|
189
|
+
const result = [];
|
|
190
|
+
const splitOne = (text, regexIndex) => {
|
|
191
|
+
if (regexIndex >= regexes.length) {
|
|
192
|
+
result.push({ value: text, kind: 'text', captures: [] });
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const regex = regexes[regexIndex];
|
|
196
|
+
let currentIndex = 0;
|
|
197
|
+
let match;
|
|
198
|
+
regex.lastIndex = 0;
|
|
199
|
+
while ((match = regex.exec(text)) !== null) {
|
|
200
|
+
const stringBeforeMatch = text.substring(currentIndex, match.index);
|
|
201
|
+
if (stringBeforeMatch) {
|
|
202
|
+
splitOne(stringBeforeMatch, regexIndex + 1);
|
|
203
|
+
}
|
|
204
|
+
const value = match[0];
|
|
205
|
+
result.push({
|
|
206
|
+
value: value,
|
|
207
|
+
kind: kinds[regexIndex],
|
|
208
|
+
captures: match.slice(1)
|
|
209
|
+
});
|
|
210
|
+
currentIndex = match.index + value.length;
|
|
211
|
+
}
|
|
212
|
+
const stringAfterMatches = text.substring(currentIndex);
|
|
213
|
+
if (stringAfterMatches) {
|
|
214
|
+
splitOne(stringAfterMatches, regexIndex + 1);
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
splitOne(text, 0);
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
LinkDetector = ( __decorate([
|
|
222
|
+
( __param(0, IEditorService)),
|
|
223
|
+
( __param(1, IFileService)),
|
|
224
|
+
( __param(2, IOpenerService)),
|
|
225
|
+
( __param(3, IPathService)),
|
|
226
|
+
( __param(4, ITunnelService)),
|
|
227
|
+
( __param(5, IWorkbenchEnvironmentService)),
|
|
228
|
+
( __param(6, IConfigurationService))
|
|
229
|
+
], LinkDetector));
|
|
230
|
+
|
|
231
|
+
export { LinkDetector };
|