本文整理汇总了TypeScript中copy-paste.paste函数的典型用法代码示例。如果您正苦于以下问题:TypeScript paste函数的具体用法?TypeScript paste怎么用?TypeScript paste使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paste函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: callRestService
let restJson2ts = vscode.commands.registerCommand("rest.json2ts", () => {
copyPaste.paste((error, content) => {
if (content && content.indexOf("http") > -1) {
callRestService(content);
} else {
vscode.window.showInputBox({ prompt: "Insert your REST-Service URL." })
.then((userInput) => {
if (userInput && userInput.indexOf("http") > -1) {
callRestService(userInput);
} else {
vscode.window.showErrorMessage("No valid REST-Service URL.");
}
});
}
});
function callRestService(url: string) {
vscode.window.setStatusBarMessage("Call " + url + "...");
request(url, (error, response, body) => {
if (extension.isJson(body)) {
convert(body);
} else {
vscode.window.showErrorMessage("REST-Service has no valid JSON result.");
}
});
}
});
开发者ID:bittmeier,项目名称:VSCode-json2ts,代码行数:27,代码来源:extension.ts
示例2: getSelection
const disposable = vscode.commands.registerCommand("extension.consoleWrapper", () => {
const editor = vscode.window.activeTextEditor;
if (!editor) {
return;
}
const expandedSelection = getSelection(editor);
if (expandedSelection) {
const text = editor.document.getText(expandedSelection);
if (text) {
editor.edit((currentText) => {
currentText.insert(new vscode.Position(expandedSelection.end.line, 100000), consoleWrapper.wrap(text, getLineIndentation(expandedSelection)));
});
}
} else {
paste((cb, clipboardContent) => {
if (!!clipboardContent) {
const selection = editor.selection;
editor.edit((currentText) => {
currentText.insert(new vscode.Position(selection.active.line, selection.active.character), consoleWrapper.wrap(clipboardContent));
});
}
});
}
});
开发者ID:fabiodamasceno,项目名称:vscode-console-wrapper,代码行数:25,代码来源:extension.ts
示例3: convertUrlJsonToTs
function convertUrlJsonToTs() {
copyPaste.paste((error, content) => {
if (content.indexOf("http") > -1) {
request(content, (error, response, body) => {
convert(body);
});
}
});
}
开发者ID:GregorBiswanger,项目名称:Brackets-json2ts,代码行数:9,代码来源:extension.ts
示例4: convert
let clipboardJson2ts = vscode.commands.registerCommand("convert.json2ts", () => {
copyPaste.paste((error, content) => {
if (extension.isJson(content)) {
convert(content);
} else {
vscode.window.showErrorMessage("Clipboard has no valid JSON content.");
}
});
});
开发者ID:lafe,项目名称:VSCode-json2ts,代码行数:9,代码来源:extension.ts
示例5: test
test("delete should copy to clipboard", async () => {
const expectedText = "Hello World";
await TextEditor.insert(expectedText);
const range = vscode.window.activeTextEditor.document.lineAt(0).range;
await TextEditor.delete(range);
const actualText = paste();
assert.equal(actualText, expectedText);
});
开发者ID:Lindenk,项目名称:Vim,代码行数:10,代码来源:textEditor.test.ts
示例6:
return new Promise<string>((resolve, reject) => {
clipboard.paste((err: any, result: string) => {
if (err) {
reject(err);
return;
}
resolve(result);
});
});
开发者ID:Icenium,项目名称:icenium-cli,代码行数:10,代码来源:clipboard-service.ts
示例7: paste
return new Promise<void>((resolve, reject) => {
paste(async (err, data) => {
if (err) {
reject();
} else {
await TextEditor.insertAt(data, start.getRight());
this.modeHandler.currentMode.motion.moveTo(start.line, start.getRight().character);
resolve();
}
});
});
开发者ID:Lindenk,项目名称:Vim,代码行数:11,代码来源:put.ts
示例8: convert
let clipboardJson2ts = vscode.commands.registerCommand("convert.json2ts", () => {
copyPaste.paste((error, content) => {
if (error == null) {
if (extension.isJson(content)) {
convert(content);
} else {
vscode.window.showErrorMessage("Clipboard has no valid JSON content.");
}
} else {
if (error["path"] == "xclip") {
vscode.window.showErrorMessage("Clipboard can not be read. Have you installed xclip?");
} else {
vscode.window.showErrorMessage("Clipboard can not be read.");
}
}
});
});
开发者ID:bittmeier,项目名称:VSCode-json2ts,代码行数:17,代码来源:extension.ts
示例9: TestClass
/// <reference types="node" />
import * as CopyPaste from 'copy-paste';
class TestClass {}
let strRet: string = CopyPaste.copy("content");
strRet = CopyPaste.copy("content", (err: Error) => { return; });
let objRet: TestClass = CopyPaste.copy(new TestClass());
objRet = CopyPaste.copy(new TestClass(), (err: Error) => { return; });
strRet = CopyPaste.paste();
CopyPaste.paste((err: Error, content: string) => { return; });
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:15,代码来源:copy-paste-tests.ts
示例10: convertJsonToTs
function convertJsonToTs() {
copyPaste.paste((error, content) => {
convert(content);
});
}
开发者ID:GregorBiswanger,项目名称:Brackets-json2ts,代码行数:5,代码来源:extension.ts
注:本文中的copy-paste.paste函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论