本文整理汇总了TypeScript中vscode-languageserver-types.VersionedTextDocumentIdentifier类的典型用法代码示例。如果您正苦于以下问题:TypeScript VersionedTextDocumentIdentifier类的具体用法?TypeScript VersionedTextDocumentIdentifier怎么用?TypeScript VersionedTextDocumentIdentifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VersionedTextDocumentIdentifier类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: test
test('VersionedTextDocumentIdentifier', () => {
let uri = 'file:///folder/file.txt';
let identifier = VersionedTextDocumentIdentifier.create(uri, 9);
strictEqual(identifier.uri, uri);
strictEqual(identifier.version, 9);
ok(VersionedTextDocumentIdentifier.is(identifier));
});
开发者ID:Blacklite,项目名称:vscode-languageserver-node,代码行数:7,代码来源:helpers.test.ts
示例2: it
it("updates in the middle of the line", async () => {
let languageServer = await LanguageServer.startAndInitialize();
await languageServer.sendNotification("textDocument/didOpen", {
textDocument: Types.TextDocumentItem.create(
"file:///test-document.txt",
"txt",
0,
"let x = 1;\n\nlet y = 2;"
)
});
expect(await getDoc(languageServer)).toEqual("let x = 1;\n\nlet y = 2;");
await languageServer.sendNotification("textDocument/didChange", {
textDocument: Types.VersionedTextDocumentIdentifier.create(
"file:///test-document.txt",
1
),
contentChanges: [
{
range: {
start: { line: 2, character: 5 },
end: { line: 2, character: 5 }
},
rangeLength: 0,
text: "1"
}
]
});
expect(await getDoc(languageServer)).toEqual("let x = 1;\n\nlet y1 = 2;");
await languageServer.sendNotification("textDocument/didChange", {
textDocument: Types.VersionedTextDocumentIdentifier.create(
"file:///test-document.txt",
1
),
contentChanges: [
{
range: {
start: { line: 2, character: 5 },
end: { line: 2, character: 6 }
},
rangeLength: 1,
text: ""
}
]
});
expect(await getDoc(languageServer)).toEqual("let x = 1;\n\nlet y = 2;");
await LanguageServer.exit(languageServer);
});
开发者ID:the-lambda-church,项目名称:merlin,代码行数:52,代码来源:TextDocument.test.ts
示例3: it
it('should return false for change to file not exists', async () => {
let uri = URI.file('/tmp/not_exists').toString()
let versioned = VersionedTextDocumentIdentifier.create(uri, null)
let edit = TextEdit.insert(Position.create(0, 0), 'bar')
let documentChanges = [TextDocumentEdit.create(versioned, [edit])]
let res = await workspace.applyEdit({ documentChanges })
expect(res).toBe(false)
})
开发者ID:illarionvk,项目名称:dotfiles,代码行数:8,代码来源:workspace.test.ts
注:本文中的vscode-languageserver-types.VersionedTextDocumentIdentifier类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论