当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TextDocuments.get方法代码示例

本文整理汇总了TypeScript中vscode-languageserver.TextDocuments.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TextDocuments.get方法的具体用法?TypeScript TextDocuments.get怎么用?TypeScript TextDocuments.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vscode-languageserver.TextDocuments的用法示例。


在下文中一共展示了TextDocuments.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

connection.onReferences(referenceParams => {
	let document = documents.get(referenceParams.textDocument.uri);
	let mode = languageModes.getModeAtPosition(document, referenceParams.position);
	if (mode && mode.findReferences) {
		return mode.findReferences(document, referenceParams.position);
	}
	return [];
});
开发者ID:fs814,项目名称:vscode,代码行数:8,代码来源:htmlServerMain.ts

示例2: format

connection.onDocumentRangeFormatting(formatParams => {
	let document = documents.get(formatParams.textDocument.uri);

	let unformattedTags: string = settings && settings.html && settings.html.format && settings.html.format.unformatted || '';
	let enabledModes = { css: !unformattedTags.match(/\bstyle\b/), javascript: !unformattedTags.match(/\bscript\b/) };

	return format(languageModes, document, formatParams.range, formatParams.options, enabledModes);
});
开发者ID:Chan-PH,项目名称:vscode,代码行数:8,代码来源:htmlServerMain.ts

示例3:

connection.onCompletionResolve(item => {
  const data = item.data;
  if (data && data.languageId && data.uri) {
    const document = documents.get(data.uri);
    return vls.doResolve(document, data.languageId, item);
  }
  return item;
});
开发者ID:cryptobuks,项目名称:tandem,代码行数:8,代码来源:pcServerMain.ts

示例4:

connection.onDocumentRangeFormatting(formatParams => {
	let document = documents.get(formatParams.textDocument.uri);
	let startMode = languageModes.getModeAtPosition(document, formatParams.range.start);
	let endMode = languageModes.getModeAtPosition(document, formatParams.range.end);
	if (startMode && startMode === endMode && startMode.format) {
		return startMode.format(document, formatParams.range, formatParams.options);
	}
	return null;
});
开发者ID:,项目名称:,代码行数:9,代码来源:

示例5:

connection.onCompletion((textDocumentPositionParams: TextDocumentPositionParams): CompletionItem[] => {
    let document = documents.get(textDocumentPositionParams.textDocument.uri)
    let lang = document.languageId || 'javascript'
    let offset = document.offsetAt(textDocumentPositionParams.position)

    return {
        'xquery-ml': completeXQuery,
        'javascript': completeSJS
    }[lang](document, offset)
})
开发者ID:mikrovvelle,项目名称:mlxprs,代码行数:10,代码来源:server.ts

示例6:

connection.onRequest(ColorPresentationRequest.type, params => {
	let document = documents.get(params.textDocument.uri);
	if (document) {
		let mode = languageModes.getModeAtPosition(document, params.colorInfo.range.start);
		if (mode && mode.getColorPresentations) {
			return mode.getColorPresentations(document, params.colorInfo);
		}
	}
	return [];
});
开发者ID:elibarzilay,项目名称:vscode,代码行数:10,代码来源:htmlServerMain.ts

示例7:

connection.onDocumentSymbol(documentSymbolParms => {
	let document = documents.get(documentSymbolParms.textDocument.uri);
	let symbols: SymbolInformation[] = [];
	languageModes.getAllModesInDocument(document).forEach(m => {
		if (m.findDocumentSymbols) {
			pushAll(symbols, m.findDocumentSymbols(document));
		}
	});
	return symbols;
});
开发者ID:armanio123,项目名称:vscode,代码行数:10,代码来源:htmlServerMain.ts


注:本文中的vscode-languageserver.TextDocuments.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。