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


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

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