• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TextDocumentItem类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.lsp4j.TextDocumentItem的典型用法代码示例。如果您正苦于以下问题:Java TextDocumentItem类的具体用法?Java TextDocumentItem怎么用?Java TextDocumentItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TextDocumentItem类属于org.eclipse.lsp4j包,在下文中一共展示了TextDocumentItem类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onOpen

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
private void onOpen(
    final FileEvent event,
    final DtoFactory dtoFactory,
    final TextDocumentServiceClient serviceClient,
    final LanguageServerRegistry lsRegistry) {
  event
      .getFile()
      .getContent()
      .then(
          text -> {
            TextDocumentItem documentItem = dtoFactory.createDto(TextDocumentItem.class);
            documentItem.setUri(event.getFile().getLocation().toString());
            documentItem.setVersion(LanguageServerEditorConfiguration.INITIAL_DOCUMENT_VERSION);
            documentItem.setText(text);
            documentItem.setLanguageId(
                lsRegistry.getLanguageDescription(event.getFile()).getLanguageId());

            DidOpenTextDocumentParams openEvent =
                dtoFactory.createDto(DidOpenTextDocumentParams.class);
            openEvent.setTextDocument(documentItem);
            openEvent.getTextDocument().setUri(event.getFile().getLocation().toString());
            openEvent.setText(text);

            serviceClient.didOpen(openEvent);
          });
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:LanguageServerExtension.java


示例2: getLine

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
public String getLine(TextDocumentItem textDocumentItem, Position position) {
	String text = textDocumentItem.getText();
	String[] lines = text.split("\\r?\\n", position.getLine() + 2);
	if (lines.length >= position.getLine() + 1) {
		return lines[position.getLine()];
	}
	return null;
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:9,代码来源:ParserFileHelper.java


示例3: getCorrespondingCamelNodeForCompletion

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
/**
 * @param textDocumentItem
 * @param line 
 * @return Currently returns the first from Camel Node ignoring the exact position
 * @throws Exception 
 */
public Node getCorrespondingCamelNodeForCompletion(TextDocumentItem textDocumentItem, int line) throws Exception {
	if (hasElementFromCamelNamespace(textDocumentItem)) {
		Document parseXml = XmlLineNumberParser.parseXml(new ByteArrayInputStream(textDocumentItem.getText().getBytes(StandardCharsets.UTF_8)));
		Element documentElement = parseXml.getDocumentElement();
		return findElementAtLine(line, documentElement);
	} else {
		return null;
	}
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:16,代码来源:ParserFileHelper.java


示例4: hasElementFromCamelNamespace

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
private boolean hasElementFromCamelNamespace(TextDocumentItem textDocumentItem) throws SAXException, IOException, ParserConfigurationException {
	DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	dbf.setNamespaceAware(true);
	Document xmlParsed = dbf.newDocumentBuilder().parse(new ByteArrayInputStream(textDocumentItem.getText().getBytes(StandardCharsets.UTF_8)));
	for (String camelNodeTag : CAMEL_NODES_TAG) {
		if(hasElementFromCamelNameSpaces(xmlParsed.getElementsByTagName(camelNodeTag))){
			return true;
		}
	}
	return false;
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:12,代码来源:ParserFileHelper.java


示例5: didChange

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
@Override
public void didChange(DidChangeTextDocumentParams params) {
	LOGGER.info("didChange: " + params.getTextDocument());
	List<TextDocumentContentChangeEvent> contentChanges = params.getContentChanges();
	TextDocumentItem textDocumentItem = openedDocuments.get(params.getTextDocument().getUri());
	if (!contentChanges.isEmpty()) {
		textDocumentItem.setText(contentChanges.get(0).getText());
	}
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:10,代码来源:CamelTextDocumentService.java


示例6: openDocument

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
private void openDocument(ICompilationUnit cu, String content, int version) {
	DidOpenTextDocumentParams openParms = new DidOpenTextDocumentParams();
	TextDocumentItem textDocument = new TextDocumentItem();
	textDocument.setLanguageId("java");
	textDocument.setText(content);
	textDocument.setUri(JDTUtils.toURI(cu));
	textDocument.setVersion(version);
	openParms.setTextDocument(textDocument);
	lifeCycleHandler.didOpen(openParms);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:DocumentLifeCycleHandlerTest.java


示例7: getCamelComponentUri

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
public String getCamelComponentUri(TextDocumentItem textDocumentItem, Position position) {
	return getCamelComponentUri(getLine(textDocumentItem, position), position.getCharacter());
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:4,代码来源:ParserFileHelper.java


示例8: CamelEndpointCompletionProcessor

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
public CamelEndpointCompletionProcessor(TextDocumentItem textDocumentItem, CompletableFuture<CamelCatalog> camelCatalog) {
	this.textDocumentItem = textDocumentItem;
	this.camelCatalog = camelCatalog;
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:5,代码来源:CamelEndpointCompletionProcessor.java


示例9: completion

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
@Override
public CompletableFuture<Either<List<CompletionItem>, CompletionList>> completion(TextDocumentPositionParams completionRequest) {
	LOGGER.info("completion: " + completionRequest.getTextDocument().getUri());
	TextDocumentItem textDocumentItem = openedDocuments.get(completionRequest.getTextDocument().getUri());
	return new CamelEndpointCompletionProcessor(textDocumentItem, camelCatalog).getCompletions(completionRequest.getPosition()).thenApply(Either::forLeft);
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:7,代码来源:CamelTextDocumentService.java


示例10: hover

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
@Override
public CompletableFuture<Hover> hover(TextDocumentPositionParams position) {
	LOGGER.info("hover: " + position.getTextDocument());
	TextDocumentItem textDocumentItem = openedDocuments.get(position.getTextDocument().getUri());
	return new HoverProcessor(textDocumentItem, camelCatalog).getHover(position.getPosition());
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:7,代码来源:CamelTextDocumentService.java


示例11: didOpen

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
@Override
public void didOpen(DidOpenTextDocumentParams params) {
	TextDocumentItem textDocument = params.getTextDocument();
	LOGGER.info("didOpen: {0}", textDocument);
	openedDocuments.put(textDocument.getUri(), textDocument);
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:7,代码来源:CamelTextDocumentService.java


示例12: HoverProcessor

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
public HoverProcessor(TextDocumentItem textDocumentItem, CompletableFuture<CamelCatalog> camelCatalog) {
	this.textDocumentItem = textDocumentItem;
	this.camelCatalog = camelCatalog;
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:5,代码来源:HoverProcessor.java


示例13: createTestTextDocument

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
private TextDocumentItem createTestTextDocument(String text) {
	return new TextDocumentItem(DUMMY_URI, CamelLanguageServer.LANGUAGE_ID, 0, text);
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:4,代码来源:AbstractCamelLanguageServerTest.java


示例14: DidOpenTextDocumentParams

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
public DidOpenTextDocumentParams(@NonNull final TextDocumentItem textDocument) {
  this.textDocument = textDocument;
}
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:4,代码来源:DidOpenTextDocumentParams.java


示例15: getTextDocument

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
/**
 * The document that was opened.
 */
@Pure
@NonNull
public TextDocumentItem getTextDocument() {
  return this.textDocument;
}
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:9,代码来源:DidOpenTextDocumentParams.java


示例16: setTextDocument

import org.eclipse.lsp4j.TextDocumentItem; //导入依赖的package包/类
/**
 * The document that was opened.
 */
public void setTextDocument(@NonNull final TextDocumentItem textDocument) {
  this.textDocument = textDocument;
}
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:7,代码来源:DidOpenTextDocumentParams.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SqlRowOperator类代码示例发布时间:2022-05-23
下一篇:
Java JTicketsFinder类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap