Java 类org.eclipse.lsp4j.services.TextDocumentService 实例源码

项目:camel-language-server    文件:AbstractCamelLanguageServerTest.java   
protected CompletableFuture<Either<List<CompletionItem>, CompletionList>> getCompletionFor(CamelLanguageServer camelLanguageServer, Position position) {
    TextDocumentService textDocumentService = camelLanguageServer.getTextDocumentService();

    TextDocumentPositionParams dummyCompletionPositionRequest = new TextDocumentPositionParams(new TextDocumentIdentifier(DUMMY_URI), position);
    CompletableFuture<Either<List<CompletionItem>, CompletionList>> completions = textDocumentService.completion(dummyCompletionPositionRequest);
    return completions;
}
项目:camel-language-server    文件:AbstractLanguageServer.java   
/**
 * @return the textDocumentService
 */
public TextDocumentService getTextDocumentService() {
    return this.textDocumentService;
}
项目:camel-language-server    文件:AbstractLanguageServer.java   
/**
 * @param textDocumentService the textDocumentService to set
 */
protected void setTextDocumentService(TextDocumentService textDocumentService) {
    this.textDocumentService = textDocumentService;
}
项目:vscode-javac    文件:JavaLanguageServer.java   
@Override
public TextDocumentService getTextDocumentService() {
    return textDocuments;
}
项目:SOMns-vscode    文件:SomLanguageServer.java   
@Override
public TextDocumentService getTextDocumentService() {
  // TODO: perhaps break this out into separate object
  return this;
}
项目:eclipse.jdt.ls    文件:JDTLanguageServer.java   
@Override
public TextDocumentService getTextDocumentService() {
    return this;
}
项目:xtext-core    文件:LanguageServerImpl.java   
@Override
public TextDocumentService getTextDocumentService() {
  return this;
}
项目:lsp4j    文件:RpcMethodTest.java   
@Test public void testDocumentSymbol() {
    Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(TextDocumentService.class);
    JsonRpcMethod jsonRpcMethod = methods.get("textDocument/documentSymbol");
    Assert.assertNotNull(jsonRpcMethod);
}
项目:lsp4j    文件:RpcMethodTest.java   
@Test public void testCodelensResolve() {
    Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(TextDocumentService.class);
    Assert.assertNotNull(methods.get("codeLens/resolve"));
    Assert.assertNotNull(methods.get("completionItem/resolve"));
}
项目:lsp4j    文件:MockLanguageServer.java   
@Override
public TextDocumentService getTextDocumentService() {
    return this;
}
项目:lsp4j    文件:NullResponseTest.java   
@Override
public TextDocumentService getTextDocumentService() {
    return null;
}
项目:che    文件:LanguageServerRegistryImplTest.java   
@BeforeMethod
public void setUp() throws Exception {

  this.serverCapabilities = new ServerCapabilities();
  serverDescription =
      new LanguageServerDescription(
          "foo", Collections.singletonList("id"), Collections.emptyList());
  initializeResult = new InitializeResult(serverCapabilities);

  completableFuture = completedFuture(initializeResult);

  when(languageServerLauncher.isAbleToLaunch()).thenReturn(true);
  when(languageServerLauncher.getDescription()).thenReturn(serverDescription);
  when(languageServerLauncher.isLocal()).thenReturn(true);
  when(languageDescription.getLanguageId()).thenReturn("id");
  when(languageDescription.getFileExtensions()).thenReturn(Collections.singletonList("txt"));
  when(languageDescription.getMimeType()).thenReturn("plain/text");

  when(languageServer.getTextDocumentService()).thenReturn(mock(TextDocumentService.class));
  when(languageServer.initialize(any(InitializeParams.class))).thenReturn(completableFuture);

  when(languageRecognizer.recognizeByPath(anyString())).thenReturn(languageDescription);
  when(languageRecognizer.recognizeById(anyString())).thenReturn(languageDescription);

  when(pmp.get()).thenReturn(pm);

  when(clientFactory.create(anyString())).thenReturn(languageClient);

  when(httpJsonRequestFactory.fromUrl(any(String.class))).thenReturn(httpJsonRequest);
  when(httpJsonRequest.useGetMethod()).thenReturn(httpJsonRequest);
  when(httpJsonRequest.request()).thenReturn(httpJsonResponse);
  when(httpJsonResponse.asDto(any())).thenReturn(workspace);

  registry =
      spy(
          new LanguageServerRegistryImpl(
              "",
              "",
              httpJsonRequestFactory,
              new HashSet<>(),
              Collections.singleton(languageServerLauncher),
              Collections.singleton(languageDescription),
              pmp,
              initializer,
              null,
              clientFactory,
              languageRecognizer) {
            @Override
            protected String extractProjectPath(String filePath) throws LanguageServerException {
              return PROJECT_PATH;
            }
          });

  when(initializer.initialize(
          any(LanguageServerLauncher.class), any(LanguageClient.class), anyString()))
      .thenAnswer(invocation -> completedFuture(Pair.of(languageServer, initializeResult)));
}
项目:che    文件:MavenLanguageServer.java   
@Override
public TextDocumentService getTextDocumentService() {
  return textDocumentService;
}