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 #12969

Contributed on behalf of STMicroelectronics

Signed-off-by: Remi Schnekenburger <[email protected]>
  • Loading branch information
rschnekenbu authored and tortmayr committed Oct 21, 2023
1 parent c75c861 commit 9c65375
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
## v1.43.0 - Unreleased

- [vsode] evolve proposed API for dropDocument [#13009](https://github.com/eclipse-theia/theia/pull/13009) - contributed on behalf of STMicroelectronics
- [vsode] evolve proposed API for terminalQuickFixProvider [#13006](https://github.com/eclipse-theia/theia/pull/13006) - contributed on behalf of STMicroelectronics

<a name="breaking_changes_1.43.0">[Breaking Changes:](#breaking_changes_1.43.0)</a>

Expand Down
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 9c65375

Please sign in to comment.