本文整理汇总了TypeScript中vscode-languageserver-types.Range类的典型用法代码示例。如果您正苦于以下问题:TypeScript Range类的具体用法?TypeScript Range怎么用?TypeScript Range使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Range类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: fn
let promise = new Promise<TextEdit[]>(resolve => {
fn()
let edit: TextEdit = {
newText: 'foo',
range: Range.create(0, 0, 0, 0)
}
resolve([edit])
})
开发者ID:demelev,项目名称:coc.nvim,代码行数:8,代码来源:workspace.test.ts
示例2:
const ranges = applicableRanges.map(pair => {
return {
range: Range.create(
document.positionAt(pair[0]),
document.positionAt(pair[1])
),
kind: SelectionRangeKind.Statement
};
});
开发者ID:Microsoft,项目名称:vscode-css-languageservice,代码行数:9,代码来源:cssSelectionRange.ts
示例3: it
it('should get quickfix item from Location', async () => {
let filepath = await createTmpFile('quickfix')
let uri = URI.file(filepath).toString()
let p = Position.create(0, 0)
let loc = Location.create(uri, Range.create(p, p))
let item = await workspace.getQuickfixItem(loc)
expect(item.filename).toBe(filepath)
expect(item.text).toBe('quickfix')
})
开发者ID:illarionvk,项目名称:dotfiles,代码行数:9,代码来源:workspace.test.ts
示例4: test
test('CodeLens', () => {
let codeLens = CodeLens.create(Range.create(1,2,8,9), 'data');
let range = codeLens.range;
strictEqual(range.start.line, 1);
strictEqual(range.start.character, 2);
strictEqual(range.end.line, 8);
strictEqual(range.end.character, 9);
strictEqual(codeLens.data, 'data');
});
开发者ID:Blacklite,项目名称:vscode-languageserver-node,代码行数:9,代码来源:helpers.test.ts
示例5: test
test('Interpolation', () => {
testSymbolsFor('<div>{{test}}</div>', [
{
containerName: '',
name: 'div',
kind: SymbolKind.Field,
location: Location.create(TEST_URI, Range.create(0, 0, 0, 19))
}
]);
});
开发者ID:tiravata,项目名称:vetur,代码行数:10,代码来源:symbols.test.ts
示例6: _selectorCallSymbol
/**
* Handler for selector call symbols
* @param {Object} node
* @param {String[]} text - text editor content splitted by lines
* @return {SymbolInformation}
*/
function _selectorCallSymbol(node: StylusNode, text: string[]): SymbolInformation {
const lineno = Number(node.lineno) - 1;
const name = prepareName(text[lineno]);
const column = Math.max(text[lineno].indexOf(name), 0);
const posStart = Position.create(lineno, column);
const posEnd = Position.create(lineno, column + name.length);
return SymbolInformation.create(name, SymbolKind.Class, Range.create(posStart, posEnd));
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:16,代码来源:symbols-finder.ts
示例7: _functionSymbol
/**
* Handler for function
* @param {Object} node
* @param {String[]} text - text editor content splitted by lines
* @return {SymbolInformation}
*/
function _functionSymbol(node: StylusNode, text: string[]): SymbolInformation {
const name = node.name;
const lineno = Number(node.val!.lineno) - 1;
const column = Math.max(text[lineno].indexOf(name), 0);
const posStart = Position.create(lineno, column);
const posEnd = Position.create(lineno, column + name.length);
const range = Range.create(posStart, posEnd);
return SymbolInformation.create(name, SymbolKind.Function, range);
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:17,代码来源:symbols-finder.ts
示例8: createDocument
async function createDocument(): Promise<Document> {
let doc = await helper.createDocument()
let collection = manager.create('test')
let diagnostics: Diagnostic[] = []
await doc.buffer.setLines(['foo bar foo bar', 'foo bar', 'foo', 'bar'], {
start: 0,
end: -1,
strictIndexing: false
})
diagnostics.push(createDiagnostic('error', Range.create(0, 2, 0, 4), DiagnosticSeverity.Error))
diagnostics.push(createDiagnostic('warning', Range.create(0, 5, 0, 6), DiagnosticSeverity.Warning))
diagnostics.push(createDiagnostic('information', Range.create(1, 0, 1, 1), DiagnosticSeverity.Information))
diagnostics.push(createDiagnostic('hint', Range.create(1, 2, 1, 3), DiagnosticSeverity.Hint))
diagnostics.push(createDiagnostic('error', Range.create(2, 0, 2, 2), DiagnosticSeverity.Error))
collection.set(doc.uri, diagnostics)
await helper.wait(200)
let buf = manager.buffers.find(b => b.bufnr == doc.bufnr)
await (buf as any).sequence.ready
return doc
}
开发者ID:demelev,项目名称:coc.nvim,代码行数:20,代码来源:diagnosticManager.test.ts
示例9: toDiagnostic
function toDiagnostic(error: ESLintError): Diagnostic {
const line = error.line - 1;
const column = error.column - 1;
const endLine = error.endLine ? error.endLine - 1 : line;
const endColumn = error.endColumn ? error.endColumn - 1 : column;
return {
range: Range.create(line, column, endLine, endColumn),
message: `\n[${error.ruleId}]\n${error.message}`,
source: 'eslint-plugin-vue',
severity: error.severity === 1 ? DiagnosticSeverity.Warning : DiagnosticSeverity.Error
};
}
开发者ID:tiravata,项目名称:vetur,代码行数:12,代码来源:htmlValidation.ts
示例10: toDiagnostic
function toDiagnostic(error: ESLintError): Diagnostic {
const line = error.line - 1;
const column = error.column - 1;
const endLine = error.endLine ? error.endLine - 1 : line;
const endColumn = error.endColumn ? error.endColumn - 1 : column;
return {
range: Range.create(line, column, endLine, endColumn),
message: error.message,
source: 'vue-language-server',
severity: error.severity === 1 ? DiagnosticSeverity.Warning : DiagnosticSeverity.Error
};
}
开发者ID:cryptobuks,项目名称:tandem,代码行数:12,代码来源:htmlValidation.ts
注:本文中的vscode-languageserver-types.Range类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论