• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript copy-paste.copy函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中copy-paste.copy函数的典型用法代码示例。如果您正苦于以下问题:TypeScript copy函数的具体用法?TypeScript copy怎么用?TypeScript copy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了copy函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: test

    test("put ' brown' into 'the dog'", async () => {
        const phrase = "brown ";
        const expectedText = `the ${phrase}dog`;
        const position = new Position(0, 3, PositionOptions.CharacterWiseExclusive);
        const mode = new ModeHandler();
        const put = new PutOperator(mode);
        copy(phrase);

        // using ^ to show the cusor position
        // before : the dog
        //             ^
        // after  : the brown dog
        //              ^

        await put.run(position, position);

        const actualText = TextEditor.readLineAt(0);
        const cursorPosition = vscode.window.activeTextEditor.selection.active;
        assert.equal(actualText, expectedText,
            "did not paste expected content");
        assert.equal(cursorPosition.line, position.getRight().line,
            "cursor should be on the same line");
        assert.equal(cursorPosition.character, position.getRight().character,
            "cursor should be on start of put content");
    });
开发者ID:Lindenk,项目名称:Vim,代码行数:25,代码来源:put.test.ts


示例2:

		return new Promise<string>((resolve, reject) => {
			clipboard.copy(text, (err: any, result: string) => {
				if (err) {
					reject(err);
					return;
				}

				resolve(result);
			});

		});
开发者ID:Icenium,项目名称:icenium-cli,代码行数:11,代码来源:clipboard-service.ts


示例3: RegExp

 (up): void => {
   const text = up.inlines.join('\n');
   const foundPatterns = [];
   text.replace(new RegExp(up.userinputs[0], 'g'), (all, ...p) => {
     const len = p.length - 2;
     const captures = [];
     for (let i = 0; i < len; i++) {
       captures.push(p[i]);
     }
     foundPatterns.push(captures.join('\t'));
     return all;
   });
   copyPaste.copy(foundPatterns.join('\n'));
 });
开发者ID:a-bentofreire,项目名称:vsctoix,代码行数:14,代码来源:clipboardutilities.ts


示例4:

		vscode.window.showInformationMessage.apply(vscode.window, args).then((cmd) => {
			if (cmd === "Copy") {
				copypaste.copy(value);
			}
			if (cmd === "Insert") {
				var activeEditor = vscode.window.activeTextEditor;
				if (activeEditor && activeEditor.selection && activeEditor.selection.active) {
					activeEditor.edit((editor) => {
						editor.insert(activeEditor.selection.active, value);
					});
				}

			}
		});
开发者ID:tkorcak,项目名称:createidsvscode,代码行数:14,代码来源:extension.ts


示例5: suite

suite("register", () => {
  let modeHandler: ModeHandler = new ModeHandler();

  let {
      newTest,
      newTestOnly,
  } = getTestingFunctions(modeHandler);

  setup(async () => {
    await setupWorkspace();
  });

  suiteTeardown(cleanUpWorkspace);

  newTest({
    title: "Can copy to a register",
    start: ['|one', 'two'],
    keysPressed: '"add"ap',
    end: ["two", "|one"],
  });

  clipboard.copy("12345");

  newTest({
    title: "Can access '*' (clipboard) register",
    start: ['|one'],
    keysPressed: '"*P',
    end: ["1234|5one"],
  });

  newTest({
    title: "Can access '+' (clipboard) register",
    start: ['|one'],
    keysPressed: '"+P',
    end: ["1234|5one"],
  });

  newTest({
    title: "Can use two registers together",
    start: ['|one', "two"],
    keysPressed: '"ayyj"byy"ap"bp',
    end: ["one", "two", "one", "|two"],
  });

});
开发者ID:aminroosta,项目名称:Vim,代码行数:45,代码来源:register.test.ts


示例6: copyIds

function copyIds() {
    let e = wing.window.activeTextEditor;
    if (!e) {
        return;
    }

    let fileName = e.document.fileName;
    let ext = path.extname(fileName);
    if (ext != '.exml') {
        return;
    }
    let content = e.document.getText();

    let result = findIds(content);

    if (result) {
        clipboard.copy(result, () => {
            wing.window.showInformationMessage("已成功解析exml中id,并复制对应的ts代码到剪切板,可使用粘贴操作到指定位置.");
        });
    } else {
        wing.window.showInformationMessage("exml中不存在id属性的节点.");
    }

}
开发者ID:lixin2628,项目名称:wing-extensions,代码行数:24,代码来源:extension.ts


示例7: 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


示例8:

 .then(onlineLink => {
     copyPaste.copy(onlineLink);
     vscode.window.showInformationMessage("The link has been copied to the clipboard.");
 });
开发者ID:lijunle,项目名称:vscode-gitlink,代码行数:4,代码来源:extension.ts


示例9: suite

suite("register", () => {
  let modeHandler: ModeHandler;

  let {
      newTest,
      newTestOnly,
  } = getTestingFunctions();

  setup(async () => {
    await setupWorkspace();
    modeHandler = new ModeHandler();
  });

  suiteTeardown(cleanUpWorkspace);

  newTest({
    title: "Can copy to a register",
    start: ['|one', 'two'],
    keysPressed: '"add"ap',
    end: ["two", "|one"],
  });

  clipboard.copy("12345");

  newTest({
    title: "Can access '*' (clipboard) register",
    start: ['|one'],
    keysPressed: '"*P',
    end: ["1234|5one"],
  });

  newTest({
    title: "Can access '+' (clipboard) register",
    start: ['|one'],
    keysPressed: '"+P',
    end: ["1234|5one"],
  });

  newTest({
    title: "Can use two registers together",
    start: ['|one', "two"],
    keysPressed: '"ayyj"byy"ap"bp',
    end: ["one", "two", "one", "|two"],
  });

  test("Yank stores text in Register '0'", async () => {
    modeHandler.vimState.editor = vscode.window.activeTextEditor!;

    await modeHandler.handleMultipleKeyEvents(
      'itest1\ntest2\ntest3'.split('')
    );

    await modeHandler.handleMultipleKeyEvents([
      '<Esc>',
      'g', 'g',
      'y', 'y',
      'j',
      'y', 'y',
      'g', 'g',
      'd', 'd',
      '"', '0',
      'P'
    ]);

    assertEqualLines([
      'test2',
      'test2',
      'test3'
    ]);
  });

  test("Register '1'-'9' stores delete content", async () => {
    modeHandler.vimState.editor = vscode.window.activeTextEditor!;

    await modeHandler.handleMultipleKeyEvents(
      'itest1\ntest2\ntest3\n'.split('')
    );

    await modeHandler.handleMultipleKeyEvents([
      '<Esc>',
      'g', 'g',
      'd', 'd',
      'd', 'd',
      'd', 'd',
      '"', '1', 'p',
      '"', '2', 'p',
      '"', '3', 'p'
    ]);

    assertEqualLines([
      '',
      'test3',
      'test2',
      'test1'
    ]);
  });

  test("\"A appends linewise text to \"a", async() => {
    modeHandler.vimState.editor = vscode.window.activeTextEditor!;

//.........这里部分代码省略.........
开发者ID:Platzer,项目名称:Vim,代码行数:101,代码来源:register.test.ts



注:本文中的copy-paste.copy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript copy-paste.paste函数代码示例发布时间:2022-05-25
下一篇:
TypeScript cookies.set函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap