@Test void initialize() { MyLanguageServerImpl server = new MyLanguageServerImpl(null, null, null, null); InitializeParams initializeParams = new InitializeParams(); List<WorkspaceFolder> workspaceFolders = singletonList(new WorkspaceFolder("uri", "name")); initializeParams.setWorkspaceFolders(workspaceFolders); try { InitializeResult result = server.initialize(initializeParams).get(); checkOnlySupportedCapabilitiesAreSet(result.getCapabilities()); } catch (InterruptedException | ExecutionException e) { fail(e.getMessage()); } }
@Override @Nonnull public CompletableFuture<InitializeResult> initialize(@Nonnull InitializeParams params) { ServerCapabilities capabilities = new ServerCapabilities(); capabilities.setTextDocumentSync(Full); capabilities.setCompletionProvider(new CompletionOptions(true, emptyList())); capabilities.setDefinitionProvider(TRUE); capabilities.setReferencesProvider(TRUE); capabilities.setDocumentFormattingProvider(TRUE); capabilities.setDocumentHighlightProvider(TRUE); capabilities.setCodeActionProvider(TRUE); capabilities.setExecuteCommandProvider(collectExecuteCommandList()); capabilities.setDocumentSymbolProvider(TRUE); WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions(); workspaceFoldersOptions.setSupported(TRUE); WorkspaceServerCapabilities workspaceServiceCapabilities = new WorkspaceServerCapabilities(workspaceFoldersOptions); capabilities.setWorkspace(workspaceServiceCapabilities); return supplyAsync(() -> new InitializeResult(capabilities)); }
MyLanguageServerImpl implements LanguageServer { @Override @Nonnull public CompletableFuture<InitializeResult> initialize(@Nonnull InitializeParams params) { ServerCapabilities capabilities = new ServerCapabilities(); capabilities.setTextDocumentSync(Full); capabilities.setCompletionProvider(new CompletionOptions(true, emptyList())); capabilities.setDefinitionProvider(TRUE); capabilities.setReferencesProvider(TRUE); capabilities.setDocumentFormattingProvider(TRUE); capabilities.setDocumentHighlightProvider(TRUE); capabilities.setCodeActionProvider(TRUE); capabilities.setExecuteCommandProvider(collectExecuteCommandList()); capabilities.setDocumentSymbolProvider(TRUE); WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions(); workspaceFoldersOptions.setSupported(TRUE); WorkspaceServerCapabilities workspaceServiceCapabilities = new WorkspaceServerCapabilities(workspaceFoldersOptions); capabilities.setWorkspace(workspaceServiceCapabilities); return supplyAsync(() -> new InitializeResult(capabilities)); } }
MyLanguageServerImpl implements LanguageServer { @Override @Nonnull public CompletableFuture<InitializeResult> initialize(@Nonnull InitializeParams params) { ServerCapabilities capabilities = new ServerCapabilities(); capabilities.setTextDocumentSync(Full); capabilities.setCompletionProvider(new CompletionOptions(true, emptyList())); capabilities.setDefinitionProvider(TRUE); capabilities.setReferencesProvider(TRUE); capabilities.setDocumentFormattingProvider(TRUE); capabilities.setDocumentHighlightProvider(TRUE); capabilities.setCodeActionProvider(TRUE); capabilities.setExecuteCommandProvider(collectExecuteCommandList()); capabilities.setDocumentSymbolProvider(TRUE); WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions(); workspaceFoldersOptions.setSupported(TRUE); WorkspaceServerCapabilities workspaceServiceCapabilities = new WorkspaceServerCapabilities(workspaceFoldersOptions); capabilities.setWorkspace(workspaceServiceCapabilities); return supplyAsync(() -> new InitializeResult(capabilities)); } @Inject  MyLanguageServerImpl(
      TextDocumentService textService,
      WorkspaceService workspaceService,
      WatcherService watchingService,
      SettingsService settingsService); }
MyLanguageServerImpl implements LanguageServer { @Override @Nonnull public CompletableFuture<InitializeResult> initialize(@Nonnull InitializeParams params) { ServerCapabilities capabilities = new ServerCapabilities(); capabilities.setTextDocumentSync(Full); capabilities.setCompletionProvider(new CompletionOptions(true, emptyList())); capabilities.setDefinitionProvider(TRUE); capabilities.setReferencesProvider(TRUE); capabilities.setDocumentFormattingProvider(TRUE); capabilities.setDocumentHighlightProvider(TRUE); capabilities.setCodeActionProvider(TRUE); capabilities.setExecuteCommandProvider(collectExecuteCommandList()); capabilities.setDocumentSymbolProvider(TRUE); WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions(); workspaceFoldersOptions.setSupported(TRUE); WorkspaceServerCapabilities workspaceServiceCapabilities = new WorkspaceServerCapabilities(workspaceFoldersOptions); capabilities.setWorkspace(workspaceServiceCapabilities); return supplyAsync(() -> new InitializeResult(capabilities)); } @Inject  MyLanguageServerImpl(
      TextDocumentService textService,
      WorkspaceService workspaceService,
      WatcherService watchingService,
      SettingsService settingsService); @Override TextDocumentService getTextDocumentService(); @Override WorkspaceService getWorkspaceService(); @Override @Nonnull CompletableFuture<InitializeResult> initialize(@Nonnull InitializeParams params); @Override void initialized(@Nullable InitializedParams params); @Override CompletableFuture<Object> shutdown(); @Override void exit(); }
MyLanguageServerImpl implements LanguageServer { @Override @Nonnull public CompletableFuture<InitializeResult> initialize(@Nonnull InitializeParams params) { ServerCapabilities capabilities = new ServerCapabilities(); capabilities.setTextDocumentSync(Full); capabilities.setCompletionProvider(new CompletionOptions(true, emptyList())); capabilities.setDefinitionProvider(TRUE); capabilities.setReferencesProvider(TRUE); capabilities.setDocumentFormattingProvider(TRUE); capabilities.setDocumentHighlightProvider(TRUE); capabilities.setCodeActionProvider(TRUE); capabilities.setExecuteCommandProvider(collectExecuteCommandList()); capabilities.setDocumentSymbolProvider(TRUE); WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions(); workspaceFoldersOptions.setSupported(TRUE); WorkspaceServerCapabilities workspaceServiceCapabilities = new WorkspaceServerCapabilities(workspaceFoldersOptions); capabilities.setWorkspace(workspaceServiceCapabilities); return supplyAsync(() -> new InitializeResult(capabilities)); } @Inject  MyLanguageServerImpl(
      TextDocumentService textService,
      WorkspaceService workspaceService,
      WatcherService watchingService,
      SettingsService settingsService); @Override TextDocumentService getTextDocumentService(); @Override WorkspaceService getWorkspaceService(); @Override @Nonnull CompletableFuture<InitializeResult> initialize(@Nonnull InitializeParams params); @Override void initialized(@Nullable InitializedParams params); @Override CompletableFuture<Object> shutdown(); @Override void exit();  }