Skip to content

Commit ad806fa

Browse files
authored
Add delay for exec in terminal (#592)
Fixes #174 Fixes #60 Fixes #593
1 parent aa43646 commit ad806fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2264
-562
lines changed

gulpfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const hygiene = (options) => {
157157
* @param {any[]} failures
158158
*/
159159
function reportLinterFailures(failures) {
160-
failures
160+
return failures
161161
.map(failure => {
162162
const name = failure.name || failure.fileName;
163163
const position = failure.startPosition;
@@ -235,7 +235,7 @@ const hygiene = (options) => {
235235
const files = options.mode === 'compile' ? tsProject.src() : getFilesToProcess(options);
236236
const dest = options.mode === 'compile' ? './out' : '.';
237237
let result = files
238-
.pipe(filter(f => !f.stat.isDirectory()));
238+
.pipe(filter(f => f && f.stat && !f.stat.isDirectory()));
239239

240240
if (!options.skipIndentationCheck) {
241241
result = result.pipe(filter(indentationFilter))
@@ -261,7 +261,7 @@ const hygiene = (options) => {
261261
.js.pipe(gulp.dest(dest))
262262
.pipe(es.through(null, function () {
263263
if (errorCount > 0) {
264-
const errorMessage = `Hygiene failed with ${colors.yellow(errorCount)} errors 👎 . Check 'gulpfile.js'.`;
264+
const errorMessage = `Hygiene failed with errors 👎 . Check 'gulpfile.js'.`;
265265
console.error(colors.red(errorMessage));
266266
exitHandler(options);
267267
} else {
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
// tslint:disable:no-any
5+
6+
import { injectable } from 'inversify';
7+
import { commands, Disposable, TextEditor, TextEditorEdit } from 'vscode';
8+
import { ICommandManager } from './types';
9+
10+
@injectable()
11+
export class CommandManager implements ICommandManager {
12+
13+
/**
14+
* Registers a command that can be invoked via a keyboard shortcut,
15+
* a menu item, an action, or directly.
16+
*
17+
* Registering a command with an existing command identifier twice
18+
* will cause an error.
19+
*
20+
* @param command A unique identifier for the command.
21+
* @param callback A command handler function.
22+
* @param thisArg The `this` context used when invoking the handler function.
23+
* @return Disposable which unregisters this command on disposal.
24+
*/
25+
public registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable {
26+
return commands.registerCommand(command, callback, thisArg);
27+
}
28+
29+
/**
30+
* Registers a text editor command that can be invoked via a keyboard shortcut,
31+
* a menu item, an action, or directly.
32+
*
33+
* Text editor commands are different from ordinary [commands](#commands.registerCommand) as
34+
* they only execute when there is an active editor when the command is called. Also, the
35+
* command handler of an editor command has access to the active editor and to an
36+
* [edit](#TextEditorEdit)-builder.
37+
*
38+
* @param command A unique identifier for the command.
39+
* @param callback A command handler function with access to an [editor](#TextEditor) and an [edit](#TextEditorEdit).
40+
* @param thisArg The `this` context used when invoking the handler function.
41+
* @return Disposable which unregisters this command on disposal.
42+
*/
43+
public registerTextEditorCommand(command: string, callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void, thisArg?: any): Disposable {
44+
return commands.registerTextEditorCommand(command, callback, thisArg);
45+
}
46+
47+
/**
48+
* Executes the command denoted by the given command identifier.
49+
*
50+
* * *Note 1:* When executing an editor command not all types are allowed to
51+
* be passed as arguments. Allowed are the primitive types `string`, `boolean`,
52+
* `number`, `undefined`, and `null`, as well as [`Position`](#Position), [`Range`](#Range), [`Uri`](#Uri) and [`Location`](#Location).
53+
* * *Note 2:* There are no restrictions when executing commands that have been contributed
54+
* by extensions.
55+
*
56+
* @param command Identifier of the command to execute.
57+
* @param rest Parameters passed to the command function.
58+
* @return A thenable that resolves to the returned value of the given command. `undefined` when
59+
* the command handler function doesn't return anything.
60+
*/
61+
public executeCommand<T>(command: string, ...rest: any[]): Thenable<T | undefined> {
62+
return commands.executeCommand<T>(command, ...rest);
63+
}
64+
65+
/**
66+
* Retrieve the list of all available commands. Commands starting an underscore are
67+
* treated as internal commands.
68+
*
69+
* @param filterInternal Set `true` to not see internal commands (starting with an underscore)
70+
* @return Thenable that resolves to a list of command ids.
71+
*/
72+
public getCommands(filterInternal?: boolean): Thenable<string[]> {
73+
return commands.getCommands(filterInternal);
74+
}
75+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
// tslint:disable:no-any
5+
6+
import { injectable } from 'inversify';
7+
import { Event, TextDocument, TextDocumentShowOptions, TextEditor, TextEditorOptionsChangeEvent, TextEditorSelectionChangeEvent, TextEditorViewColumnChangeEvent, Uri, ViewColumn, window } from 'vscode';
8+
import { IDocumentManager } from './types';
9+
10+
@injectable()
11+
export class DocumentManager implements IDocumentManager {
12+
public get activeTextEditor(): TextEditor | undefined {
13+
return window.activeTextEditor;
14+
}
15+
public get visibleTextEditors(): TextEditor[] {
16+
return window.visibleTextEditors;
17+
}
18+
public get onDidChangeActiveTextEditor(): Event<TextEditor> {
19+
return window.onDidChangeActiveTextEditor;
20+
}
21+
public get onDidChangeVisibleTextEditors(): Event<TextEditor[]> {
22+
return window.onDidChangeVisibleTextEditors;
23+
}
24+
public get onDidChangeTextEditorSelection(): Event<TextEditorSelectionChangeEvent> {
25+
return window.onDidChangeTextEditorSelection;
26+
}
27+
public get onDidChangeTextEditorOptions(): Event<TextEditorOptionsChangeEvent> {
28+
return window.onDidChangeTextEditorOptions;
29+
}
30+
public get onDidChangeTextEditorViewColumn(): Event<TextEditorViewColumnChangeEvent> {
31+
return window.onDidChangeTextEditorViewColumn;
32+
}
33+
public showTextDocument(document: TextDocument, column?: ViewColumn, preserveFocus?: boolean): Thenable<TextEditor>;
34+
public showTextDocument(document: TextDocument | Uri, options?: TextDocumentShowOptions): Thenable<TextEditor>;
35+
public showTextDocument(uri: any, options?: any, preserveFocus?: any): Thenable<TextEditor> {
36+
return window.showTextDocument(uri, options, preserveFocus);
37+
}
38+
39+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
import { injectable } from 'inversify';
5+
import { Event, Terminal, TerminalOptions, window } from 'vscode';
6+
import { ITerminalManager } from './types';
7+
8+
@injectable()
9+
export class TerminalManager implements ITerminalManager {
10+
public get onDidCloseTerminal(): Event<Terminal> {
11+
return window.onDidCloseTerminal;
12+
}
13+
public createTerminal(options: TerminalOptions): Terminal {
14+
return window.createTerminal(options);
15+
}
16+
}

0 commit comments

Comments
 (0)