Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it( 'Sets correctly UTF8', () => {
const utfString = 'Foo ¥£€ûл身śĆ🙀🙊';
let res = winClipboard.setText( utfString );
return clipboardy.read()
.then( ( data ) => {
expect( data ).to.be.eql( utfString );
expect( res ).to.be.eql( 34 );
} );
} );
.then(() =>
clipboard
.read()
.then(text =>
t.ok(
text.match(/^dat:\/\/[0-9a-f]{32}/),
'link copied to clipboard: ' + text
)
)
)
protected async runCommand(item: TreeItem, args: string[]): Promise {
let data = await clipboardy.read();
if (!data) return;
if (!(await fs.exists(data))) return;
let targetpath: string = item.path;
if (!item.contextValue.startsWith(ContextValues.ProjectFolder)){
targetpath = path.dirname(targetpath);
}
let stat = await fs.lstat(data);
if (stat.isDirectory()){
this.copyDirectory(item, data, targetpath);
} else {
this.copyFile(item, data, targetpath);
}
}
let indentation: string;
if (editor.options.insertSpaces) {
const tabSize = editor.options.tabSize as number;
indentation = " ".repeat(tabSize);
} else {
indentation = "\t";
}
const language = await getTargetLanguage(editor);
if (language.cancelled) {
return;
}
let content: string;
try {
content = await readClipboard();
} catch (e) {
vscode.window.showErrorMessage("Could not get clipboard contents");
return;
}
if (kind !== "typescript" && !jsonIsValid(content)) {
vscode.window.showErrorMessage("Clipboard does not contain valid JSON.");
return;
}
let topLevelName: string;
if (kind === "typescript") {
topLevelName = "input";
} else {
const tln = await promptTopLevelName();
if (tln.cancelled) {
public async paste(): Promise {
return clippy.read();
}
}