Skip to content

Commit

Permalink
API evolution for TerminalQuickFixProvider
Browse files Browse the repository at this point in the history
note the API is still stubbed in the tool.

Fixes eclipse-theia#12969

Contributed on behalf of STMicroelectronics

Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
  • Loading branch information
rschnekenbu committed Oct 18, 2023
1 parent 30d166e commit 251235a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 15 deletions.
8 changes: 5 additions & 3 deletions packages/plugin-ext/src/plugin/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ import {
TerminalLocation,
TerminalExitReason,
TerminalProfile,
TerminalQuickFixType,
InlayHint,
InlayHintKind,
InlayHintLabelPart,
Expand Down Expand Up @@ -199,7 +198,9 @@ import {
DocumentPasteEdit,
ExternalUriOpenerPriority,
EditSessionIdentityMatch,
TerminalOutputAnchor
TerminalOutputAnchor,
TerminalQuickFixExecuteTerminalCommand,
TerminalQuickFixOpener
} from './types-impl';
import { AuthenticationExtImpl } from './authentication-ext';
import { SymbolKind } from '../common/plugin-api-rpc-model';
Expand Down Expand Up @@ -1391,7 +1392,8 @@ export function createAPIFactory(
TerminalExitReason,
DocumentPasteEdit,
ExternalUriOpenerPriority,
TerminalQuickFixType,
TerminalQuickFixExecuteTerminalCommand,
TerminalQuickFixOpener,
EditSessionIdentityMatch
};
};
Expand Down
29 changes: 24 additions & 5 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2183,11 +2183,6 @@ export enum TerminalExitReason {
Extension = 4,
}

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

@es5ClassCompat
export class FileDecoration {

Expand Down Expand Up @@ -3630,3 +3625,27 @@ export enum EditSessionIdentityMatch {
None = 0
}
// #endregion

// #region terminalQuickFixProvider
export class TerminalQuickFixExecuteTerminalCommand {
/**
* The terminal command to run
*/
terminalCommand: string;
/**
* @stubbed
*/
constructor(terminalCommand: string) { }
}
export class TerminalQuickFixOpener {
/**
* The uri to open
*/
uri: theia.Uri;
/**
* @stubbed
*/
constructor(uri: theia.Uri) { }
}

// #endregion
23 changes: 16 additions & 7 deletions packages/plugin/src/theia.proposed.terminalQuickFixProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

export module '@theia/plugin' {

export type SingleOrMany<T> = T[] | T;

export namespace window {
/**
* @param provider A terminal quick fix provider
Expand All @@ -37,7 +39,8 @@ export module '@theia/plugin' {
* @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;
provideTerminalQuickFixes(commandMatchResult: TerminalCommandMatchResult, token: CancellationToken):
ProviderResult<SingleOrMany<TerminalQuickFixExecuteTerminalCommand | TerminalQuickFixOpener | Command>>;
}

export interface TerminalCommandMatchResult {
Expand All @@ -49,13 +52,19 @@ export module '@theia/plugin' {
};
}

interface TerminalQuickFix {
type: TerminalQuickFixType;
export class TerminalQuickFixExecuteTerminalCommand {
/**
* The terminal command to run
*/
terminalCommand: string;
constructor(terminalCommand: string);
}

enum TerminalQuickFixType {
command = 'command',
opener = 'opener'
export class TerminalQuickFixOpener {
/**
* The uri to open
*/
uri: Uri;
constructor(uri: Uri);
}

/**
Expand Down

0 comments on commit 251235a

Please sign in to comment.