forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add delay for exec in terminal (#592)
- Loading branch information
1 parent
aa43646
commit ad806fa
Showing
55 changed files
with
2,264 additions
and
562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
// tslint:disable:no-any | ||
|
||
import { injectable } from 'inversify'; | ||
import { commands, Disposable, TextEditor, TextEditorEdit } from 'vscode'; | ||
import { ICommandManager } from './types'; | ||
|
||
@injectable() | ||
export class CommandManager implements ICommandManager { | ||
|
||
/** | ||
* Registers a command that can be invoked via a keyboard shortcut, | ||
* a menu item, an action, or directly. | ||
* | ||
* Registering a command with an existing command identifier twice | ||
* will cause an error. | ||
* | ||
* @param command A unique identifier for the command. | ||
* @param callback A command handler function. | ||
* @param thisArg The `this` context used when invoking the handler function. | ||
* @return Disposable which unregisters this command on disposal. | ||
*/ | ||
public registerCommand(command: string, callback: (...args: any[]) => any, thisArg?: any): Disposable { | ||
return commands.registerCommand(command, callback, thisArg); | ||
} | ||
|
||
/** | ||
* Registers a text editor command that can be invoked via a keyboard shortcut, | ||
* a menu item, an action, or directly. | ||
* | ||
* Text editor commands are different from ordinary [commands](#commands.registerCommand) as | ||
* they only execute when there is an active editor when the command is called. Also, the | ||
* command handler of an editor command has access to the active editor and to an | ||
* [edit](#TextEditorEdit)-builder. | ||
* | ||
* @param command A unique identifier for the command. | ||
* @param callback A command handler function with access to an [editor](#TextEditor) and an [edit](#TextEditorEdit). | ||
* @param thisArg The `this` context used when invoking the handler function. | ||
* @return Disposable which unregisters this command on disposal. | ||
*/ | ||
public registerTextEditorCommand(command: string, callback: (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void, thisArg?: any): Disposable { | ||
return commands.registerTextEditorCommand(command, callback, thisArg); | ||
} | ||
|
||
/** | ||
* Executes the command denoted by the given command identifier. | ||
* | ||
* * *Note 1:* When executing an editor command not all types are allowed to | ||
* be passed as arguments. Allowed are the primitive types `string`, `boolean`, | ||
* `number`, `undefined`, and `null`, as well as [`Position`](#Position), [`Range`](#Range), [`Uri`](#Uri) and [`Location`](#Location). | ||
* * *Note 2:* There are no restrictions when executing commands that have been contributed | ||
* by extensions. | ||
* | ||
* @param command Identifier of the command to execute. | ||
* @param rest Parameters passed to the command function. | ||
* @return A thenable that resolves to the returned value of the given command. `undefined` when | ||
* the command handler function doesn't return anything. | ||
*/ | ||
public executeCommand<T>(command: string, ...rest: any[]): Thenable<T | undefined> { | ||
return commands.executeCommand<T>(command, ...rest); | ||
} | ||
|
||
/** | ||
* Retrieve the list of all available commands. Commands starting an underscore are | ||
* treated as internal commands. | ||
* | ||
* @param filterInternal Set `true` to not see internal commands (starting with an underscore) | ||
* @return Thenable that resolves to a list of command ids. | ||
*/ | ||
public getCommands(filterInternal?: boolean): Thenable<string[]> { | ||
return commands.getCommands(filterInternal); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
// tslint:disable:no-any | ||
|
||
import { injectable } from 'inversify'; | ||
import { Event, TextDocument, TextDocumentShowOptions, TextEditor, TextEditorOptionsChangeEvent, TextEditorSelectionChangeEvent, TextEditorViewColumnChangeEvent, Uri, ViewColumn, window } from 'vscode'; | ||
import { IDocumentManager } from './types'; | ||
|
||
@injectable() | ||
export class DocumentManager implements IDocumentManager { | ||
public get activeTextEditor(): TextEditor | undefined { | ||
return window.activeTextEditor; | ||
} | ||
public get visibleTextEditors(): TextEditor[] { | ||
return window.visibleTextEditors; | ||
} | ||
public get onDidChangeActiveTextEditor(): Event<TextEditor> { | ||
return window.onDidChangeActiveTextEditor; | ||
} | ||
public get onDidChangeVisibleTextEditors(): Event<TextEditor[]> { | ||
return window.onDidChangeVisibleTextEditors; | ||
} | ||
public get onDidChangeTextEditorSelection(): Event<TextEditorSelectionChangeEvent> { | ||
return window.onDidChangeTextEditorSelection; | ||
} | ||
public get onDidChangeTextEditorOptions(): Event<TextEditorOptionsChangeEvent> { | ||
return window.onDidChangeTextEditorOptions; | ||
} | ||
public get onDidChangeTextEditorViewColumn(): Event<TextEditorViewColumnChangeEvent> { | ||
return window.onDidChangeTextEditorViewColumn; | ||
} | ||
public showTextDocument(document: TextDocument, column?: ViewColumn, preserveFocus?: boolean): Thenable<TextEditor>; | ||
public showTextDocument(document: TextDocument | Uri, options?: TextDocumentShowOptions): Thenable<TextEditor>; | ||
public showTextDocument(uri: any, options?: any, preserveFocus?: any): Thenable<TextEditor> { | ||
return window.showTextDocument(uri, options, preserveFocus); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
import { injectable } from 'inversify'; | ||
import { Event, Terminal, TerminalOptions, window } from 'vscode'; | ||
import { ITerminalManager } from './types'; | ||
|
||
@injectable() | ||
export class TerminalManager implements ITerminalManager { | ||
public get onDidCloseTerminal(): Event<Terminal> { | ||
return window.onDidCloseTerminal; | ||
} | ||
public createTerminal(options: TerminalOptions): Terminal { | ||
return window.createTerminal(options); | ||
} | ||
} |
Oops, something went wrong.