org.eclipse.lsp4j.InitializeResult Java Examples
The following examples show how to use
org.eclipse.lsp4j.InitializeResult.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
private InitializeResult initialize(boolean dynamicRegistration) throws InterruptedException, ExecutionException { InitializeParams params = new InitializeParams(); ClientCapabilities capabilities = new ClientCapabilities(); WorkspaceClientCapabilities workspaceCapabilities = new WorkspaceClientCapabilities(); workspaceCapabilities.setDidChangeConfiguration(new DidChangeConfigurationCapabilities(dynamicRegistration)); ExecuteCommandCapabilities executeCommand = new ExecuteCommandCapabilities(dynamicRegistration); workspaceCapabilities.setExecuteCommand(executeCommand); capabilities.setWorkspace(workspaceCapabilities); TextDocumentClientCapabilities textDocument = new TextDocumentClientCapabilities(); SynchronizationCapabilities synchronizationCapabilities = new SynchronizationCapabilities(); synchronizationCapabilities.setWillSave(Boolean.TRUE); synchronizationCapabilities.setWillSaveWaitUntil(Boolean.TRUE); capabilities.setTextDocument(textDocument); params.setCapabilities(capabilities); CompletableFuture<InitializeResult> result = server.initialize(params); return result.get(); }
Example #2
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Test public void testRegisterDelayedCapability() throws Exception { ClientPreferences mockCapabilies = mock(ClientPreferences.class); when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies); when(mockCapabilies.isDocumentSymbolDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isWorkspaceSymbolDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isDocumentSymbolDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isCodeActionDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isDefinitionDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isHoverDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isReferencesDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isDocumentHighlightDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isFoldgingRangeDynamicRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isCompletionDynamicRegistered()).thenReturn(Boolean.TRUE); InitializeResult result = initialize(true); assertNull(result.getCapabilities().getDocumentSymbolProvider()); server.initialized(new InitializedParams()); verify(client, times(9)).registerCapability(any()); }
Example #3
Source File: XMLLanguageServer.java From lemminx with Eclipse Public License 2.0 | 6 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { LOGGER.info("Initializing XML Language server" + System.lineSeparator() + new ServerInfo().details()); this.parentProcessId = params.getProcessId(); // Update XML language service extensions with InitializeParams xmlLanguageService.initializeParams(params); ExtendedClientCapabilities extendedClientCapabilities = InitializationOptionsExtendedClientCapabilities .getExtendedClientCapabilities(params); capabilityManager.setClientCapabilities(params.getCapabilities(), extendedClientCapabilities); xmlTextDocumentService.updateClientCapabilities(capabilityManager.getClientCapabilities().capabilities, capabilityManager.getClientCapabilities().getExtendedCapabilities()); updateSettings(InitializationOptionsSettings.getSettings(params)); ServerCapabilities nonDynamicServerCapabilities = ServerCapabilitiesInitializer.getNonDynamicServerCapabilities( capabilityManager.getClientCapabilities(), xmlTextDocumentService.isIncrementalSupport()); return CompletableFuture.completedFuture(new InitializeResult(nonDynamicServerCapabilities)); }
Example #4
Source File: CamelLanguageServer.java From camel-language-server with Apache License 2.0 | 6 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { Integer processId = params.getProcessId(); if(processId != null) { setParentProcessId(processId.longValue()); } else { LOGGER.info("Missing Parent process ID!!"); setParentProcessId(0); } new SettingsManager(getTextDocumentService()).apply(params); ServerCapabilities capabilities = createServerCapabilities(); InitializeResult result = new InitializeResult(capabilities); return CompletableFuture.completedFuture(result); }
Example #5
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Test public void testStaticCommandWithoutDynamicRegistration() throws Exception { when(commandHandler.getAllCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd1", "cmd2", "cmd3", "cmd4"))); when(commandHandler.getStaticCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd1", "cmd2"))); when(commandHandler.getNonStaticCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd3", "cmd4"))); ClientPreferences mockCapabilies = mock(ClientPreferences.class); when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.FALSE); when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies); InitializeResult result = initialize(true); ExecuteCommandOptions commandProvider = result.getCapabilities().getExecuteCommandProvider(); assertNotNull(commandProvider); assertTrue(commandProvider.getCommands().containsAll(Arrays.asList("cmd1", "cmd2", "cmd3", "cmd4"))); }
Example #6
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Test public void testStaticCommandWithDynamicRegistration() throws Exception { when(commandHandler.getAllCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd1", "cmd2", "cmd3", "cmd4"))); when(commandHandler.getStaticCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd1", "cmd2"))); when(commandHandler.getNonStaticCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd3", "cmd4"))); ClientPreferences mockCapabilies = mock(ClientPreferences.class); when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.TRUE); when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies); InitializeResult result = initialize(true); ExecuteCommandOptions commandProvider = result.getCapabilities().getExecuteCommandProvider(); assertNotNull(commandProvider); assertTrue(commandProvider.getCommands().contains("cmd1")); assertTrue(commandProvider.getCommands().contains("cmd2")); assertFalse(commandProvider.getCommands().contains("cmd3")); assertFalse(commandProvider.getCommands().contains("cmd4")); }
Example #7
Source File: HTMLLanguageServer.java From wildwebdeveloper with Eclipse Public License 2.0 | 6 votes |
@Override public void handleMessage(Message message, LanguageServer languageServer, URI rootUri) { if (message instanceof ResponseMessage) { ResponseMessage responseMessage = (ResponseMessage) message; if (responseMessage.getResult() instanceof InitializeResult) { Map<String, Object> htmlOptions = new HashMap<>(); Map<String, Object> validateOptions = new HashMap<>(); validateOptions.put("scripts", true); validateOptions.put("styles", true); htmlOptions.put("validate", validateOptions); htmlOptions.put("format", Collections.singletonMap("enable", Boolean.TRUE)); Map<String, Object> html = new HashMap<>(); html.put("html", htmlOptions); DidChangeConfigurationParams params = new DidChangeConfigurationParams(html); languageServer.getWorkspaceService().didChangeConfiguration(params); } } }
Example #8
Source File: XLanguageServerImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { if (initializeParams != null) { throw new IllegalStateException("This language server has already been initialized."); } URI baseDir = getBaseDir(params); if (languagesRegistry.getExtensionToFactoryMap().isEmpty()) { throw new IllegalStateException( "No Xtext languages have been registered. Please make sure you have added the languages\'s setup class in \'/META-INF/services/org.eclipse.xtext.ISetup\'"); } this.initializeParams = params; openFilesManager.setIssueRegistry(issueRegistry); openFilesManager.addListener(this); lspBuilder.getIndexRaw().addListener(this); Stopwatch sw = Stopwatch.createStarted(); LOG.info("Start server initialization in workspace directory " + baseDir); lspBuilder.initialize(baseDir, issueRegistry); LOG.info("Server initialization done after " + sw); initializeResult = new InitializeResult(); initializeResult.setCapabilities(createServerCapabilities(params)); return CompletableFuture.completedFuture(initializeResult); }
Example #9
Source File: RenameService2.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
private boolean shouldPrepareRename(ILanguageServerAccess access) { Either<Boolean, RenameOptions> provider = null; if (access != null) { InitializeResult initializeResult = access.getInitializeResult(); if (initializeResult != null) { ServerCapabilities capabilities = initializeResult.getCapabilities(); if (capabilities != null) { provider = capabilities.getRenameProvider(); } } } if (provider != null && provider.isRight()) { return Boolean.TRUE.equals(provider.getRight().getPrepareProvider()); } else { return false; } }
Example #10
Source File: MessageHandler.java From lsp4intellij with Apache License 2.0 | 5 votes |
private void handleMessage(Message message) { if (message instanceof ResponseMessage) { ResponseMessage responseMessage = (ResponseMessage) message; if (responseMessage.getResult() instanceof InitializeResult) { listener.initialize(languageServer, (InitializeResult) responseMessage.getResult()); } } }
Example #11
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Test public void testWillSaveAndWillSaveWaitUntilCapabilities() throws Exception { ClientPreferences mockCapabilies = mock(ClientPreferences.class); when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.TRUE); when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies); when(mockCapabilies.isWillSaveRegistered()).thenReturn(Boolean.TRUE); when(mockCapabilies.isWillSaveWaitUntilRegistered()).thenReturn(Boolean.TRUE); InitializeResult result = initialize(true); Either<TextDocumentSyncKind, TextDocumentSyncOptions> o = result.getCapabilities().getTextDocumentSync(); assertTrue(o.isRight()); assertTrue(o.getRight().getWillSave()); assertTrue(o.getRight().getWillSaveWaitUntil()); }
Example #12
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Test public void testExecuteCommandProviderDynamicRegistration() throws Exception { ClientPreferences mockCapabilies = mock(ClientPreferences.class); when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.TRUE); when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies); InitializeResult result = initialize(true); assertNull(result.getCapabilities().getExecuteCommandProvider()); }
Example #13
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Test public void testExecuteCommandProvider() throws Exception { when(commandHandler.getNonStaticCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd3", "cmd4"))); when(commandHandler.getAllCommands()).thenReturn(new HashSet<>(Arrays.asList("cmd3", "cmd4"))); ClientPreferences mockCapabilies = mock(ClientPreferences.class); when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.FALSE); when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies); InitializeResult result = initialize(false); List<String> commands = result.getCapabilities().getExecuteCommandProvider().getCommands(); assertFalse(commands.isEmpty()); }
Example #14
Source File: SyntaxInitHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public void registerCapabilities(InitializeResult initializeResult) { ServerCapabilities capabilities = new ServerCapabilities(); if (!preferenceManager.getClientPreferences().isClientDocumentSymbolProviderRegistered() && !preferenceManager.getClientPreferences().isDocumentSymbolDynamicRegistered()) { capabilities.setDocumentSymbolProvider(Boolean.TRUE); } if (!preferenceManager.getClientPreferences().isDefinitionDynamicRegistered()) { capabilities.setDefinitionProvider(Boolean.TRUE); } if (!preferenceManager.getClientPreferences().isTypeDefinitionDynamicRegistered()) { capabilities.setTypeDefinitionProvider(Boolean.TRUE); } if (!preferenceManager.getClientPreferences().isFoldgingRangeDynamicRegistered()) { capabilities.setFoldingRangeProvider(Boolean.TRUE); } if (!preferenceManager.getClientPreferences().isSelectionRangeDynamicRegistered()) { capabilities.setSelectionRangeProvider(Boolean.TRUE); } if (!preferenceManager.getClientPreferences().isHoverDynamicRegistered()) { capabilities.setHoverProvider(Boolean.TRUE); } if (!preferenceManager.getClientPreferences().isCompletionDynamicRegistered()) { capabilities.setCompletionProvider(CompletionHandler.DEFAULT_COMPLETION_OPTIONS); } TextDocumentSyncOptions textDocumentSyncOptions = new TextDocumentSyncOptions(); textDocumentSyncOptions.setOpenClose(Boolean.TRUE); textDocumentSyncOptions.setSave(new SaveOptions(Boolean.TRUE)); textDocumentSyncOptions.setChange(TextDocumentSyncKind.Incremental); capabilities.setTextDocumentSync(textDocumentSyncOptions); WorkspaceServerCapabilities wsCapabilities = new WorkspaceServerCapabilities(); WorkspaceFoldersOptions wsFoldersOptions = new WorkspaceFoldersOptions(); wsFoldersOptions.setSupported(Boolean.TRUE); wsFoldersOptions.setChangeNotifications(Boolean.TRUE); wsCapabilities.setWorkspaceFolders(wsFoldersOptions); capabilities.setWorkspace(wsCapabilities); initializeResult.setCapabilities(capabilities); }
Example #15
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { if (initializeParams != null) { throw new IllegalStateException("This language server has already been initialized."); } URI baseDir = getBaseDir(params); if (languagesRegistry.getExtensionToFactoryMap().isEmpty()) { throw new IllegalStateException( "No Xtext languages have been registered. Please make sure you have added the languages\'s setup class in \'/META-INF/services/org.eclipse.xtext.ISetup\'"); } initializeParams = params; InitializeResult result = new InitializeResult(); result.setCapabilities(createServerCapabilities(params)); access.addBuildListener(this); return requestManager.runWrite(() -> { if (workspaceManager.isSupportsWorkspaceFolders()) { List<WorkspaceFolder> workspaceFolders = params.getWorkspaceFolders(); if (workspaceFolders == null) workspaceFolders = Collections.emptyList(); workspaceManager.initialize(workspaceFolders, this::publishDiagnostics, CancelIndicator.NullImpl); } else { workspaceManager.initialize(baseDir, this::publishDiagnostics, CancelIndicator.NullImpl); } return result; }, (cancelIndicator, it) -> it).thenApply(it -> initializeResult = it); }
Example #16
Source File: BaseInitHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public InitializeResult initialize(InitializeParams param) { logInfo("Initializing Java Language Server " + JavaLanguageServerPlugin.getVersion()); InitializeResult result = new InitializeResult(); handleInitializationOptions(param); registerCapabilities(result); // At the end of the InitHandler, trigger a job to import the workspace. This is used to ensure ServiceStatus notification // is not sent before the initialize response. See the bug https://github.com/redhat-developer/vscode-java/issues/1056 triggerInitialization(preferenceManager.getPreferences().getRootPaths()); return result; }
Example #17
Source File: LSPBindings.java From netbeans with Apache License 2.0 | 5 votes |
private static InitializeResult initServer(Process p, LanguageServer server, FileObject root) throws InterruptedException, ExecutionException { InitializeParams initParams = new InitializeParams(); initParams.setRootUri(Utils.toURI(root)); initParams.setRootPath(FileUtil.toFile(root).getAbsolutePath()); //some servers still expect root path initParams.setProcessId(0); TextDocumentClientCapabilities tdcc = new TextDocumentClientCapabilities(); DocumentSymbolCapabilities dsc = new DocumentSymbolCapabilities(); dsc.setHierarchicalDocumentSymbolSupport(true); dsc.setSymbolKind(new SymbolKindCapabilities(Arrays.asList(SymbolKind.values()))); tdcc.setDocumentSymbol(dsc); WorkspaceClientCapabilities wcc = new WorkspaceClientCapabilities(); wcc.setWorkspaceEdit(new WorkspaceEditCapabilities()); wcc.getWorkspaceEdit().setDocumentChanges(true); wcc.getWorkspaceEdit().setResourceOperations(Arrays.asList(ResourceOperationKind.Create, ResourceOperationKind.Delete, ResourceOperationKind.Rename)); initParams.setCapabilities(new ClientCapabilities(wcc, tdcc, null)); CompletableFuture<InitializeResult> initResult = server.initialize(initParams); while (true) { try { return initResult.get(100, TimeUnit.MILLISECONDS); } catch (TimeoutException ex) { if (p != null && !p.isAlive()) { InitializeResult emptyResult = new InitializeResult(); emptyResult.setCapabilities(new ServerCapabilities()); return emptyResult; } } } }
Example #18
Source File: LSPBindings.java From netbeans with Apache License 2.0 | 5 votes |
@Messages("LBL_Connecting=Connecting to language server") public static void addBindings(FileObject root, int port, String... extensions) { BaseProgressUtils.showProgressDialogAndRun(() -> { try { Socket s = new Socket(InetAddress.getLocalHost(), port); LanguageClientImpl lc = new LanguageClientImpl(); InputStream in = s.getInputStream(); OutputStream out = s.getOutputStream(); Launcher<LanguageServer> launcher = LSPLauncher.createClientLauncher(lc, in, new OutputStream() { @Override public void write(int w) throws IOException { out.write(w); if (w == '\n') out.flush(); } }); launcher.startListening(); LanguageServer server = launcher.getRemoteProxy(); InitializeResult result = initServer(null, server, root); LSPBindings bindings = new LSPBindings(server, result, null); lc.setBindings(bindings); workspace2Extension2Server.put(root, Arrays.stream(extensions).collect(Collectors.toMap(k -> k, v -> bindings))); } catch (InterruptedException | ExecutionException | IOException ex) { Exceptions.printStackTrace(ex); } }, Bundle.LBL_Connecting()); }
Example #19
Source File: CompletionProviderImpl.java From netbeans with Apache License 2.0 | 5 votes |
private boolean isTriggerCharacter(LSPBindings server, String text) { InitializeResult init = server.getInitResult(); if (init == null) return false; ServerCapabilities capabilities = init.getCapabilities(); if (capabilities == null) return false; CompletionOptions completionOptions = capabilities.getCompletionProvider(); if (completionOptions == null) return false; List<String> triggerCharacters = completionOptions.getTriggerCharacters(); if (triggerCharacters == null) return false; return triggerCharacters.stream().anyMatch(trigger -> text.endsWith(trigger)); }
Example #20
Source File: JSonLanguageServer.java From wildwebdeveloper with Eclipse Public License 2.0 | 5 votes |
@Override public void handleMessage(Message message, LanguageServer languageServer, URI rootUri) { if (message instanceof ResponseMessage) { ResponseMessage responseMessage = (ResponseMessage) message; if (responseMessage.getResult() instanceof InitializeResult) { // Send json/schemaAssociations notification to register JSON Schema on JSON // Language server side. JSonLanguageServerInterface server = (JSonLanguageServerInterface) languageServer; Map<String, List<String>> schemaAssociations = getSchemaAssociations(); server.sendJSonchemaAssociations(schemaAssociations); } } }
Example #21
Source File: CSSLanguageServer.java From wildwebdeveloper with Eclipse Public License 2.0 | 5 votes |
@Override public void handleMessage(Message message, LanguageServer languageServer, URI rootUri) { if (message instanceof ResponseMessage) { ResponseMessage responseMessage = (ResponseMessage)message; if (responseMessage.getResult() instanceof InitializeResult) { // enable validation: so far, no better way found than changing conf after init. DidChangeConfigurationParams params = new DidChangeConfigurationParams(getInitializationOptions(rootUri)); languageServer.getWorkspaceService().didChangeConfiguration(params); } } }
Example #22
Source File: RdfLintLanguageServer.java From rdflint with MIT License | 5 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { // initialize rdflint String rootPath = convertUri2FilePath(params.getRootUri()); String configPath = ConfigurationLoader.searchConfigPath(rootPath); try { rdflintParams = ConfigurationLoader.loadConfig(configPath); rdflintParams.setTargetDir(rootPath); rdflintParams.setOutputDir(rootPath); if (rdflintParams.getSuppressPath() == null) { rdflintParams.setSuppressPath(ConfigurationLoader.searchSuppressPath(rootPath)); } } catch (IOException ex) { showException("Error cannot initialize rdflint", ex); } validators = new LinkedList<>(); validators.add(new TrimValidator()); validators.add(new UndefinedSubjectValidator()); validators.add(new ShaclValidator()); validators.forEach(v -> v.setParameters(rdflintParams) ); refreshFileTripleSet(); ServerCapabilities capabilities = new ServerCapabilities(); capabilities.setTextDocumentSync(TextDocumentSyncKind.Full); InitializeResult result = new InitializeResult(capabilities); return CompletableFuture.completedFuture(result); }
Example #23
Source File: AbstractCamelLanguageServerTest.java From camel-language-server with Apache License 2.0 | 5 votes |
private void initializeLanguageServer(InitializeParams params) throws ExecutionException, InterruptedException { camelLanguageServer = new CamelLanguageServer(); camelLanguageServer.connect(new DummyLanguageClient()); camelLanguageServer.startServer(); CompletableFuture<InitializeResult> initialize = camelLanguageServer.initialize(params); assertThat(initialize).isCompleted(); assertThat(initialize.get().getCapabilities().getCompletionProvider().getResolveProvider()).isTrue(); }
Example #24
Source File: GroovyLanguageServer.java From groovy-language-server with Apache License 2.0 | 5 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { String rootUriString = params.getRootUri(); if (rootUriString != null) { URI uri = URI.create(params.getRootUri()); Path workspaceRoot = Paths.get(uri); groovyServices.setWorkspaceRoot(workspaceRoot); } CompletionOptions completionOptions = new CompletionOptions(false, Arrays.asList(".")); ServerCapabilities serverCapabilities = new ServerCapabilities(); serverCapabilities.setCompletionProvider(completionOptions); serverCapabilities.setTextDocumentSync(TextDocumentSyncKind.Full); serverCapabilities.setDocumentSymbolProvider(true); serverCapabilities.setWorkspaceSymbolProvider(true); serverCapabilities.setDocumentSymbolProvider(true); serverCapabilities.setReferencesProvider(true); serverCapabilities.setDefinitionProvider(true); serverCapabilities.setTypeDefinitionProvider(true); serverCapabilities.setHoverProvider(true); serverCapabilities.setRenameProvider(true); SignatureHelpOptions signatureHelpOptions = new SignatureHelpOptions(); signatureHelpOptions.setTriggerCharacters(Arrays.asList("(", ",")); serverCapabilities.setSignatureHelpProvider(signatureHelpOptions); InitializeResult initializeResult = new InitializeResult(serverCapabilities); return CompletableFuture.completedFuture(initializeResult); }
Example #25
Source File: MockLanguageServer.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { throw new UnsupportedOperationException(); }
Example #26
Source File: LanguageServerImpl.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
@Override public InitializeResult getInitializeResult() { return initializeResult; }
Example #27
Source File: NullResponseTest.java From lsp4j with Eclipse Public License 2.0 | 4 votes |
@Override public CompletableFuture<InitializeResult> initialize(InitializeParams params) { throw new UnsupportedOperationException(); }
Example #28
Source File: AbstractLanguageServerTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected InitializeResult initialize(final Procedure1<? super InitializeParams> initializer, final boolean callInitialized) { try { InitializeParams _initializeParams = new InitializeParams(); final Procedure1<InitializeParams> _function = (InitializeParams it) -> { it.setProcessId(Integer.valueOf(1)); it.setRootUri(this._uriExtensions.toUriString(this.root.toURI().normalize())); String _rootUri = it.getRootUri(); WorkspaceFolder _workspaceFolder = new WorkspaceFolder(_rootUri, ""); it.setWorkspaceFolders(Collections.<WorkspaceFolder>unmodifiableList(CollectionLiterals.<WorkspaceFolder>newArrayList(_workspaceFolder))); }; final InitializeParams params = ObjectExtensions.<InitializeParams>operator_doubleArrow(_initializeParams, _function); if (initializer!=null) { initializer.apply(params); } Boolean _elvis = null; ClientCapabilities _capabilities = params.getCapabilities(); TextDocumentClientCapabilities _textDocument = null; if (_capabilities!=null) { _textDocument=_capabilities.getTextDocument(); } DocumentSymbolCapabilities _documentSymbol = null; if (_textDocument!=null) { _documentSymbol=_textDocument.getDocumentSymbol(); } Boolean _hierarchicalDocumentSymbolSupport = null; if (_documentSymbol!=null) { _hierarchicalDocumentSymbolSupport=_documentSymbol.getHierarchicalDocumentSymbolSupport(); } if (_hierarchicalDocumentSymbolSupport != null) { _elvis = _hierarchicalDocumentSymbolSupport; } else { _elvis = Boolean.valueOf(false); } this.hierarchicalDocumentSymbolSupport = (_elvis).booleanValue(); final InitializeResult result = this.languageServer.initialize(params).get(); if (callInitialized) { this.languageServer.initialized(null); } return result; } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example #29
Source File: AbstractLanguageServerTest.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected InitializeResult initialize(final Procedure1<? super InitializeParams> initializer) { return this.initialize(initializer, true); }
Example #30
Source File: ServerListener.java From lsp4intellij with Apache License 2.0 | 4 votes |
default void initialize(@NotNull LanguageServer server, @NotNull InitializeResult result) { }