Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode: add TerminalQuickFixProvider API stubbing #12532

Merged
merged 1 commit into from
May 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ import {
TerminalLocation,
TerminalExitReason,
TerminalProfile,
TerminalQuickFixType,
InlayHint,
InlayHintKind,
InlayHintLabelPart,
Expand Down Expand Up @@ -582,6 +583,10 @@ export function createAPIFactory(
/** @stubbed ProfileContentHandler */
registerProfileContentHandler(id: string, profileContentHandler: theia.ProfileContentHandler): theia.Disposable {
return Disposable.NULL;
},
/** @stubbed TerminalQuickFixProvider */
registerTerminalQuickFixProvider(id: string, provider: theia.TerminalQuickFixProvider): theia.Disposable {
return terminalExt.registerTerminalQuickFixProvider(id, provider);
}
};

Expand Down Expand Up @@ -1363,7 +1368,8 @@ export function createAPIFactory(
TerminalLocation,
TerminalExitReason,
DocumentPasteEdit,
ExternalUriOpenerPriority
ExternalUriOpenerPriority,
TerminalQuickFixType
};
};
}
Expand Down
5 changes: 5 additions & 0 deletions packages/plugin-ext/src/plugin/terminal-ext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
});
}

/** @stubbed */
registerTerminalQuickFixProvider(id: string, provider: theia.TerminalQuickFixProvider): theia.Disposable {
return Disposable.NULL;
}

protected isExtensionTerminalOptions(options: theia.TerminalOptions | theia.ExtensionTerminalOptions): options is theia.ExtensionTerminalOptions {
return 'pty' in options;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,11 @@ export enum TerminalExitReason {
Extension = 4,
}

export enum TerminalQuickFixType {
command = 'command',
opener = 'opener'
}

@es5ClassCompat
export class FileDecoration {

Expand Down
40 changes: 40 additions & 0 deletions packages/plugin/src/theia-proposed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,46 @@ export module '@theia/plugin' {
}

// #endregion ProfileContentHandler

// #region TerminalQuickFixProvider

export namespace window {
/**
* @param provider A terminal quick fix provider
* @return A {@link Disposable} that un-registers the provider when being disposed
*/
export function registerTerminalQuickFixProvider(id: string, provider: TerminalQuickFixProvider): Disposable;
}

export interface TerminalQuickFixProvider {
/**
* Provides terminal quick fixes
* @param commandMatchResult The command match result for which to provide quick fixes
* @param token A cancellation token indicating the result is no longer needed
* @return Terminal quick fix(es) if any
*/
provideTerminalQuickFixes(commandMatchResult: TerminalCommandMatchResult, token: CancellationToken): TerminalQuickFix[] | TerminalQuickFix | undefined;
}

export interface TerminalCommandMatchResult {
commandLine: string;
commandLineMatch: RegExpMatchArray;
outputMatch?: {
regexMatch: RegExpMatchArray;
outputLines?: string[];
};
}

interface TerminalQuickFix {
type: TerminalQuickFixType;
}

enum TerminalQuickFixType {
command = 'command',
opener = 'opener'
}

// #endRegion TerminalQuickFixProvider
}

/**
Expand Down