Skip to content

Commit

Permalink
add stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
meganrogge committed Oct 20, 2022
1 parent 266ff5b commit 2fdae24
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export const allApiProposals = Object.freeze({
telemetryLogger: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.telemetryLogger.d.ts',
terminalDataWriteEvent: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDataWriteEvent.d.ts',
terminalDimensions: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalDimensions.d.ts',
terminalQuickFixProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts',
testCoverage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testCoverage.d.ts',
testObserver: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.testObserver.d.ts',
textSearchProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.textSearchProvider.d.ts',
Expand Down
83 changes: 83 additions & 0 deletions src/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

declare module 'vscode' {
// https://github.com/microsoft/vscode/issues/162950

/**
* Registers a provider that enables quick fix actions to be shown based on
* commands and their output
* @param provider The provider that provides the quick fixes.
* @return Disposable that unregisters the provider.
*/
export function registerTerminalLinkProvider(provider: TerminalLinkProvider): Disposable;

/**
* A provider for terminal quick fixes.
*/
export interface TerminalQuickFixProvider {
/**
* Provide terminal quick fixes
* @param options that specify when the fix should apply and the call back to run
* for matches
* @param token A cancellation token.
*/
provideTerminalQuickFixes(options: TerminalQuickFixOptions[], token: CancellationToken): void;
}

interface TerminalQuickFixOptions {
commandLineMatcher: string | RegExp;
outputMatcher?: TerminalOutputMatcher;
getQuickFixes: TerminalQuickFixCallback;
exitStatus?: boolean;
}
export type TerminalQuickFixMatchResult = { commandLineMatch: RegExpMatchArray; outputMatch?: RegExpMatchArray | null };
export type TerminalQuickFixAction = Action | TerminalQuickFixCommandAction | TerminalQuickFixOpenerAction;
export type TerminalQuickFixCallback = (matchResult: TerminalQuickFixMatchResult, command: string) => TerminalQuickFixAction[] | TerminalQuickFixAction | undefined;

interface Action {
readonly id: string;
label: string;
tooltip: string;
class: string | undefined;
enabled: boolean;
checked?: boolean;
run(event?: unknown): unknown;
}
export interface TerminalQuickFixCommandAction {
type: 'command';
command: string;
addNewLine: boolean;
}
export interface TerminalQuickFixOpenerAction {
type: 'opener';
uri: Uri;
}
const enum TerminalOutputMatcherAnchor {
Top = 'top',
Bottom = 'bototm'
}
export interface TerminalOutputMatcher {
/**
* A string or regex to match against the unwrapped line. If this is a regex with the multiline
* flag, it will scan an amount of lines equal to `\n` instances in the regex + 1.
*/
lineMatcher: string | RegExp;
/**
* Which side of the output to anchor the {@link offset} and {@link length} against.
*/
anchor: TerminalOutputMatcherAnchor;
/**
* How far from either the top or the bottom of the butter to start matching against.
*/
offset: number;
/**
* The number of rows to match against, this should be as small as possible for performance
* reasons.
*/
length: number;
}
}

0 comments on commit 2fdae24

Please sign in to comment.