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

Java DidChangeTextDocumentParams类代码示例

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

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



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

示例1: testChangeEventUpdatesStoredText

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@Test
public void testChangeEventUpdatesStoredText() throws Exception {
	CamelLanguageServer camelLanguageServer = initializeLanguageServer("<to uri=\"\" xmlns=\"http://camel.apache.org/schema/blueprint\"></to>\n");
	
	DidChangeTextDocumentParams changeEvent = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(DUMMY_URI);
	changeEvent.setTextDocument(textDocument);
	TextDocumentContentChangeEvent contentChange = new TextDocumentContentChangeEvent("<to xmlns=\"http://camel.apache.org/schema/blueprint\" uri=\"\"></to>\n");
	changeEvent.setContentChanges(Collections.singletonList(contentChange));
	camelLanguageServer.getTextDocumentService().didChange(changeEvent);
	
	//check old position doesn't provide completion
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> completionsAtOldPosition = getCompletionFor(camelLanguageServer, new Position(0, 11));
	assertThat(completionsAtOldPosition.get().getLeft()).isEmpty();
	
	//check new position provides completion
	CompletableFuture<Either<List<CompletionItem>, CompletionList>> completionsAtNewPosition = getCompletionFor(camelLanguageServer, new Position(0, 58));
	assertThat(completionsAtNewPosition.get().getLeft()).isNotEmpty();
	
}
 
开发者ID:lhein,项目名称:camel-language-server,代码行数:22,代码来源:CamelTextDocumentServiceTest.java


示例2: changeDocument

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
private void changeDocument(ICompilationUnit cu, String content, int version, Range range, int length) throws JavaModelException {
	DidChangeTextDocumentParams changeParms = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(JDTUtils.toURI(cu));
	textDocument.setVersion(version);
	changeParms.setTextDocument(textDocument);
	TextDocumentContentChangeEvent event = new TextDocumentContentChangeEvent();
	if (range != null) {
		event.setRange(range);
		event.setRangeLength(length);
	}
	event.setText(content);
	List<TextDocumentContentChangeEvent> contentChanges = new ArrayList<>();
	contentChanges.add(event);
	changeParms.setContentChanges(contentChanges);
	lifeCycleHandler.didChange(changeParms);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:18,代码来源:DocumentLifeCycleHandlerTest.java


示例3: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
private void didChange(DidChangeTextDocumentParams didChangeTextDocumentParams) {
  try {
    String uri = prefixURI(didChangeTextDocumentParams.getTextDocument().getUri());
    didChangeTextDocumentParams.getTextDocument().setUri(uri);
    didChangeTextDocumentParams.setUri(prefixURI(didChangeTextDocumentParams.getUri()));
    languageServerRegistry
        .getApplicableLanguageServers(uri)
        .stream()
        .flatMap(Collection::stream)
        .map(InitializedLanguageServer::getServer)
        .forEach(
            server -> {
              server.getTextDocumentService().didChange(didChangeTextDocumentParams);
            });
  } catch (LanguageServerException e) {
    LOG.error("Error trying to process textDocument/didChange", e);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:TextDocumentService.java


示例4: syncTextDocument

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@Override
public void syncTextDocument(
    Document document, TextPosition start, TextPosition end, String insertedText, int version) {

  DidChangeTextDocumentParams changeDTO = dtoFactory.createDto(DidChangeTextDocumentParams.class);
  String uri = document.getFile().getLocation().toString();
  changeDTO.setUri(uri);
  VersionedTextDocumentIdentifier versionedDocId =
      dtoFactory.createDto(VersionedTextDocumentIdentifier.class);
  versionedDocId.setUri(uri);
  versionedDocId.setVersion(version);
  changeDTO.setTextDocument(versionedDocId);
  TextDocumentContentChangeEvent actualChange =
      dtoFactory.createDto(TextDocumentContentChangeEvent.class);

  actualChange.setText(document.getContents());
  changeDTO.setContentChanges(Collections.singletonList(actualChange));
  textDocumentService.didChange(changeDTO);
}
 
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:FullTextDocumentSynchronize.java


示例5: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的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: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
public void didChange(DidChangeTextDocumentParams params) {
	try {
		ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
			@Override
			public void run(IProgressMonitor monitor) throws CoreException {
				handleChanged(params);
			}
		}, new NullProgressMonitor());
	} catch (CoreException e) {
		JavaLanguageServerPlugin.logException("Handle document change ", e);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:13,代码来源:DocumentLifeCycleHandler.java


示例7: changeDocument

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
private void changeDocument(ICompilationUnit unit, String content, int version) throws JavaModelException {
	DidChangeTextDocumentParams changeParms = new DidChangeTextDocumentParams();
	VersionedTextDocumentIdentifier textDocument = new VersionedTextDocumentIdentifier();
	textDocument.setUri(JDTUtils.toURI(unit));
	textDocument.setVersion(version);
	changeParms.setTextDocument(textDocument);
	TextDocumentContentChangeEvent event = new TextDocumentContentChangeEvent();
	event.setText(content);
	List<TextDocumentContentChangeEvent> contentChanges = new ArrayList<>();
	contentChanges.add(event);
	changeParms.setContentChanges(contentChanges);
	lifeCycleHandler.didChange(changeParms);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:14,代码来源:CompletionHandlerTest.java


示例8: syncTextDocument

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@Override
public void syncTextDocument(
    Document document,
    TextPosition startPosition,
    TextPosition endPosition,
    String insertedText,
    int version) {
  DidChangeTextDocumentParams changeDTO = dtoFactory.createDto(DidChangeTextDocumentParams.class);
  String uri = document.getFile().getLocation().toString();
  changeDTO.setUri(uri);
  VersionedTextDocumentIdentifier versionedDocId =
      dtoFactory.createDto(VersionedTextDocumentIdentifier.class);
  versionedDocId.setUri(uri);
  versionedDocId.setVersion(version);
  changeDTO.setTextDocument(versionedDocId);

  Range range = dtoFactory.createDto(Range.class);
  Position start = dtoFactory.createDto(Position.class);
  start.setLine(startPosition.getLine());
  start.setCharacter(startPosition.getCharacter());
  Position end = dtoFactory.createDto(Position.class);
  end.setLine(endPosition.getLine());
  end.setCharacter(endPosition.getCharacter());
  range.setStart(start);
  range.setEnd(end);

  TextDocumentContentChangeEvent actualChange =
      dtoFactory.createDto(TextDocumentContentChangeEvent.class);
  actualChange.setRange(range);
  actualChange.setText(insertedText);

  changeDTO.setContentChanges(Collections.singletonList(actualChange));
  textDocumentService.didChange(changeDTO);
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:IncrementalTextDocumentSynchronize.java


示例9: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@Override
public void didChange(final DidChangeTextDocumentParams params) {
  validateTextDocument(params.getTextDocument().getUri(),
      params.getContentChanges());
}
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:6,代码来源:SomLanguageServer.java


示例10: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@Override
public void didChange(DidChangeTextDocumentParams params) {
	logInfo(">> document/didChange");
	documentLifeCycleHandler.didChange(params);
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:6,代码来源:JDTLanguageServer.java


示例11: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@Override
public void didChange(DidChangeTextDocumentParams params) {
	throw new UnsupportedOperationException();
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:5,代码来源:MockLanguageServer.java


示例12: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@Override
public void didChange(DidChangeTextDocumentParams params) {}
 
开发者ID:eclipse,项目名称:che,代码行数:3,代码来源:MavenTextDocumentService.java


示例13: configureMethods

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
@PostConstruct
public void configureMethods() {
  dtoToDtoList(
      "definition", TextDocumentPositionParams.class, LocationDto.class, this::definition);
  dtoToDtoList("codeAction", CodeActionParams.class, CommandDto.class, this::codeAction);
  dtoToDtoList(
      "documentSymbol",
      DocumentSymbolParams.class,
      SymbolInformationDto.class,
      this::documentSymbol);
  dtoToDtoList("formatting", DocumentFormattingParams.class, TextEditDto.class, this::formatting);
  dtoToDtoList(
      "rangeFormatting",
      DocumentRangeFormattingParams.class,
      TextEditDto.class,
      this::rangeFormatting);
  dtoToDtoList("references", ReferenceParams.class, LocationDto.class, this::references);
  dtoToDtoList(
      "onTypeFormatting",
      DocumentOnTypeFormattingParams.class,
      TextEditDto.class,
      this::onTypeFormatting);

  dtoToDto(
      "completionItem/resolve",
      ExtendedCompletionItem.class,
      ExtendedCompletionItemDto.class,
      this::completionItemResolve);
  dtoToDto(
      "documentHighlight",
      TextDocumentPositionParams.class,
      DocumentHighlight.class,
      this::documentHighlight);
  dtoToDto(
      "completion",
      TextDocumentPositionParams.class,
      ExtendedCompletionListDto.class,
      this::completion);
  dtoToDto("hover", TextDocumentPositionParams.class, HoverDto.class, this::hover);
  dtoToDto(
      "signatureHelp",
      TextDocumentPositionParams.class,
      SignatureHelpDto.class,
      this::signatureHelp);

  dtoToDto("rename", RenameParams.class, RenameResultDto.class, this::rename);

  dtoToNothing("didChange", DidChangeTextDocumentParams.class, this::didChange);
  dtoToNothing("didClose", DidCloseTextDocumentParams.class, this::didClose);
  dtoToNothing("didOpen", DidOpenTextDocumentParams.class, this::didOpen);
  dtoToNothing("didSave", DidSaveTextDocumentParams.class, this::didSave);
}
 
开发者ID:eclipse,项目名称:che,代码行数:53,代码来源:TextDocumentService.java


示例14: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
/**
 * The document change notification is sent from the client to the server to
 * signal changes to a text document.
 * 
 * Registration Options: TextDocumentChangeRegistrationOptions
 */
@JsonNotification
void didChange(DidChangeTextDocumentParams params);
 
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:9,代码来源:TextDocumentService.java


示例15: didChange

import org.eclipse.lsp4j.DidChangeTextDocumentParams; //导入依赖的package包/类
/**
 * GWT client implementation of {@link TextDocumentService#didChange(DidChangeTextDocumentParams)}
 *
 * @param params
 * @return
 */
public void didChange(DidChangeTextDocumentParams params) {
  transmitDtoAndReceiveNothing(params, "textDocument/didChange");
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:TextDocumentServiceClient.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java AbstractDataProvider类代码示例发布时间:2022-05-23
下一篇:
Java OctJwkGenerator类代码示例发布时间: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