Skip to content

Commit 5781eae

Browse files
committed
Support property Text in DocumentDropOrPasteEditKind
fixes #14603 contributed on behalf of STMicroelectronics Signed-off-by: Remi Schnekenburger <[email protected]>
1 parent fb09901 commit 5781eae

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

packages/plugin-ext/src/plugin/types-impl.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,7 @@ export class DocumentLink {
16471647
@es5ClassCompat
16481648
export class DocumentDropOrPasteEditKind {
16491649
static readonly Empty: DocumentDropOrPasteEditKind = new DocumentDropOrPasteEditKind('');
1650+
static readonly Text: DocumentDropOrPasteEditKind = new DocumentDropOrPasteEditKind('text');
16501651

16511652
private static sep = '.';
16521653

packages/plugin/src/theia.proposed.documentPaste.d.ts

+14
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ export module '@theia/plugin' {
2828
class DocumentDropOrPasteEditKind {
2929
static readonly Empty: DocumentDropOrPasteEditKind;
3030

31+
/**
32+
* The root kind for basic text edits.
33+
*
34+
* This kind should be used for edits that insert basic text into the document. A good example of this is
35+
* an edit that pastes the clipboard text while also updating imports in the file based on the pasted text.
36+
* For this we could use a kind such as `text.updateImports.someLanguageId`.
37+
*
38+
* Even though most drop/paste edits ultimately insert text, you should not use {@linkcode Text} as the base kind
39+
* for every edit as this is redundant. Instead a more specific kind that describes the type of content being
40+
* inserted should be used instead For example, if the edit adds a Markdown link, use `markdown.link` since even
41+
* though the content being inserted is text, it's more important to know that the edit inserts Markdown syntax.
42+
*/
43+
static readonly Text: DocumentDropOrPasteEditKind;
44+
3145
private constructor(value: string);
3246

3347
/**

0 commit comments

Comments
 (0)