@theia/terminal 1.45.0 → 1.46.0-next.72

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 (126) hide show
  1. package/README.md +30 -30
  2. package/lib/browser/base/terminal-service.d.ts +34 -34
  3. package/lib/browser/base/terminal-service.js +7 -7
  4. package/lib/browser/base/terminal-widget.d.ts +192 -192
  5. package/lib/browser/base/terminal-widget.js +34 -34
  6. package/lib/browser/index.d.ts +1 -1
  7. package/lib/browser/index.js +28 -28
  8. package/lib/browser/search/terminal-search-container.d.ts +3 -3
  9. package/lib/browser/search/terminal-search-container.js +28 -28
  10. package/lib/browser/search/terminal-search-widget.d.ts +30 -30
  11. package/lib/browser/search/terminal-search-widget.js +147 -147
  12. package/lib/browser/shell-terminal-profile.d.ts +20 -20
  13. package/lib/browser/shell-terminal-profile.js +42 -42
  14. package/lib/browser/terminal-contribution.d.ts +3 -3
  15. package/lib/browser/terminal-contribution.js +20 -20
  16. package/lib/browser/terminal-copy-on-selection-handler.d.ts +10 -10
  17. package/lib/browser/terminal-copy-on-selection-handler.js +103 -103
  18. package/lib/browser/terminal-file-link-provider.d.ts +24 -24
  19. package/lib/browser/terminal-file-link-provider.js +200 -200
  20. package/lib/browser/terminal-frontend-contribution.d.ts +115 -115
  21. package/lib/browser/terminal-frontend-contribution.d.ts.map +1 -1
  22. package/lib/browser/terminal-frontend-contribution.js +1078 -1056
  23. package/lib/browser/terminal-frontend-contribution.js.map +1 -1
  24. package/lib/browser/terminal-frontend-module.d.ts +5 -5
  25. package/lib/browser/terminal-frontend-module.js +117 -117
  26. package/lib/browser/terminal-link-helpers.d.ts +27 -27
  27. package/lib/browser/terminal-link-helpers.js +155 -155
  28. package/lib/browser/terminal-link-provider.d.ts +51 -51
  29. package/lib/browser/terminal-link-provider.js +197 -197
  30. package/lib/browser/terminal-preferences.d.ts +61 -61
  31. package/lib/browser/terminal-preferences.d.ts.map +1 -1
  32. package/lib/browser/terminal-preferences.js +357 -356
  33. package/lib/browser/terminal-preferences.js.map +1 -1
  34. package/lib/browser/terminal-profile-service.d.ts +58 -58
  35. package/lib/browser/terminal-profile-service.js +158 -158
  36. package/lib/browser/terminal-quick-open-service.d.ts +36 -36
  37. package/lib/browser/terminal-quick-open-service.js +137 -137
  38. package/lib/browser/terminal-theme-service.d.ts +21 -21
  39. package/lib/browser/terminal-theme-service.d.ts.map +1 -1
  40. package/lib/browser/terminal-theme-service.js +222 -218
  41. package/lib/browser/terminal-theme-service.js.map +1 -1
  42. package/lib/browser/terminal-url-link-provider.d.ts +11 -11
  43. package/lib/browser/terminal-url-link-provider.js +76 -76
  44. package/lib/browser/terminal-widget-impl.d.ts +180 -187
  45. package/lib/browser/terminal-widget-impl.d.ts.map +1 -1
  46. package/lib/browser/terminal-widget-impl.js +857 -867
  47. package/lib/browser/terminal-widget-impl.js.map +1 -1
  48. package/lib/common/base-terminal-protocol.d.ts +55 -55
  49. package/lib/common/base-terminal-protocol.js +84 -84
  50. package/lib/common/shell-terminal-protocol.d.ts +66 -66
  51. package/lib/common/shell-terminal-protocol.js +35 -35
  52. package/lib/common/terminal-common-module.d.ts +7 -7
  53. package/lib/common/terminal-common-module.js +31 -31
  54. package/lib/common/terminal-protocol.d.ts +12 -12
  55. package/lib/common/terminal-protocol.js +21 -21
  56. package/lib/common/terminal-watcher.d.ts +13 -13
  57. package/lib/common/terminal-watcher.js +70 -70
  58. package/lib/node/base-terminal-server.d.ts +24 -24
  59. package/lib/node/base-terminal-server.js +168 -168
  60. package/lib/node/buffering-stream.d.ts +39 -39
  61. package/lib/node/buffering-stream.js +75 -75
  62. package/lib/node/buffering-stream.spec.d.ts +1 -1
  63. package/lib/node/buffering-stream.spec.js +43 -43
  64. package/lib/node/index.d.ts +1 -1
  65. package/lib/node/index.js +28 -28
  66. package/lib/node/shell-process.d.ts +27 -27
  67. package/lib/node/shell-process.js +107 -107
  68. package/lib/node/shell-process.js.map +1 -1
  69. package/lib/node/shell-terminal-server.d.ts +30 -30
  70. package/lib/node/shell-terminal-server.js +212 -212
  71. package/lib/node/shell-terminal-server.spec.d.ts +1 -1
  72. package/lib/node/shell-terminal-server.spec.js +35 -35
  73. package/lib/node/terminal-backend-contribution.d.ts +9 -9
  74. package/lib/node/terminal-backend-contribution.js +75 -75
  75. package/lib/node/terminal-backend-contribution.slow-spec.d.ts +1 -1
  76. package/lib/node/terminal-backend-contribution.slow-spec.js +54 -54
  77. package/lib/node/terminal-backend-module.d.ts +11 -11
  78. package/lib/node/terminal-backend-module.js +69 -69
  79. package/lib/node/terminal-server.d.ts +9 -9
  80. package/lib/node/terminal-server.js +64 -64
  81. package/lib/node/terminal-server.spec.d.ts +1 -1
  82. package/lib/node/terminal-server.spec.js +41 -41
  83. package/lib/node/test/terminal-test-container.d.ts +2 -2
  84. package/lib/node/test/terminal-test-container.js +40 -40
  85. package/lib/package.spec.js +25 -25
  86. package/package.json +12 -12
  87. package/src/browser/base/terminal-service.ts +60 -60
  88. package/src/browser/base/terminal-widget.ts +254 -254
  89. package/src/browser/index.ts +17 -17
  90. package/src/browser/search/terminal-search-container.ts +28 -28
  91. package/src/browser/search/terminal-search-widget.tsx +161 -161
  92. package/src/browser/shell-terminal-profile.ts +45 -45
  93. package/src/browser/style/terminal-search.css +99 -99
  94. package/src/browser/style/terminal.css +32 -32
  95. package/src/browser/terminal-contribution.ts +19 -19
  96. package/src/browser/terminal-copy-on-selection-handler.ts +92 -92
  97. package/src/browser/terminal-file-link-provider.ts +200 -200
  98. package/src/browser/terminal-frontend-contribution.ts +1120 -1098
  99. package/src/browser/terminal-frontend-module.ts +136 -136
  100. package/src/browser/terminal-link-helpers.ts +187 -187
  101. package/src/browser/terminal-link-provider.ts +203 -203
  102. package/src/browser/terminal-preferences.ts +428 -427
  103. package/src/browser/terminal-profile-service.ts +180 -180
  104. package/src/browser/terminal-quick-open-service.ts +132 -132
  105. package/src/browser/terminal-theme-service.ts +213 -209
  106. package/src/browser/terminal-url-link-provider.ts +66 -66
  107. package/src/browser/terminal-widget-impl.ts +939 -936
  108. package/src/common/base-terminal-protocol.ts +125 -125
  109. package/src/common/shell-terminal-protocol.ts +103 -103
  110. package/src/common/terminal-common-module.ts +30 -30
  111. package/src/common/terminal-protocol.ts +32 -32
  112. package/src/common/terminal-watcher.ts +69 -69
  113. package/src/node/base-terminal-server.ts +173 -173
  114. package/src/node/buffering-stream.spec.ts +46 -46
  115. package/src/node/buffering-stream.ts +95 -95
  116. package/src/node/index.ts +17 -17
  117. package/src/node/shell-process.ts +101 -101
  118. package/src/node/shell-terminal-server.spec.ts +40 -40
  119. package/src/node/shell-terminal-server.ts +221 -221
  120. package/src/node/terminal-backend-contribution.slow-spec.ts +63 -63
  121. package/src/node/terminal-backend-contribution.ts +60 -60
  122. package/src/node/terminal-backend-module.ts +82 -82
  123. package/src/node/terminal-server.spec.ts +47 -47
  124. package/src/node/terminal-server.ts +52 -52
  125. package/src/node/test/terminal-test-container.ts +39 -39
  126. package/src/package.spec.ts +28 -28
@@ -1,201 +1,201 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 TypeFox and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.FileDiffPostLinkProvider = exports.FileDiffPreLinkProvider = exports.FileLinkProvider = void 0;
28
- const core_1 = require("@theia/core");
29
- const browser_1 = require("@theia/core/lib/browser");
30
- const inversify_1 = require("@theia/core/shared/inversify");
31
- const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
32
- const terminal_widget_impl_1 = require("./terminal-widget-impl");
33
- let FileLinkProvider = class FileLinkProvider {
34
- async provideLinks(line, terminal) {
35
- const links = [];
36
- const regExp = await this.createRegExp();
37
- let regExpResult;
38
- while (regExpResult = regExp.exec(line)) {
39
- const match = regExpResult[0];
40
- if (await this.isValidFile(match, terminal)) {
41
- links.push({
42
- startIndex: regExp.lastIndex - match.length,
43
- length: match.length,
44
- handle: () => this.open(match, terminal)
45
- });
46
- }
47
- }
48
- return links;
49
- }
50
- async createRegExp() {
51
- const baseLocalLinkClause = core_1.OS.backend.isWindows ? winLocalLinkClause : unixLocalLinkClause;
52
- return new RegExp(`${baseLocalLinkClause}(${lineAndColumnClause})`, 'g');
53
- }
54
- async isValidFile(match, terminal) {
55
- try {
56
- const toOpen = await this.toURI(match, await this.getCwd(terminal));
57
- if (toOpen) {
58
- // TODO: would be better to ask the opener service, but it returns positively even for unknown files.
59
- try {
60
- const stat = await this.fileService.resolve(toOpen);
61
- return !stat.isDirectory;
62
- }
63
- catch { }
64
- }
65
- }
66
- catch (err) {
67
- console.trace('Error validating ' + match, err);
68
- }
69
- return false;
70
- }
71
- async toURI(match, cwd) {
72
- const path = await this.extractPath(match);
73
- if (!path) {
74
- return;
75
- }
76
- const pathObj = new core_1.Path(path);
77
- return pathObj.isAbsolute ? cwd.withPath(path) : cwd.resolve(path);
78
- }
79
- async getCwd(terminal) {
80
- if (terminal instanceof terminal_widget_impl_1.TerminalWidgetImpl) {
81
- return terminal.cwd;
82
- }
83
- return terminal.lastCwd;
84
- }
85
- async extractPath(link) {
86
- const matches = (await this.createRegExp()).exec(link);
87
- if (!matches) {
88
- return undefined;
89
- }
90
- return matches[1];
91
- }
92
- async open(match, terminal) {
93
- const toOpen = await this.toURI(match, await this.getCwd(terminal));
94
- if (!toOpen) {
95
- return;
96
- }
97
- const position = await this.extractPosition(match);
98
- let options = {};
99
- if (position) {
100
- options = { selection: { start: position } };
101
- }
102
- try {
103
- const opener = await this.openerService.getOpener(toOpen, options);
104
- opener.open(toOpen, options);
105
- }
106
- catch (err) {
107
- console.error('Cannot open link ' + match, err);
108
- }
109
- }
110
- async extractPosition(link) {
111
- const matches = (await this.createRegExp()).exec(link);
112
- const info = { line: 1, character: 1 };
113
- if (!matches) {
114
- return info;
115
- }
116
- const lineAndColumnMatchIndex = core_1.OS.backend.isWindows ? winLineAndColumnMatchIndex : unixLineAndColumnMatchIndex;
117
- for (let i = 0; i < lineAndColumnClause.length; i++) {
118
- const lineMatchIndex = lineAndColumnMatchIndex + (lineAndColumnClauseGroupCount * i);
119
- const rowNumber = matches[lineMatchIndex];
120
- if (rowNumber) {
121
- info.line = parseInt(rowNumber, 10) - 1;
122
- const columnNumber = matches[lineMatchIndex + 2];
123
- if (columnNumber) {
124
- info.character = parseInt(columnNumber, 10) - 1;
125
- }
126
- break;
127
- }
128
- }
129
- return info;
130
- }
131
- };
132
- __decorate([
133
- (0, inversify_1.inject)(browser_1.OpenerService),
134
- __metadata("design:type", Object)
135
- ], FileLinkProvider.prototype, "openerService", void 0);
136
- __decorate([
137
- (0, inversify_1.inject)(file_service_1.FileService),
138
- __metadata("design:type", file_service_1.FileService)
139
- ], FileLinkProvider.prototype, "fileService", void 0);
140
- FileLinkProvider = __decorate([
141
- (0, inversify_1.injectable)()
142
- ], FileLinkProvider);
143
- exports.FileLinkProvider = FileLinkProvider;
144
- let FileDiffPreLinkProvider = class FileDiffPreLinkProvider extends FileLinkProvider {
145
- async createRegExp() {
146
- return /^--- a\/(\S*)/g;
147
- }
148
- };
149
- FileDiffPreLinkProvider = __decorate([
150
- (0, inversify_1.injectable)()
151
- ], FileDiffPreLinkProvider);
152
- exports.FileDiffPreLinkProvider = FileDiffPreLinkProvider;
153
- let FileDiffPostLinkProvider = class FileDiffPostLinkProvider extends FileLinkProvider {
154
- async createRegExp() {
155
- return /^\+\+\+ b\/(\S*)/g;
156
- }
157
- };
158
- FileDiffPostLinkProvider = __decorate([
159
- (0, inversify_1.injectable)()
160
- ], FileDiffPostLinkProvider);
161
- exports.FileDiffPostLinkProvider = FileDiffPostLinkProvider;
162
- // The following regular expressions are taken from:
163
- // https://github.com/microsoft/vscode/blob/b118105bf28d773fbbce683f7230d058be2f89a7/src/vs/workbench/contrib/terminal/browser/links/terminalLocalLinkDetector.ts#L34-L58
164
- /*---------------------------------------------------------------------------------------------
165
- * Copyright (c) Microsoft Corporation. All rights reserved.
166
- * Licensed under the MIT License. See License.txt in the project root for license information.
167
- *--------------------------------------------------------------------------------------------*/
168
- const pathPrefix = '(\\.\\.?|\\~)';
169
- const pathSeparatorClause = '\\/';
170
- // '":; are allowed in paths but they are often separators so ignore them
171
- // Also disallow \\ to prevent a catastrophic backtracking case #24795
172
- const excludedPathCharactersClause = '[^\\0\\s!`&*()\\[\\]\'":;\\\\]';
173
- /** A regex that matches paths in the form /foo, ~/foo, ./foo, ../foo, foo/bar */
174
- const unixLocalLinkClause = '((' + pathPrefix + '|(' + excludedPathCharactersClause + ')+)?(' + pathSeparatorClause + '(' + excludedPathCharactersClause + ')+)+)';
175
- const winDrivePrefix = '(?:\\\\\\\\\\?\\\\)?[a-zA-Z]:';
176
- const winPathPrefix = '(' + winDrivePrefix + '|\\.\\.?|\\~)';
177
- const winPathSeparatorClause = '(\\\\|\\/)';
178
- const winExcludedPathCharactersClause = '[^\\0<>\\?\\|\\/\\s!`&*()\\[\\]\'":;]';
179
- /** A regex that matches paths in the form \\?\c:\foo c:\foo, ~\foo, .\foo, ..\foo, foo\bar */
180
- const winLocalLinkClause = '((' + winPathPrefix + '|(' + winExcludedPathCharactersClause + ')+)?(' + winPathSeparatorClause + '(' + winExcludedPathCharactersClause + ')+)+)';
181
- /** As xterm reads from DOM, space in that case is non-breaking char ASCII code - 160, replacing space with nonBreakingSpace or space ASCII code - 32. */
182
- const lineAndColumnClause = [
183
- // "(file path)", line 45 [see #40468]
184
- '((\\S*)[\'"], line ((\\d+)( column (\\d+))?))',
185
- // "(file path)",45 [see #78205]
186
- '((\\S*)[\'"],((\\d+)(:(\\d+))?))',
187
- // (file path) on line 8, column 13
188
- '((\\S*) on line ((\\d+)(, column (\\d+))?))',
189
- // (file path):line 8, column 13
190
- '((\\S*):line ((\\d+)(, column (\\d+))?))',
191
- // (file path)(45), (file path) (45), (file path)(45,18), (file path) (45,18), (file path)(45, 18), (file path) (45, 18), also with []
192
- '(([^\\s\\(\\)]*)(\\s?[\\(\\[](\\d+)(,\\s?(\\d+))?)[\\)\\]])',
193
- // (file path):336, (file path):336:9
194
- '(([^:\\s\\(\\)<>\'\"\\[\\]]*)(:(\\d+))?(:(\\d+))?)'
195
- ].join('|').replace(/ /g, `[${'\u00A0'} ]`);
196
- // Changing any regex may effect this value, hence changes this as well if required.
197
- const winLineAndColumnMatchIndex = 12;
198
- const unixLineAndColumnMatchIndex = 11;
199
- // Each line and column clause have 6 groups (ie no. of expressions in round brackets)
200
- const lineAndColumnClauseGroupCount = 6;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.FileDiffPostLinkProvider = exports.FileDiffPreLinkProvider = exports.FileLinkProvider = void 0;
28
+ const core_1 = require("@theia/core");
29
+ const browser_1 = require("@theia/core/lib/browser");
30
+ const inversify_1 = require("@theia/core/shared/inversify");
31
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
32
+ const terminal_widget_impl_1 = require("./terminal-widget-impl");
33
+ let FileLinkProvider = class FileLinkProvider {
34
+ async provideLinks(line, terminal) {
35
+ const links = [];
36
+ const regExp = await this.createRegExp();
37
+ let regExpResult;
38
+ while (regExpResult = regExp.exec(line)) {
39
+ const match = regExpResult[0];
40
+ if (await this.isValidFile(match, terminal)) {
41
+ links.push({
42
+ startIndex: regExp.lastIndex - match.length,
43
+ length: match.length,
44
+ handle: () => this.open(match, terminal)
45
+ });
46
+ }
47
+ }
48
+ return links;
49
+ }
50
+ async createRegExp() {
51
+ const baseLocalLinkClause = core_1.OS.backend.isWindows ? winLocalLinkClause : unixLocalLinkClause;
52
+ return new RegExp(`${baseLocalLinkClause}(${lineAndColumnClause})`, 'g');
53
+ }
54
+ async isValidFile(match, terminal) {
55
+ try {
56
+ const toOpen = await this.toURI(match, await this.getCwd(terminal));
57
+ if (toOpen) {
58
+ // TODO: would be better to ask the opener service, but it returns positively even for unknown files.
59
+ try {
60
+ const stat = await this.fileService.resolve(toOpen);
61
+ return !stat.isDirectory;
62
+ }
63
+ catch { }
64
+ }
65
+ }
66
+ catch (err) {
67
+ console.trace('Error validating ' + match, err);
68
+ }
69
+ return false;
70
+ }
71
+ async toURI(match, cwd) {
72
+ const path = await this.extractPath(match);
73
+ if (!path) {
74
+ return;
75
+ }
76
+ const pathObj = new core_1.Path(path);
77
+ return pathObj.isAbsolute ? cwd.withPath(path) : cwd.resolve(path);
78
+ }
79
+ async getCwd(terminal) {
80
+ if (terminal instanceof terminal_widget_impl_1.TerminalWidgetImpl) {
81
+ return terminal.cwd;
82
+ }
83
+ return terminal.lastCwd;
84
+ }
85
+ async extractPath(link) {
86
+ const matches = (await this.createRegExp()).exec(link);
87
+ if (!matches) {
88
+ return undefined;
89
+ }
90
+ return matches[1];
91
+ }
92
+ async open(match, terminal) {
93
+ const toOpen = await this.toURI(match, await this.getCwd(terminal));
94
+ if (!toOpen) {
95
+ return;
96
+ }
97
+ const position = await this.extractPosition(match);
98
+ let options = {};
99
+ if (position) {
100
+ options = { selection: { start: position } };
101
+ }
102
+ try {
103
+ const opener = await this.openerService.getOpener(toOpen, options);
104
+ opener.open(toOpen, options);
105
+ }
106
+ catch (err) {
107
+ console.error('Cannot open link ' + match, err);
108
+ }
109
+ }
110
+ async extractPosition(link) {
111
+ const matches = (await this.createRegExp()).exec(link);
112
+ const info = { line: 1, character: 1 };
113
+ if (!matches) {
114
+ return info;
115
+ }
116
+ const lineAndColumnMatchIndex = core_1.OS.backend.isWindows ? winLineAndColumnMatchIndex : unixLineAndColumnMatchIndex;
117
+ for (let i = 0; i < lineAndColumnClause.length; i++) {
118
+ const lineMatchIndex = lineAndColumnMatchIndex + (lineAndColumnClauseGroupCount * i);
119
+ const rowNumber = matches[lineMatchIndex];
120
+ if (rowNumber) {
121
+ info.line = parseInt(rowNumber, 10) - 1;
122
+ const columnNumber = matches[lineMatchIndex + 2];
123
+ if (columnNumber) {
124
+ info.character = parseInt(columnNumber, 10) - 1;
125
+ }
126
+ break;
127
+ }
128
+ }
129
+ return info;
130
+ }
131
+ };
132
+ __decorate([
133
+ (0, inversify_1.inject)(browser_1.OpenerService),
134
+ __metadata("design:type", Object)
135
+ ], FileLinkProvider.prototype, "openerService", void 0);
136
+ __decorate([
137
+ (0, inversify_1.inject)(file_service_1.FileService),
138
+ __metadata("design:type", file_service_1.FileService)
139
+ ], FileLinkProvider.prototype, "fileService", void 0);
140
+ FileLinkProvider = __decorate([
141
+ (0, inversify_1.injectable)()
142
+ ], FileLinkProvider);
143
+ exports.FileLinkProvider = FileLinkProvider;
144
+ let FileDiffPreLinkProvider = class FileDiffPreLinkProvider extends FileLinkProvider {
145
+ async createRegExp() {
146
+ return /^--- a\/(\S*)/g;
147
+ }
148
+ };
149
+ FileDiffPreLinkProvider = __decorate([
150
+ (0, inversify_1.injectable)()
151
+ ], FileDiffPreLinkProvider);
152
+ exports.FileDiffPreLinkProvider = FileDiffPreLinkProvider;
153
+ let FileDiffPostLinkProvider = class FileDiffPostLinkProvider extends FileLinkProvider {
154
+ async createRegExp() {
155
+ return /^\+\+\+ b\/(\S*)/g;
156
+ }
157
+ };
158
+ FileDiffPostLinkProvider = __decorate([
159
+ (0, inversify_1.injectable)()
160
+ ], FileDiffPostLinkProvider);
161
+ exports.FileDiffPostLinkProvider = FileDiffPostLinkProvider;
162
+ // The following regular expressions are taken from:
163
+ // https://github.com/microsoft/vscode/blob/b118105bf28d773fbbce683f7230d058be2f89a7/src/vs/workbench/contrib/terminal/browser/links/terminalLocalLinkDetector.ts#L34-L58
164
+ /*---------------------------------------------------------------------------------------------
165
+ * Copyright (c) Microsoft Corporation. All rights reserved.
166
+ * Licensed under the MIT License. See License.txt in the project root for license information.
167
+ *--------------------------------------------------------------------------------------------*/
168
+ const pathPrefix = '(\\.\\.?|\\~)';
169
+ const pathSeparatorClause = '\\/';
170
+ // '":; are allowed in paths but they are often separators so ignore them
171
+ // Also disallow \\ to prevent a catastrophic backtracking case #24795
172
+ const excludedPathCharactersClause = '[^\\0\\s!`&*()\\[\\]\'":;\\\\]';
173
+ /** A regex that matches paths in the form /foo, ~/foo, ./foo, ../foo, foo/bar */
174
+ const unixLocalLinkClause = '((' + pathPrefix + '|(' + excludedPathCharactersClause + ')+)?(' + pathSeparatorClause + '(' + excludedPathCharactersClause + ')+)+)';
175
+ const winDrivePrefix = '(?:\\\\\\\\\\?\\\\)?[a-zA-Z]:';
176
+ const winPathPrefix = '(' + winDrivePrefix + '|\\.\\.?|\\~)';
177
+ const winPathSeparatorClause = '(\\\\|\\/)';
178
+ const winExcludedPathCharactersClause = '[^\\0<>\\?\\|\\/\\s!`&*()\\[\\]\'":;]';
179
+ /** A regex that matches paths in the form \\?\c:\foo c:\foo, ~\foo, .\foo, ..\foo, foo\bar */
180
+ const winLocalLinkClause = '((' + winPathPrefix + '|(' + winExcludedPathCharactersClause + ')+)?(' + winPathSeparatorClause + '(' + winExcludedPathCharactersClause + ')+)+)';
181
+ /** As xterm reads from DOM, space in that case is non-breaking char ASCII code - 160, replacing space with nonBreakingSpace or space ASCII code - 32. */
182
+ const lineAndColumnClause = [
183
+ // "(file path)", line 45 [see #40468]
184
+ '((\\S*)[\'"], line ((\\d+)( column (\\d+))?))',
185
+ // "(file path)",45 [see #78205]
186
+ '((\\S*)[\'"],((\\d+)(:(\\d+))?))',
187
+ // (file path) on line 8, column 13
188
+ '((\\S*) on line ((\\d+)(, column (\\d+))?))',
189
+ // (file path):line 8, column 13
190
+ '((\\S*):line ((\\d+)(, column (\\d+))?))',
191
+ // (file path)(45), (file path) (45), (file path)(45,18), (file path) (45,18), (file path)(45, 18), (file path) (45, 18), also with []
192
+ '(([^\\s\\(\\)]*)(\\s?[\\(\\[](\\d+)(,\\s?(\\d+))?)[\\)\\]])',
193
+ // (file path):336, (file path):336:9
194
+ '(([^:\\s\\(\\)<>\'\"\\[\\]]*)(:(\\d+))?(:(\\d+))?)'
195
+ ].join('|').replace(/ /g, `[${'\u00A0'} ]`);
196
+ // Changing any regex may effect this value, hence changes this as well if required.
197
+ const winLineAndColumnMatchIndex = 12;
198
+ const unixLineAndColumnMatchIndex = 11;
199
+ // Each line and column clause have 6 groups (ie no. of expressions in round brackets)
200
+ const lineAndColumnClauseGroupCount = 6;
201
201
  //# sourceMappingURL=terminal-file-link-provider.js.map
@@ -1,116 +1,116 @@
1
- import { CommandContribution, Command, CommandRegistry, DisposableCollection, MenuContribution, MenuModelRegistry, SelectionService, Emitter, Event } from '@theia/core/lib/common';
2
- import { ApplicationShell, KeybindingContribution, WidgetManager, PreferenceService, KeybindingRegistry, LabelProvider, WidgetOpenerOptions, StorageService, QuickInputService, FrontendApplicationContribution, OnWillStopAction, FrontendApplication, Widget } from '@theia/core/lib/browser';
3
- import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
4
- import { TerminalService } from './base/terminal-service';
5
- import { TerminalWidgetOptions, TerminalWidget } from './base/terminal-widget';
6
- import { TerminalProfile, TerminalProfileService, TerminalProfileStore } from './terminal-profile-service';
7
- import { ShellTerminalServerProxy } from '../common/shell-terminal-protocol';
8
- import URI from '@theia/core/lib/common/uri';
9
- import { WorkspaceService } from '@theia/workspace/lib/browser';
10
- import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
11
- import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
12
- import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
13
- import { FileService } from '@theia/filesystem/lib/browser/file-service';
14
- import { TerminalWatcher } from '../common/terminal-watcher';
15
- import { TerminalPreferences } from './terminal-preferences';
16
- import { VariableResolverService } from '@theia/variable-resolver/lib/browser';
17
- export declare namespace TerminalMenus {
18
- const TERMINAL: string[];
19
- const TERMINAL_NEW: string[];
20
- const TERMINAL_TASKS: string[];
21
- const TERMINAL_TASKS_INFO: string[];
22
- const TERMINAL_TASKS_CONFIG: string[];
23
- const TERMINAL_NAVIGATOR_CONTEXT_MENU: string[];
24
- const TERMINAL_OPEN_EDITORS_CONTEXT_MENU: string[];
25
- const TERMINAL_CONTEXT_MENU: string[];
26
- }
27
- export declare namespace TerminalCommands {
28
- const NEW: Command;
29
- const PROFILE_NEW: Command;
30
- const PROFILE_DEFAULT: Command;
31
- const NEW_ACTIVE_WORKSPACE: Command;
32
- const TERMINAL_CLEAR: Command;
33
- const TERMINAL_CONTEXT: Command;
34
- const SPLIT: Command;
35
- const TERMINAL_FIND_TEXT: Command;
36
- const TERMINAL_FIND_TEXT_CANCEL: Command;
37
- const SCROLL_LINE_UP: Command;
38
- const SCROLL_LINE_DOWN: Command;
39
- const SCROLL_TO_TOP: Command;
40
- const SCROLL_PAGE_UP: Command;
41
- const SCROLL_PAGE_DOWN: Command;
42
- const TOGGLE_TERMINAL: Command;
43
- const KILL_TERMINAL: Command;
44
- const SELECT_ALL: Command;
45
- /**
46
- * Command that displays all terminals that are currently opened
47
- */
48
- const SHOW_ALL_OPENED_TERMINALS: Command;
49
- }
50
- export declare class TerminalFrontendContribution implements FrontendApplicationContribution, TerminalService, CommandContribution, MenuContribution, KeybindingContribution, TabBarToolbarContribution, ColorContribution {
51
- protected readonly shell: ApplicationShell;
52
- protected readonly shellTerminalServer: ShellTerminalServerProxy;
53
- protected readonly widgetManager: WidgetManager;
54
- protected readonly fileService: FileService;
55
- protected readonly selectionService: SelectionService;
56
- protected readonly labelProvider: LabelProvider;
57
- protected readonly quickInputService: QuickInputService;
58
- protected readonly workspaceService: WorkspaceService;
59
- protected readonly profileService: TerminalProfileService;
60
- protected readonly userProfileStore: TerminalProfileStore;
61
- protected readonly contributedProfileStore: TerminalProfileStore;
62
- protected readonly terminalWatcher: TerminalWatcher;
63
- protected readonly variableResolver: VariableResolverService;
64
- protected readonly storageService: StorageService;
65
- protected readonly preferenceService: PreferenceService;
66
- protected terminalPreferences: TerminalPreferences;
67
- protected mergePreferencesPromise: Promise<void>;
68
- protected readonly onDidCreateTerminalEmitter: Emitter<TerminalWidget>;
69
- readonly onDidCreateTerminal: Event<TerminalWidget>;
70
- protected readonly onDidChangeCurrentTerminalEmitter: Emitter<TerminalWidget | undefined>;
71
- readonly onDidChangeCurrentTerminal: Event<TerminalWidget | undefined>;
72
- protected readonly contextKeyService: ContextKeyService;
73
- protected init(): void;
74
- get terminalHideSearch(): boolean;
75
- onStart(app: FrontendApplication): Promise<void>;
76
- contributeDefaultProfiles(): Promise<void>;
77
- protected mergePreferences(): Promise<void>;
78
- protected resolveShellPath(path: string | string[] | undefined): Promise<string | undefined>;
79
- onWillStop(): OnWillStopAction<number> | undefined;
80
- protected confirmExitWithActiveTerminals(activeTerminalCount: number): Promise<boolean>;
81
- protected _currentTerminal: TerminalWidget | undefined;
82
- get currentTerminal(): TerminalWidget | undefined;
83
- protected setCurrentTerminal(current: TerminalWidget | undefined): void;
84
- protected updateCurrentTerminal(): void;
85
- protected mostRecentlyUsedTerminalEntries: {
86
- id: string;
87
- disposables: DisposableCollection;
88
- }[];
89
- protected getLastUsedTerminalId(): string | undefined;
90
- get lastUsedTerminal(): TerminalWidget | undefined;
91
- protected setLastUsedTerminal(lastUsedTerminal: TerminalWidget): void;
92
- get all(): TerminalWidget[];
93
- getById(id: string): TerminalWidget | undefined;
94
- getByTerminalId(terminalId: number): TerminalWidget | undefined;
95
- getDefaultShell(): Promise<string>;
96
- registerCommands(commands: CommandRegistry): void;
97
- protected toggleTerminal(): void;
98
- openInTerminal(uri: URI): Promise<void>;
99
- registerMenus(menus: MenuModelRegistry): void;
100
- registerToolbarItems(toolbar: TabBarToolbarRegistry): void;
101
- registerKeybindings(keybindings: KeybindingRegistry): void;
102
- newTerminal(options: TerminalWidgetOptions): Promise<TerminalWidget>;
103
- open(widget: TerminalWidget, options?: WidgetOpenerOptions): void;
104
- protected selectTerminalCwd(): Promise<string | undefined>;
105
- protected selectTerminalProfile(placeholder: string): Promise<[string, TerminalProfile] | undefined>;
106
- protected splitTerminal(referenceTerminal?: TerminalWidget): Promise<void>;
107
- protected openTerminal(options?: ApplicationShell.WidgetOptions, terminalProfile?: TerminalProfile): Promise<void>;
108
- protected chooseDefaultProfile(): Promise<void>;
109
- protected openActiveWorkspaceTerminal(options?: ApplicationShell.WidgetOptions): Promise<void>;
110
- protected withWidget<T>(widget: Widget | undefined, fn: (widget: TerminalWidget) => T): T | false;
111
- /**
112
- * It should be aligned with https://code.visualstudio.com/api/references/theme-color#integrated-terminal-colors
113
- */
114
- registerColors(colors: ColorRegistry): void;
115
- }
1
+ import { CommandContribution, Command, CommandRegistry, DisposableCollection, MenuContribution, MenuModelRegistry, SelectionService, Emitter, Event } from '@theia/core/lib/common';
2
+ import { ApplicationShell, KeybindingContribution, WidgetManager, PreferenceService, KeybindingRegistry, LabelProvider, WidgetOpenerOptions, StorageService, QuickInputService, FrontendApplicationContribution, OnWillStopAction, FrontendApplication, Widget } from '@theia/core/lib/browser';
3
+ import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
4
+ import { TerminalService } from './base/terminal-service';
5
+ import { TerminalWidgetOptions, TerminalWidget } from './base/terminal-widget';
6
+ import { TerminalProfile, TerminalProfileService, TerminalProfileStore } from './terminal-profile-service';
7
+ import { ShellTerminalServerProxy } from '../common/shell-terminal-protocol';
8
+ import URI from '@theia/core/lib/common/uri';
9
+ import { WorkspaceService } from '@theia/workspace/lib/browser';
10
+ import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
11
+ import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
12
+ import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
13
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
14
+ import { TerminalWatcher } from '../common/terminal-watcher';
15
+ import { TerminalPreferences } from './terminal-preferences';
16
+ import { VariableResolverService } from '@theia/variable-resolver/lib/browser';
17
+ export declare namespace TerminalMenus {
18
+ const TERMINAL: string[];
19
+ const TERMINAL_NEW: string[];
20
+ const TERMINAL_TASKS: string[];
21
+ const TERMINAL_TASKS_INFO: string[];
22
+ const TERMINAL_TASKS_CONFIG: string[];
23
+ const TERMINAL_NAVIGATOR_CONTEXT_MENU: string[];
24
+ const TERMINAL_OPEN_EDITORS_CONTEXT_MENU: string[];
25
+ const TERMINAL_CONTEXT_MENU: string[];
26
+ }
27
+ export declare namespace TerminalCommands {
28
+ const NEW: Command;
29
+ const PROFILE_NEW: Command;
30
+ const PROFILE_DEFAULT: Command;
31
+ const NEW_ACTIVE_WORKSPACE: Command;
32
+ const TERMINAL_CLEAR: Command;
33
+ const TERMINAL_CONTEXT: Command;
34
+ const SPLIT: Command;
35
+ const TERMINAL_FIND_TEXT: Command;
36
+ const TERMINAL_FIND_TEXT_CANCEL: Command;
37
+ const SCROLL_LINE_UP: Command;
38
+ const SCROLL_LINE_DOWN: Command;
39
+ const SCROLL_TO_TOP: Command;
40
+ const SCROLL_PAGE_UP: Command;
41
+ const SCROLL_PAGE_DOWN: Command;
42
+ const TOGGLE_TERMINAL: Command;
43
+ const KILL_TERMINAL: Command;
44
+ const SELECT_ALL: Command;
45
+ /**
46
+ * Command that displays all terminals that are currently opened
47
+ */
48
+ const SHOW_ALL_OPENED_TERMINALS: Command;
49
+ }
50
+ export declare class TerminalFrontendContribution implements FrontendApplicationContribution, TerminalService, CommandContribution, MenuContribution, KeybindingContribution, TabBarToolbarContribution, ColorContribution {
51
+ protected readonly shell: ApplicationShell;
52
+ protected readonly shellTerminalServer: ShellTerminalServerProxy;
53
+ protected readonly widgetManager: WidgetManager;
54
+ protected readonly fileService: FileService;
55
+ protected readonly selectionService: SelectionService;
56
+ protected readonly labelProvider: LabelProvider;
57
+ protected readonly quickInputService: QuickInputService;
58
+ protected readonly workspaceService: WorkspaceService;
59
+ protected readonly profileService: TerminalProfileService;
60
+ protected readonly userProfileStore: TerminalProfileStore;
61
+ protected readonly contributedProfileStore: TerminalProfileStore;
62
+ protected readonly terminalWatcher: TerminalWatcher;
63
+ protected readonly variableResolver: VariableResolverService;
64
+ protected readonly storageService: StorageService;
65
+ protected readonly preferenceService: PreferenceService;
66
+ protected terminalPreferences: TerminalPreferences;
67
+ protected mergePreferencesPromise: Promise<void>;
68
+ protected readonly onDidCreateTerminalEmitter: Emitter<TerminalWidget>;
69
+ readonly onDidCreateTerminal: Event<TerminalWidget>;
70
+ protected readonly onDidChangeCurrentTerminalEmitter: Emitter<TerminalWidget | undefined>;
71
+ readonly onDidChangeCurrentTerminal: Event<TerminalWidget | undefined>;
72
+ protected readonly contextKeyService: ContextKeyService;
73
+ protected init(): void;
74
+ get terminalHideSearch(): boolean;
75
+ onStart(app: FrontendApplication): Promise<void>;
76
+ contributeDefaultProfiles(): Promise<void>;
77
+ protected mergePreferences(): Promise<void>;
78
+ protected resolveShellPath(path: string | string[] | undefined): Promise<string | undefined>;
79
+ onWillStop(): OnWillStopAction<number> | undefined;
80
+ protected confirmExitWithActiveTerminals(activeTerminalCount: number): Promise<boolean>;
81
+ protected _currentTerminal: TerminalWidget | undefined;
82
+ get currentTerminal(): TerminalWidget | undefined;
83
+ protected setCurrentTerminal(current: TerminalWidget | undefined): void;
84
+ protected updateCurrentTerminal(): void;
85
+ protected mostRecentlyUsedTerminalEntries: {
86
+ id: string;
87
+ disposables: DisposableCollection;
88
+ }[];
89
+ protected getLastUsedTerminalId(): string | undefined;
90
+ get lastUsedTerminal(): TerminalWidget | undefined;
91
+ protected setLastUsedTerminal(lastUsedTerminal: TerminalWidget): void;
92
+ get all(): TerminalWidget[];
93
+ getById(id: string): TerminalWidget | undefined;
94
+ getByTerminalId(terminalId: number): TerminalWidget | undefined;
95
+ getDefaultShell(): Promise<string>;
96
+ registerCommands(commands: CommandRegistry): void;
97
+ protected toggleTerminal(): void;
98
+ openInTerminal(uri: URI): Promise<void>;
99
+ registerMenus(menus: MenuModelRegistry): void;
100
+ registerToolbarItems(toolbar: TabBarToolbarRegistry): void;
101
+ registerKeybindings(keybindings: KeybindingRegistry): void;
102
+ newTerminal(options: TerminalWidgetOptions): Promise<TerminalWidget>;
103
+ open(widget: TerminalWidget, options?: WidgetOpenerOptions): void;
104
+ protected selectTerminalCwd(): Promise<string | undefined>;
105
+ protected selectTerminalProfile(placeholder: string): Promise<[string, TerminalProfile] | undefined>;
106
+ protected splitTerminal(referenceTerminal?: TerminalWidget): Promise<void>;
107
+ protected openTerminal(options?: ApplicationShell.WidgetOptions, terminalProfile?: TerminalProfile): Promise<void>;
108
+ protected chooseDefaultProfile(): Promise<void>;
109
+ protected openActiveWorkspaceTerminal(options?: ApplicationShell.WidgetOptions): Promise<void>;
110
+ protected withWidget<T>(widget: Widget | undefined, fn: (widget: TerminalWidget) => T): T | false;
111
+ /**
112
+ * It should be aligned with https://code.visualstudio.com/api/references/theme-color#integrated-terminal-colors
113
+ */
114
+ registerColors(colors: ColorRegistry): void;
115
+ }
116
116
  //# sourceMappingURL=terminal-frontend-contribution.d.ts.map