extHostTerminalShellIntegration.ts ×13

Frontier kind: Code frontier

unlabeled · c_e424fbfea223

5 tests · 75825 LOC · 256 files · introduces 0 tests · 51 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
16 ranges51 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
4971 ranges75825 lines · 256 files · Browse complete extent
All tests (intent)
5 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 51 introduced LOC across 16 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/api/common/extHostTerminalShellIntegration.ts 43 introduced LOC · 13 ranges

Open complete file

238
239 requestNewShellExecution(commandLine: vscode.TerminalShellExecutionCommandLine, cwd: URI | undefined) {
240 > const execution = new InternalTerminalShellExecution(commandLine, cwd ?? this._cwd); extHostTerminalShellIntegration.ts
241 > const unresolvedCommandLines = splitAndSanitizeCommandLine(commandLine.value);
242 > if (unresolvedCommandLines.length > 1) {
243 this._currentExecutionProperties = {
244 isMultiLine: true,
246 };
247 }
248 > this._pendingExecutions.push(execution); extHostTerminalShellIntegration.ts
249 > this._onDidRequestNewExecution.fire(commandLine.value);
250 > return execution;
251 > }
252
253 startShellExecution(commandLine: vscode.TerminalShellExecutionCommandLine, cwd: URI | undefined): undefined {
279 if (commandLine.confidence === TerminalShellExecutionCommandLineConfidence.High) {
280 for (const [i, execution] of this._pendingExecutions.entries()) {
281 > if (execution.value.commandLine.value === commandLine.value) { extHostTerminalShellIntegration.ts
282 currentExecution = execution;
283 this._currentExecutionProperties = {
288 this._pendingExecutions.splice(i, 1);
289 break;
291 > const subExecutionResult = isSubExecution(splitAndSanitizeCommandLine(execution.value.commandLine.value), commandLine);
292 > if (subExecutionResult) {
293 this._currentExecutionProperties = {
294 isMultiLine: true,
316
317 emitData(data: string): void {
318 > this.currentExecution?.emitData(data); extHostTerminalShellIntegration.ts
319 > }
320
321 endShellExecution(commandLine: vscode.TerminalShellExecutionCommandLine | undefined, exitCode: number | undefined): void {
409
410 emitData(data: string): void {
411 > if (!this._isEnded) { extHostTerminalShellIntegration.ts
412 > this._dataStream?.emitData(data);
413 > }
414 > }
415
416 endExecution(commandLine: vscode.TerminalShellExecutionCommandLine | undefined): void {
450
451 emitData(data: string): void {
452 > for (const emitter of this._emitters) { extHostTerminalShellIntegration.ts
453 > emitter.emitOne(data);
454 > }
455 > }
456
457 endExecution(): void {
464 }
465
466 > function splitAndSanitizeCommandLine(commandLine: string): string[] { extHostTerminalShellIntegration.ts
467 > return commandLine
468 > .split('\n')
469 > .map(line => line.trim())
470 > .filter(line => line.length > 0);
471 > }
472
473 /**
476 * execution.
477 */
478 > function isSubExecution(unresolvedCommandLines: string[], commandLine: vscode.TerminalShellExecutionCommandLine): { unresolvedCommandLines: string[] } | false { extHostTerminalShellIntegration.ts
479 > if (unresolvedCommandLines.length === 0) {
480 return false;
481 }
482 > const newUnresolvedCommandLines = [...unresolvedCommandLines]; extHostTerminalShellIntegration.ts
483 > const subExecutionLines = splitAndSanitizeCommandLine(commandLine.value);
484 > if (newUnresolvedCommandLines && newUnresolvedCommandLines.length > 0) {
485 > // If all sub-execution lines are in the command line, this is part of the
486 > // multi-line execution.
487 > while (newUnresolvedCommandLines.length > 0) {
488 > if (newUnresolvedCommandLines[0] !== subExecutionLines[0]) {
489 > break;
490 > }
491 newUnresolvedCommandLines.shift();
492 subExecutionLines.shift();
493 }
495 > if (subExecutionLines.length === 0) {
496 return { unresolvedCommandLines: newUnresolvedCommandLines };
497 }
499 return false;
500 }
src/vs/base/common/async.ts 8 introduced LOC · 3 ranges

Open complete file

2202 const result: T[] = [];
2203 for await (const item of iterable) {
2204 > result.push(item); async.ts
2205 > }
2206 return result;
2207 }
2217 */
2218 private emitOne(value: T): void {
2219 > if (this._state !== AsyncIterableSourceState.Initial) { async.ts
2220 return;
2221 }
2222 > // it is important to add new values at the end, async.ts
2223 > // as we may have iterators already running on the array
2224 > this._results.push(value);
2225 > this._onStateChanged.fire();
2226 > }
2227
2228 /**