本文整理汇总了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));
});
示例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);
});
示例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)
})