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

TypeScript vscode-languageserver-types.TextDocumentIdentifier类代码示例

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

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



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

示例1: it

  it("returns type inferred under cursor with documentation", async () => {
    languageServer = await LanguageServer.startAndInitialize({
      textDocument: {
        hover: {
          dynamicRegistration: true,
          contentFormat: ["markdown", "plaintext"]
        }
      }
    });
    await languageServer.sendNotification("textDocument/didOpen", {
      textDocument: Types.TextDocumentItem.create(
        "file:///test.ml",
        "txt",
        0,
        "(** This function has a nice documentation *)\nlet id x = x\n"
      )
    });

    let result = await languageServer.sendRequest("textDocument/hover", {
      textDocument: Types.TextDocumentIdentifier.create("file:///test.ml"),
      position: Types.Position.create(1, 4)
    });

    expect(result).toMatchObject({
      contents: {
        kind: "markdown",
        value: "```ocaml\n'a -> 'a\n(** This function has a nice documentation *)\n```" }
    });
  });
开发者ID:the-lambda-church,项目名称:merlin,代码行数:29,代码来源:textDocument-hover.test.ts


示例2: query

 async function query(position) {
   return await languageServer.sendRequest("textDocument/rename", {
     textDocument: Types.TextDocumentIdentifier.create("file:///test.ml"),
     position,
     newName: "new_num"
   });
 }
开发者ID:the-lambda-church,项目名称:merlin,代码行数:7,代码来源:textDocument-rename.test.ts


示例3: it

    it("updates text document", async () => {
      let languageServer = await LanguageServer.startAndInitialize();
      await languageServer.sendNotification("textDocument/didOpen", {
        textDocument: Types.TextDocumentItem.create(
          "file:///test-document.txt",
          "txt",
          0,
          "Hello, World!"
        )
      });

      await languageServer.sendNotification("textDocument/didChange", {
        textDocument: Types.VersionedTextDocumentIdentifier.create(
          "file:///test-document.txt",
          1
        ),
        contentChanges: [{ text: "Hello again!" }]
      });

      let result = await languageServer.sendRequest("debug/textDocument/get", {
        textDocument: Types.TextDocumentIdentifier.create(
          "file:///test-document.txt"
        ),
        position: Types.Position.create(0, 0)
      });

      expect(result).toEqual("Hello again!");
      await LanguageServer.exit(languageServer);
    });
开发者ID:the-lambda-church,项目名称:merlin,代码行数:29,代码来源:TextDocument.test.ts


示例4: query

 async function query(position) {
   return await languageServer.sendRequest("textDocument/references", {
     textDocument: Types.TextDocumentIdentifier.create("file:///test.ml"),
     position,
     context: { includeDeclaration: false }
   });
 }
开发者ID:the-lambda-church,项目名称:merlin,代码行数:7,代码来源:textDocument-references.test.ts


示例5: getDoc

 async function getDoc(languageServer) {
   let result = await languageServer.sendRequest("debug/textDocument/get", {
     textDocument: Types.TextDocumentIdentifier.create(
       "file:///test-document.txt"
     ),
     position: Types.Position.create(0, 0)
   });
   return result;
 }
开发者ID:the-lambda-church,项目名称:merlin,代码行数:9,代码来源:TextDocument.test.ts


示例6: getDocColorPresentation

export function getDocColorPresentation(fileName: string, color: Color, range: Range): ColorPresentation[] {
    const fullPath = path.join(CASES_PATH, fileName);
    const src: string = fs.readFileSync(fullPath).toString();
    const doc = TextDocument.create(toVscodePath(fullPath), 'stylable', 1, src);

    return getColorPresentation(newCssService, doc, {
        textDocument: TextDocumentIdentifier.create(doc.uri),
        color,
        range
    });
}
开发者ID:wix,项目名称:stylable-intelligence,代码行数:11,代码来源:asserters.ts


示例7: queryCompletion

 async function queryCompletion(position) {
   let result = await languageServer.sendRequest("textDocument/completion", {
     textDocument: Types.TextDocumentIdentifier.create("file:///test.ml"),
     position
   });
   return result.items.map(item => {
     return {
       label: item.label,
       sortText: item.sortText,
       textEdit: item.textEdit,
     };
   });
 }
开发者ID:the-lambda-church,项目名称:merlin,代码行数:13,代码来源:textDocument-completion.test.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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