Skip to content

Commit

Permalink
Add CodeActionKind intersects() Plugin API
Browse files Browse the repository at this point in the history
Added the Plugin API for `CodeActionKind` `intersects(other: CodeActionKind)` method.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Apr 5, 2019
1 parent 8477580 commit 95c962c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v0.6.0

- [filesystem] added the menu item `Upload Files...` to easily upload files into a workspace
- [plugin] added `CodeActionKind` `intersects` Plug-in API
- [task] added support to configure tasks
- [workspace] allow creation of files and folders using recursive paths

Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-ext/src/plugin/types-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ export class CodeActionKind {
public contains(other: CodeActionKind): boolean {
return this.value === other.value || startsWithIgnoreCase(other.value, this.value + CodeActionKind.sep);
}

public intersects(other: CodeActionKind): boolean {
return this.contains(other) || other.contains(this);
}
}

export enum TextDocumentSaveReason {
Expand Down
9 changes: 9 additions & 0 deletions packages/plugin/src/theia.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5759,6 +5759,15 @@ declare module '@theia/plugin' {
* @param other Kind to check.
*/
contains(other: CodeActionKind): boolean;

/**
* Check if this code action kind intersects `other`.
* The kind "refactor.extract" for example intersects refactor, "refactor.extract" and
* `"refactor.extract.function", but not "unicorn.refactor.extract", or "refactor.extractAll".
*
* @param other Kind to check.
*/
intersects(other: CodeActionKind): boolean;
}

/**
Expand Down

0 comments on commit 95c962c

Please sign in to comment.