Java 类org.eclipse.lsp4j.DocumentOnTypeFormattingParams 实例源码

项目:xtext-core    文件:LanguageServerImpl.java   
@Override
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(final DocumentOnTypeFormattingParams params) {
  throw new UnsupportedOperationException("TODO: auto-generated method stub");
}
项目:che    文件:TextDocumentService.java   
private List<TextEditDto> onTypeFormatting(
    DocumentOnTypeFormattingParams documentOnTypeFormattingParams) {
  try {
    String uri = prefixURI(documentOnTypeFormattingParams.getTextDocument().getUri());
    documentOnTypeFormattingParams.getTextDocument().setUri(uri);
    InitializedLanguageServer server =
        languageServerRegistry
            .getApplicableLanguageServers(uri)
            .stream()
            .flatMap(Collection::stream)
            .filter(
                s ->
                    s.getInitializeResult()
                            .getCapabilities()
                            .getDocumentOnTypeFormattingProvider()
                        != null)
            .findFirst()
            .get();
    return server == null
        ? Collections.emptyList()
        : server
            .getServer()
            .getTextDocumentService()
            .onTypeFormatting(documentOnTypeFormattingParams)
            .get()
            .stream()
            .map(TextEditDto::new)
            .collect(Collectors.toList());
  } catch (InterruptedException | ExecutionException | LanguageServerException e) {
    throw new JsonRpcException(-27000, e.getMessage());
  }
}
项目:camel-language-server    文件:CamelTextDocumentService.java   
@Override
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params) {
    LOGGER.info("onTypeFormatting: " + params.getTextDocument());
    return CompletableFuture.completedFuture(Collections.emptyList());
}
项目:SOMns-vscode    文件:SomLanguageServer.java   
@Override
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(
    final DocumentOnTypeFormattingParams params) {
  // TODO Auto-generated method stub
  return null;
}
项目:eclipse.jdt.ls    文件:JDTLanguageServer.java   
@Override
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params) {
    logInfo(">> document/onTypeFormatting");
    // Not yet implemented
    return null;
}
项目:lsp4j    文件:MockLanguageServer.java   
@Override
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params) {
    throw new UnsupportedOperationException();
}
项目:che    文件:LanguageServerFormatter.java   
@Override
public void install(TextEditor editor) {
  this.editor = editor;
  if (capabilities.getDocumentOnTypeFormattingProvider() != null
      && capabilities.getDocumentOnTypeFormattingProvider().getFirstTriggerCharacter() != null) {
    editor
        .getDocument()
        .getDocumentHandle()
        .getDocEventBus()
        .addHandler(
            DocumentChangedEvent.TYPE,
            new DocumentChangedHandler() {
              @Override
              public void onDocumentChanged(DocumentChangedEvent event) {
                if (capabilities
                    .getDocumentOnTypeFormattingProvider()
                    .getFirstTriggerCharacter()
                    .equals(event.getText())) {
                  Document document = event.getDocument().getDocument();

                  DocumentOnTypeFormattingParams params =
                      dtoFactory.createDto(DocumentOnTypeFormattingParams.class);
                  TextDocumentIdentifier identifier =
                      dtoFactory.createDto(TextDocumentIdentifier.class);
                  identifier.setUri(document.getFile().getLocation().toString());
                  params.setTextDocument(identifier);
                  params.setOptions(getFormattingOptions());
                  params.setCh(event.getText());

                  TextPosition position = document.getPositionFromIndex(event.getOffset());

                  Position start = dtoFactory.createDto(Position.class);
                  start.setLine(position.getLine());
                  start.setCharacter(position.getCharacter());
                  params.setPosition(start);

                  Promise<List<TextEdit>> promise = client.onTypeFormatting(params);
                  handleFormatting(promise, document);
                }
              }
            });
  }
}
项目:che    文件:MavenTextDocumentService.java   
@Override
public CompletableFuture<List<? extends TextEdit>> onTypeFormatting(
    DocumentOnTypeFormattingParams params) {
  return null;
}
项目:che    文件:TextDocumentService.java   
@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);
}
项目:SOMns-vscode    文件:TextDocumentService.java   
/**
 * The document on type formatting request is sent from the client to the
 * server to format parts of the document during typing.
 * 
 * Registration Options: DocumentOnTypeFormattingRegistrationOptions
 */
@JsonRequest
CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params);
项目:lsp4j    文件:TextDocumentService.java   
/**
 * The document on type formatting request is sent from the client to the
 * server to format parts of the document during typing.
 * 
 * Registration Options: DocumentOnTypeFormattingRegistrationOptions
 */
@JsonRequest
CompletableFuture<List<? extends TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params);
项目:che    文件:TextDocumentServiceClient.java   
/**
 * GWT client implementation of {@link TextDocumentService#formatting(DocumentFormattingParams)}
 *
 * @param params
 * @return
 */
public Promise<List<TextEdit>> onTypeFormatting(DocumentOnTypeFormattingParams params) {
  return transmitDtoAndReceiveDtoList(params, "textDocument/onTypeFormatting", TextEdit.class);
}