本文整理匯總了TypeScript中vscode-languageserver.TextDocumentPosition類的典型用法代碼示例。如果您正苦於以下問題:TypeScript TextDocumentPosition類的具體用法?TypeScript TextDocumentPosition怎麽用?TypeScript TextDocumentPosition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了TextDocumentPosition類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: testComputeInfo
function testComputeInfo(value: string, schema: JsonSchema.IJSONSchema, position: Position): Thenable<Hover> {
var uri = 'test://test.json';
var schemaService = new SchemaService.JSONSchemaService(requestService);
var hoverProvider = new JSONHover(schemaService);
var id = "http://myschemastore/test1";
schemaService.registerExternalSchema(id, ["*.json"], schema);
var document = ITextDocument.create(uri, value);
var textDocumentLocation = TextDocumentPosition.create(uri, position);
var jsonDoc = Parser.parse(value);
return hoverProvider.doHover(document, textDocumentLocation, jsonDoc);
}
示例2: function
var testSuggestionsFor = function(value: string, stringAfter: string, schema: JsonSchema.IJSONSchema, test: (items: CompletionItem[], document: ITextDocument) => void) : Thenable<void> {
var uri = 'test://test.json';
var idx = stringAfter ? value.indexOf(stringAfter) : 0;
var schemaService = new SchemaService.JSONSchemaService(requestService);
var completionProvider = new JSONCompletion(schemaService, console);
if (schema) {
var id = "http://myschemastore/test1";
schemaService.registerExternalSchema(id, ["*.json"], schema);
}
var document = ITextDocument.create(uri, value);
var textDocumentLocation = TextDocumentPosition.create(uri, Position.create(0, idx));
var jsonDoc = Parser.parse(value);
return completionProvider.doSuggest(document, textDocumentLocation, jsonDoc).then(list => list.items).then(completions => {
test(completions, document);
return null;
})
};