@codingame/monaco-vscode-debug-service-override 4.0.0 → 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.
Files changed (60) hide show
  1. package/debug.js +4 -4
  2. package/package.json +2 -2
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -10
  6. package/vscode/src/vs/platform/debug/common/extensionHostDebugIpc.js +0 -73
  7. package/vscode/src/vs/workbench/contrib/debug/browser/callStackView.js +0 -1026
  8. package/vscode/src/vs/workbench/contrib/debug/browser/debug.contribution.js +0 -1004
  9. package/vscode/src/vs/workbench/contrib/debug/browser/debugANSIHandling.js +0 -347
  10. package/vscode/src/vs/workbench/contrib/debug/browser/debugActionViewItems.js +0 -337
  11. package/vscode/src/vs/workbench/contrib/debug/browser/debugAdapterManager.js +0 -432
  12. package/vscode/src/vs/workbench/contrib/debug/browser/debugCommands.js +0 -1039
  13. package/vscode/src/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +0 -649
  14. package/vscode/src/vs/workbench/contrib/debug/browser/debugConsoleQuickAccess.js +0 -64
  15. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorActions.js +0 -636
  16. package/vscode/src/vs/workbench/contrib/debug/browser/debugEditorContribution.js +0 -740
  17. package/vscode/src/vs/workbench/contrib/debug/browser/debugHover.js +0 -408
  18. package/vscode/src/vs/workbench/contrib/debug/browser/debugMemory.js +0 -206
  19. package/vscode/src/vs/workbench/contrib/debug/browser/debugProgress.js +0 -80
  20. package/vscode/src/vs/workbench/contrib/debug/browser/debugQuickAccess.js +0 -169
  21. package/vscode/src/vs/workbench/contrib/debug/browser/debugService.js +0 -1271
  22. package/vscode/src/vs/workbench/contrib/debug/browser/debugSession.js +0 -1330
  23. package/vscode/src/vs/workbench/contrib/debug/browser/debugSessionPicker.js +0 -115
  24. package/vscode/src/vs/workbench/contrib/debug/browser/debugStatus.js +0 -77
  25. package/vscode/src/vs/workbench/contrib/debug/browser/debugTaskRunner.js +0 -307
  26. package/vscode/src/vs/workbench/contrib/debug/browser/debugTitle.js +0 -31
  27. package/vscode/src/vs/workbench/contrib/debug/browser/debugToolBar.js +0 -387
  28. package/vscode/src/vs/workbench/contrib/debug/browser/debugViewlet.js +0 -267
  29. package/vscode/src/vs/workbench/contrib/debug/browser/disassemblyView.js +0 -817
  30. package/vscode/src/vs/workbench/contrib/debug/browser/exceptionWidget.js +0 -131
  31. package/vscode/src/vs/workbench/contrib/debug/browser/extensionHostDebugService.js +0 -142
  32. package/vscode/src/vs/workbench/contrib/debug/browser/linkDetector.js +0 -262
  33. package/vscode/src/vs/workbench/contrib/debug/browser/loadedScriptsView.js +0 -669
  34. package/vscode/src/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +0 -6
  35. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugHover.css.js +0 -6
  36. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +0 -6
  37. package/vscode/src/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +0 -6
  38. package/vscode/src/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +0 -6
  39. package/vscode/src/vs/workbench/contrib/debug/browser/media/repl.css.js +0 -6
  40. package/vscode/src/vs/workbench/contrib/debug/browser/rawDebugSession.js +0 -709
  41. package/vscode/src/vs/workbench/contrib/debug/browser/repl.js +0 -1002
  42. package/vscode/src/vs/workbench/contrib/debug/browser/replFilter.js +0 -48
  43. package/vscode/src/vs/workbench/contrib/debug/browser/replViewer.js +0 -352
  44. package/vscode/src/vs/workbench/contrib/debug/browser/statusbarColorProvider.js +0 -129
  45. package/vscode/src/vs/workbench/contrib/debug/browser/variablesView.js +0 -734
  46. package/vscode/src/vs/workbench/contrib/debug/browser/watchExpressionsView.js +0 -501
  47. package/vscode/src/vs/workbench/contrib/debug/browser/welcomeView.js +0 -162
  48. package/vscode/src/vs/workbench/contrib/debug/common/breakpoints.js +0 -21
  49. package/vscode/src/vs/workbench/contrib/debug/common/debugCompoundRoot.js +0 -17
  50. package/vscode/src/vs/workbench/contrib/debug/common/debugContentProvider.js +0 -110
  51. package/vscode/src/vs/workbench/contrib/debug/common/debugLifecycle.js +0 -62
  52. package/vscode/src/vs/workbench/contrib/debug/common/debugSchemas.js +0 -460
  53. package/vscode/src/vs/workbench/contrib/debug/common/debugStorage.js +0 -166
  54. package/vscode/src/vs/workbench/contrib/debug/common/debugTelemetry.js +0 -36
  55. package/vscode/src/vs/workbench/contrib/debug/common/debugViewModel.js +0 -150
  56. package/vscode/src/vs/workbench/contrib/debug/common/debugger.js +0 -289
  57. package/vscode/src/vs/workbench/contrib/debug/common/loadedScriptsPicker.js +0 -87
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableCommands.js +0 -64
  59. package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +0 -311
  60. package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +0 -29
@@ -1,131 +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/colorUtils';
11
- import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
12
- import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
13
- import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
14
- import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
15
- import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
16
- import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
17
- import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
18
- import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
19
- import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
20
- import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
21
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
22
- import { LinkDetector } from './linkDetector.js';
23
- import { ActionBar } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionbar';
24
- import { Action } from 'vscode/vscode/vs/base/common/actions';
25
- import { widgetClose } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
26
-
27
- const $ = $$1;
28
- const debugExceptionWidgetBorder = registerColor('debugExceptionWidget.border', { dark: '#a31515', light: '#a31515', hcDark: '#a31515', hcLight: '#a31515' }, ( localizeWithPath(
29
- 'vs/workbench/contrib/debug/browser/exceptionWidget',
30
- 'debugExceptionWidgetBorder',
31
- 'Exception widget border color.'
32
- )));
33
- const debugExceptionWidgetBackground = registerColor('debugExceptionWidget.background', { dark: '#420b0d', light: '#f1dfde', hcDark: '#420b0d', hcLight: '#f1dfde' }, ( localizeWithPath(
34
- 'vs/workbench/contrib/debug/browser/exceptionWidget',
35
- 'debugExceptionWidgetBackground',
36
- 'Exception widget background color.'
37
- )));
38
- let ExceptionWidget = class ExceptionWidget extends ZoneWidget {
39
- constructor(editor, exceptionInfo, debugSession, themeService, instantiationService) {
40
- super(editor, { showFrame: true, showArrow: true, isAccessible: true, frameWidth: 1, className: 'exception-widget-container' });
41
- this.exceptionInfo = exceptionInfo;
42
- this.debugSession = debugSession;
43
- this.instantiationService = instantiationService;
44
- this.applyTheme(themeService.getColorTheme());
45
- this._disposables.add(themeService.onDidColorThemeChange(this.applyTheme.bind(this)));
46
- this.create();
47
- const onDidLayoutChangeScheduler = ( new RunOnceScheduler(() => this._doLayout(undefined, undefined), 50));
48
- this._disposables.add(this.editor.onDidLayoutChange(() => onDidLayoutChangeScheduler.schedule()));
49
- this._disposables.add(onDidLayoutChangeScheduler);
50
- }
51
- applyTheme(theme) {
52
- this.backgroundColor = theme.getColor(debugExceptionWidgetBackground);
53
- const frameColor = theme.getColor(debugExceptionWidgetBorder);
54
- this.style({
55
- arrowColor: frameColor,
56
- frameColor: frameColor
57
- });
58
- }
59
- _applyStyles() {
60
- if (this.container) {
61
- this.container.style.backgroundColor = this.backgroundColor ? ( this.backgroundColor.toString()) : '';
62
- }
63
- super._applyStyles();
64
- }
65
- _fillContainer(container) {
66
- this.setCssClass('exception-widget');
67
- const fontInfo = this.editor.getOption(50 );
68
- container.style.fontSize = `${fontInfo.fontSize}px`;
69
- container.style.lineHeight = `${fontInfo.lineHeight}px`;
70
- container.tabIndex = 0;
71
- const title = $('.title');
72
- const label = $('.label');
73
- append(title, label);
74
- const actions = $('.actions');
75
- append(title, actions);
76
- label.textContent = this.exceptionInfo.id ? ( localizeWithPath(
77
- 'vs/workbench/contrib/debug/browser/exceptionWidget',
78
- 'exceptionThrownWithId',
79
- 'Exception has occurred: {0}',
80
- this.exceptionInfo.id
81
- )) : ( localizeWithPath(
82
- 'vs/workbench/contrib/debug/browser/exceptionWidget',
83
- 'exceptionThrown',
84
- 'Exception has occurred.'
85
- ));
86
- let ariaLabel = label.textContent;
87
- const actionBar = ( new ActionBar(actions));
88
- actionBar.push(( new Action('editor.closeExceptionWidget', ( localizeWithPath('vs/workbench/contrib/debug/browser/exceptionWidget', 'close', "Close")), ThemeIcon.asClassName(widgetClose), true, async () => {
89
- const contribution = this.editor.getContribution(EDITOR_CONTRIBUTION_ID);
90
- contribution?.closeExceptionWidget();
91
- })), { label: false, icon: true });
92
- append(container, title);
93
- if (this.exceptionInfo.description) {
94
- const description = $('.description');
95
- description.textContent = this.exceptionInfo.description;
96
- ariaLabel += ', ' + this.exceptionInfo.description;
97
- append(container, description);
98
- }
99
- if (this.exceptionInfo.details && this.exceptionInfo.details.stackTrace) {
100
- const stackTrace = $('.stack-trace');
101
- const linkDetector = this.instantiationService.createInstance(LinkDetector);
102
- const linkedStackTrace = linkDetector.linkify(this.exceptionInfo.details.stackTrace, true, this.debugSession ? this.debugSession.root : undefined);
103
- stackTrace.appendChild(linkedStackTrace);
104
- append(container, stackTrace);
105
- ariaLabel += ', ' + this.exceptionInfo.details.stackTrace;
106
- }
107
- container.setAttribute('aria-label', ariaLabel);
108
- }
109
- _doLayout(_heightInPixel, _widthInPixel) {
110
- this.container.style.height = 'initial';
111
- const lineHeight = this.editor.getOption(67 );
112
- const arrowHeight = Math.round(lineHeight / 3);
113
- const computedLinesNumber = Math.ceil((this.container.offsetHeight + arrowHeight) / lineHeight);
114
- this._relayout(computedLinesNumber);
115
- }
116
- focus() {
117
- this.container?.focus();
118
- }
119
- hasFocus() {
120
- if (!this.container) {
121
- return false;
122
- }
123
- return isAncestorOfActiveElement(this.container);
124
- }
125
- };
126
- ExceptionWidget = ( __decorate([
127
- ( __param(3, IThemeService)),
128
- ( __param(4, IInstantiationService))
129
- ], ExceptionWidget));
130
-
131
- export { ExceptionWidget };
@@ -1,142 +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 'vscode/vscode/vs/platform/instantiation/common/instantiation';
5
- import { ExtensionHostDebugChannelClient, ExtensionHostDebugBroadcastChannel } from '../../../../platform/debug/common/extensionHostDebugIpc.js';
6
- import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
7
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
8
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
9
- import { isFolderToOpen, isWorkspaceToOpen } from 'vscode/vscode/vs/platform/window/common/window';
10
- import { toWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, hasWorkspaceFileExtension, IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
11
- import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService';
12
- import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
13
- import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
14
-
15
- var BrowserExtensionHostDebugService_1;
16
- let BrowserExtensionHostDebugService = class BrowserExtensionHostDebugService extends ExtensionHostDebugChannelClient {
17
- static { BrowserExtensionHostDebugService_1 = this; }
18
- static { this.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY = 'debug.lastExtensionDevelopmentWorkspace'; }
19
- constructor(remoteAgentService, environmentService, logService, hostService, contextService, storageService, fileService) {
20
- const connection = remoteAgentService.getConnection();
21
- let channel;
22
- if (connection) {
23
- channel = connection.getChannel(ExtensionHostDebugBroadcastChannel.ChannelName);
24
- }
25
- else {
26
- channel = { call: async () => undefined, listen: () => Event.None };
27
- }
28
- super(channel);
29
- this.storageService = storageService;
30
- this.fileService = fileService;
31
- if (environmentService.options && environmentService.options.workspaceProvider) {
32
- this.workspaceProvider = environmentService.options.workspaceProvider;
33
- }
34
- else {
35
- this.workspaceProvider = { open: async () => true, workspace: undefined, trusted: undefined };
36
- logService.warn('Extension Host Debugging not available due to missing workspace provider.');
37
- }
38
- this._register(this.onReload(event => {
39
- if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
40
- hostService.reload();
41
- }
42
- }));
43
- this._register(this.onClose(event => {
44
- if (environmentService.isExtensionDevelopment && environmentService.debugExtensionHost.debugId === event.sessionId) {
45
- hostService.close();
46
- }
47
- }));
48
- if (environmentService.isExtensionDevelopment && !environmentService.extensionTestsLocationURI) {
49
- const workspaceId = toWorkspaceIdentifier(contextService.getWorkspace());
50
- if (isSingleFolderWorkspaceIdentifier(workspaceId) || isWorkspaceIdentifier(workspaceId)) {
51
- const serializedWorkspace = isSingleFolderWorkspaceIdentifier(workspaceId) ? { folderUri: workspaceId.uri.toJSON() } : { workspaceUri: workspaceId.configPath.toJSON() };
52
- storageService.store(BrowserExtensionHostDebugService_1.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY, JSON.stringify(serializedWorkspace), 0 , 1 );
53
- }
54
- else {
55
- storageService.remove(BrowserExtensionHostDebugService_1.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY, 0 );
56
- }
57
- }
58
- }
59
- async openExtensionDevelopmentHostWindow(args, _debugRenderer) {
60
- const environment = ( new Map());
61
- const fileUriArg = this.findArgument('file-uri', args);
62
- if (fileUriArg && !hasWorkspaceFileExtension(fileUriArg)) {
63
- environment.set('openFile', fileUriArg);
64
- }
65
- const copyArgs = [
66
- 'extensionDevelopmentPath',
67
- 'extensionTestsPath',
68
- 'extensionEnvironment',
69
- 'debugId',
70
- 'inspect-brk-extensions',
71
- 'inspect-extensions',
72
- ];
73
- for (const argName of copyArgs) {
74
- const value = this.findArgument(argName, args);
75
- if (value) {
76
- environment.set(argName, value);
77
- }
78
- }
79
- let debugWorkspace = undefined;
80
- const folderUriArg = this.findArgument('folder-uri', args);
81
- if (folderUriArg) {
82
- debugWorkspace = { folderUri: ( URI.parse(folderUriArg)) };
83
- }
84
- else {
85
- const fileUriArg = this.findArgument('file-uri', args);
86
- if (fileUriArg && hasWorkspaceFileExtension(fileUriArg)) {
87
- debugWorkspace = { workspaceUri: ( URI.parse(fileUriArg)) };
88
- }
89
- }
90
- const extensionTestsPath = this.findArgument('extensionTestsPath', args);
91
- if (!debugWorkspace && !extensionTestsPath) {
92
- const lastExtensionDevelopmentWorkspace = this.storageService.get(BrowserExtensionHostDebugService_1.LAST_EXTENSION_DEVELOPMENT_WORKSPACE_KEY, 0 );
93
- if (lastExtensionDevelopmentWorkspace) {
94
- try {
95
- const serializedWorkspace = JSON.parse(lastExtensionDevelopmentWorkspace);
96
- if (serializedWorkspace.workspaceUri) {
97
- debugWorkspace = { workspaceUri: URI.revive(serializedWorkspace.workspaceUri) };
98
- }
99
- else if (serializedWorkspace.folderUri) {
100
- debugWorkspace = { folderUri: URI.revive(serializedWorkspace.folderUri) };
101
- }
102
- }
103
- catch (error) {
104
- }
105
- }
106
- }
107
- if (debugWorkspace) {
108
- const debugWorkspaceResource = isFolderToOpen(debugWorkspace) ? debugWorkspace.folderUri : isWorkspaceToOpen(debugWorkspace) ? debugWorkspace.workspaceUri : undefined;
109
- if (debugWorkspaceResource) {
110
- const workspaceExists = await this.fileService.exists(debugWorkspaceResource);
111
- if (!workspaceExists) {
112
- debugWorkspace = undefined;
113
- }
114
- }
115
- }
116
- const success = await this.workspaceProvider.open(debugWorkspace, {
117
- reuse: false,
118
- payload: Array.from(environment.entries())
119
- });
120
- return { success };
121
- }
122
- findArgument(key, args) {
123
- for (const a of args) {
124
- const k = `--${key}=`;
125
- if (a.indexOf(k) === 0) {
126
- return a.substring(k.length);
127
- }
128
- }
129
- return undefined;
130
- }
131
- };
132
- BrowserExtensionHostDebugService = BrowserExtensionHostDebugService_1 = ( __decorate([
133
- ( __param(0, IRemoteAgentService)),
134
- ( __param(1, IBrowserWorkbenchEnvironmentService)),
135
- ( __param(2, ILogService)),
136
- ( __param(3, IHostService)),
137
- ( __param(4, IWorkspaceContextService)),
138
- ( __param(5, IStorageService)),
139
- ( __param(6, IFileService))
140
- ], BrowserExtensionHostDebugService));
141
-
142
- 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 };