mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
Adopt SnippetTextEdit for drop
This commit is contained in:
parent
41e7b85195
commit
5451119820
|
@ -9,10 +9,10 @@ import * as URI from 'vscode-uri';
|
|||
|
||||
export function registerDropIntoEditor() {
|
||||
return vscode.workspace.onWillDropOnTextEditor(e => {
|
||||
e.waitUntil((async () => {
|
||||
e.waitUntil((async (): Promise<vscode.SnippetTextEdit | undefined> => {
|
||||
const urlList = await e.dataTransfer.get('text/uri-list')?.asString();
|
||||
if (!urlList) {
|
||||
return;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const uris: vscode.Uri[] = [];
|
||||
|
@ -41,7 +41,7 @@ export function registerDropIntoEditor() {
|
|||
}
|
||||
});
|
||||
|
||||
return e.editor.insertSnippet(snippet, e.position);
|
||||
return new vscode.SnippetTextEdit(new vscode.Range(e.position, e.position), snippet);
|
||||
})());
|
||||
});
|
||||
}
|
||||
|
|
|
@ -48,10 +48,7 @@ declare module 'vscode' {
|
|||
*
|
||||
* @param thenable A thenable that delays saving.
|
||||
*/
|
||||
waitUntil(thenable: Thenable<any>): void;
|
||||
|
||||
//
|
||||
waitUntil(thenable: Thenable<SnippetTextEdit>): void;
|
||||
waitUntil(thenable: Thenable<SnippetTextEdit | undefined>): void;
|
||||
|
||||
token: CancellationToken;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue