當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript vscode-languageserver-types.TextDocumentIdentifier類代碼示例

本文整理匯總了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;未經允許,請勿轉載。