mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 00:59:03 +01:00
if needed , read clipboard inside MainThreadEditors#insertText, https://github.com/microsoft/vscode/issues/98497
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { workspace, window, Position, Range, commands, TextEditor, TextDocument, TextEditorCursorStyle, TextEditorLineNumbersStyle, SnippetString, Selection, Uri } from 'vscode';
|
||||
import { workspace, window, Position, Range, commands, TextEditor, TextDocument, TextEditorCursorStyle, TextEditorLineNumbersStyle, SnippetString, Selection, Uri, env } from 'vscode';
|
||||
import { createRandomFile, deleteFile, closeAllEditors } from '../utils';
|
||||
|
||||
suite('vscode API - editors', () => {
|
||||
@@ -47,6 +47,20 @@ suite('vscode API - editors', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('insert snippet with clipboard variables', async () => {
|
||||
|
||||
await env.clipboard.writeText('INTEGRATION-TESTS');
|
||||
|
||||
const snippetString = new SnippetString('running: $CLIPBOARD');
|
||||
|
||||
return withRandomFileEditor('', async (editor, doc) => {
|
||||
const inserted = await editor.insertSnippet(snippetString);
|
||||
assert.ok(inserted);
|
||||
assert.equal(doc.getText(), 'running: INTEGRATION-TESTS');
|
||||
assert.ok(doc.isDirty);
|
||||
});
|
||||
});
|
||||
|
||||
test('insert snippet with replacement, editor selection', () => {
|
||||
const snippetString = new SnippetString()
|
||||
.appendText('has been');
|
||||
|
||||
Reference in New Issue
Block a user