org.eclipse.lsp4j.TextDocumentClientCapabilities Java Examples

The following examples show how to use org.eclipse.lsp4j.TextDocumentClientCapabilities. 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: XLanguageServerImpl.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * {@code true} if the {@code TextDocumentClientCapabilities} explicitly declares the hierarchical document symbol
 * support at LS initialization time. Otherwise, false.
 */
protected boolean isHierarchicalDocumentSymbolSupport() {
	ClientCapabilities capabilities = initializeParams.getCapabilities();
	if (capabilities != null) {
		TextDocumentClientCapabilities textDocument = capabilities.getTextDocument();
		if (textDocument != null) {
			DocumentSymbolCapabilities documentSymbol = textDocument.getDocumentSymbol();
			if (documentSymbol != null) {
				Boolean hierarchicalDocumentSymbolSupport = documentSymbol.getHierarchicalDocumentSymbolSupport();
				if (hierarchicalDocumentSymbolSupport != null) {
					return hierarchicalDocumentSymbolSupport;
				}
			}
		}
	}
	return false;
}
 
Example #2
Source File: InitHandlerTest.java    From eclipse.jdt.ls with Eclipse Public License 2.0 6 votes vote down vote up
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 #3
Source File: ActionScriptServices.java    From vscode-as3mxml with Apache License 2.0 6 votes vote down vote up
public void setClientCapabilities(ClientCapabilities value)
{
    completionSupportsSnippets = false;

    clientCapabilities = value;
    TextDocumentClientCapabilities textDocument = clientCapabilities.getTextDocument();
    if(textDocument != null)
    {
        CompletionCapabilities completion = textDocument.getCompletion();
        if(completion != null)
        {
            CompletionItemCapabilities completionItem = completion.getCompletionItem();
            if(completionItem != null)
            {
                completionSupportsSnippets = completionItem.getSnippetSupport();
            }
        }
    }
}
 
Example #4
Source File: LanguageServerImpl.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * {@code true} if the {@code TextDocumentClientCapabilities} explicitly declares the hierarchical document symbol
 * support at LS initialization time. Otherwise, false.
 */
protected boolean isHierarchicalDocumentSymbolSupport() {
	ClientCapabilities capabilities = initializeParams.getCapabilities();
	if (capabilities == null) {
		return false;
	}
	TextDocumentClientCapabilities textDocument = capabilities.getTextDocument();
	if (textDocument == null) {
		return false;
	}
	DocumentSymbolCapabilities documentSymbol = textDocument.getDocumentSymbol();
	if (documentSymbol == null) {
		return false;
	}
	Boolean hierarchicalDocumentSymbolSupport = documentSymbol.getHierarchicalDocumentSymbolSupport();
	if (hierarchicalDocumentSymbolSupport == null) {
		return false;
	}
	return hierarchicalDocumentSymbolSupport;
}
 
Example #5
Source File: LanguageServerWrapper.java    From lsp4intellij with Apache License 2.0 5 votes vote down vote up
private InitializeParams getInitParams() {
    InitializeParams initParams = new InitializeParams();
    initParams.setRootUri(FileUtils.pathToUri(projectRootPath));
    //TODO update capabilities when implemented
    WorkspaceClientCapabilities workspaceClientCapabilities = new WorkspaceClientCapabilities();
    workspaceClientCapabilities.setApplyEdit(true);
    workspaceClientCapabilities.setDidChangeWatchedFiles(new DidChangeWatchedFilesCapabilities());
    workspaceClientCapabilities.setExecuteCommand(new ExecuteCommandCapabilities());
    workspaceClientCapabilities.setWorkspaceEdit(new WorkspaceEditCapabilities());
    workspaceClientCapabilities.setSymbol(new SymbolCapabilities());
    workspaceClientCapabilities.setWorkspaceFolders(false);
    workspaceClientCapabilities.setConfiguration(false);

    TextDocumentClientCapabilities textDocumentClientCapabilities = new TextDocumentClientCapabilities();
    textDocumentClientCapabilities.setCodeAction(new CodeActionCapabilities());
    textDocumentClientCapabilities.setCompletion(new CompletionCapabilities(new CompletionItemCapabilities(true)));
    textDocumentClientCapabilities.setDefinition(new DefinitionCapabilities());
    textDocumentClientCapabilities.setDocumentHighlight(new DocumentHighlightCapabilities());
    textDocumentClientCapabilities.setFormatting(new FormattingCapabilities());
    textDocumentClientCapabilities.setHover(new HoverCapabilities());
    textDocumentClientCapabilities.setOnTypeFormatting(new OnTypeFormattingCapabilities());
    textDocumentClientCapabilities.setRangeFormatting(new RangeFormattingCapabilities());
    textDocumentClientCapabilities.setReferences(new ReferencesCapabilities());
    textDocumentClientCapabilities.setRename(new RenameCapabilities());
    textDocumentClientCapabilities.setSemanticHighlightingCapabilities(new SemanticHighlightingCapabilities(false));
    textDocumentClientCapabilities.setSignatureHelp(new SignatureHelpCapabilities());
    textDocumentClientCapabilities.setSynchronization(new SynchronizationCapabilities(true, true, true));
    initParams.setCapabilities(
            new ClientCapabilities(workspaceClientCapabilities, textDocumentClientCapabilities, null));
    initParams.setInitializationOptions(
            serverDefinition.getInitializationOptions(URI.create(initParams.getRootUri())));

    return initParams;
}
 
Example #6
Source File: XMLTextDocumentService.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
public void updateClientCapabilities(ClientCapabilities capabilities,
		ExtendedClientCapabilities extendedClientCapabilities) {
	TextDocumentClientCapabilities textDocumentClientCapabilities = capabilities.getTextDocument();
	if (textDocumentClientCapabilities != null) {
		sharedSettings.getCompletionSettings().setCapabilities(textDocumentClientCapabilities.getCompletion());
		sharedSettings.getFoldingSettings().setCapabilities(textDocumentClientCapabilities.getFoldingRange());
		sharedSettings.getHoverSettings().setCapabilities(textDocumentClientCapabilities.getHover());
		codeActionLiteralSupport = textDocumentClientCapabilities.getCodeAction() != null
				&& textDocumentClientCapabilities.getCodeAction().getCodeActionLiteralSupport() != null;
		hierarchicalDocumentSymbolSupport = textDocumentClientCapabilities.getDocumentSymbol() != null
				&& textDocumentClientCapabilities.getDocumentSymbol().getHierarchicalDocumentSymbolSupport() != null
				&& textDocumentClientCapabilities.getDocumentSymbol().getHierarchicalDocumentSymbolSupport();
		definitionLinkSupport = textDocumentClientCapabilities.getDefinition() != null
				&& textDocumentClientCapabilities.getDefinition().getLinkSupport() != null
				&& textDocumentClientCapabilities.getDefinition().getLinkSupport();
		typeDefinitionLinkSupport = textDocumentClientCapabilities.getTypeDefinition() != null
				&& textDocumentClientCapabilities.getTypeDefinition().getLinkSupport() != null
				&& textDocumentClientCapabilities.getTypeDefinition().getLinkSupport();
	}
	if (extendedClientCapabilities != null) {
		// Extended client capabilities
		sharedSettings.getCodeLensSettings().setCodeLens(extendedClientCapabilities.getCodeLens());
		sharedSettings
				.setActionableNotificationSupport(extendedClientCapabilities.isActionableNotificationSupport());
		sharedSettings.setOpenSettingsCommandSupport(extendedClientCapabilities.isOpenSettingsCommandSupport());
	}
	// Workspace settings
	sharedSettings.getWorkspaceSettings().setCapabilities(capabilities.getWorkspace());
}
 
Example #7
Source File: XMLCapabilitiesTest.java    From lemminx with Eclipse Public License 2.0 5 votes vote down vote up
@BeforeEach
public void startup() {

	textDocumentService = new XMLTextDocumentService(null);
	textDocumentService.getSharedSettings().getFormattingSettings().setEnabled(true);

	textDocument = new TextDocumentClientCapabilities();
	workspace = new WorkspaceClientCapabilities();
	manager = new XMLCapabilityManager(languageClient, textDocumentService);
	clientCapabilities = new ClientCapabilities();
	capabilityIDs = null;

}
 
Example #8
Source File: LSPBindings.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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 #9
Source File: ClientCapabilitiesWrapper.java    From lemminx with Eclipse Public License 2.0 4 votes vote down vote up
public TextDocumentClientCapabilities getTextDocument() {
	return this.capabilities.getTextDocument();
}
 
Example #10
Source File: XLanguageServerImpl.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Configure the server capabilities for this instance.
 *
 * @param params
 *            the initialization parameters
 * @return the server capabilities
 */
protected ServerCapabilities createServerCapabilities(InitializeParams params) {
	ServerCapabilities serverCapabilities = new ServerCapabilities();
	serverCapabilities.setHoverProvider(true);
	serverCapabilities.setDefinitionProvider(true);
	serverCapabilities.setReferencesProvider(true);
	serverCapabilities.setDocumentSymbolProvider(true);
	serverCapabilities.setWorkspaceSymbolProvider(true);
	Set<? extends IResourceServiceProvider> allLanguages = getAllLanguages();
	if (allLanguages.stream().anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensService.class) != null)) {
		CodeLensOptions codeLensOptions = new CodeLensOptions();
		codeLensOptions.setResolveProvider(allLanguages.stream()
				.anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensResolver.class) != null));
		serverCapabilities.setCodeLensProvider(codeLensOptions);
	}
	boolean supportsCodeActions = allLanguages.stream()
			.anyMatch((serviceProvider) -> serviceProvider.get(ICodeActionService.class) != null
					|| serviceProvider.get(ICodeActionService2.class) != null);
	if (supportsCodeActions) {
		Optional<List<String>> supportedKinds = getSupportedCodeActionKinds();
		if (supportedKinds.isPresent()) {
			serverCapabilities.setCodeActionProvider(new CodeActionOptions(supportedKinds.get()));
		} else {
			serverCapabilities.setCodeActionProvider(true);
		}
	} else {
		serverCapabilities.setCodeActionProvider(false);
	}

	serverCapabilities.setSignatureHelpProvider(new SignatureHelpOptions(ImmutableList.of("(", ",")));
	serverCapabilities.setTextDocumentSync(TextDocumentSyncKind.Incremental);
	CompletionOptions completionOptions = new CompletionOptions();
	completionOptions.setResolveProvider(false);
	completionOptions.setTriggerCharacters(ImmutableList.of("."));
	serverCapabilities.setCompletionProvider(completionOptions);
	serverCapabilities.setDocumentFormattingProvider(true);
	serverCapabilities.setDocumentRangeFormattingProvider(true);
	serverCapabilities.setDocumentHighlightProvider(true);
	ClientCapabilities clientCapabilities = null;
	if (params != null) {
		clientCapabilities = params.getCapabilities();
	}
	TextDocumentClientCapabilities textDocument = null;
	if (clientCapabilities != null) {
		textDocument = clientCapabilities.getTextDocument();
	}
	RenameCapabilities rename = null;
	if (textDocument != null) {
		rename = textDocument.getRename();
	}
	Boolean prepareSupport = null;
	if (rename != null) {
		prepareSupport = rename.getPrepareSupport();
	}
	boolean clientPrepareSupport = Objects.equal(Boolean.TRUE, prepareSupport);
	if (clientPrepareSupport && allLanguages.stream()
			.anyMatch(serviceProvider -> serviceProvider.get(IRenameService2.class) != null)) {
		RenameOptions renameOptions = new RenameOptions();
		renameOptions.setPrepareProvider(true);
		serverCapabilities.setRenameProvider(Either.<Boolean, RenameOptions> forRight(renameOptions));
	} else {
		serverCapabilities.setRenameProvider(Either.forLeft(allLanguages.stream()
				.anyMatch((serviceProvider) -> serviceProvider.get(IRenameService.class) != null
						|| serviceProvider.get(IRenameService2.class) != null)));
	}
	WorkspaceClientCapabilities workspace = null;
	if (clientCapabilities != null) {
		workspace = clientCapabilities.getWorkspace();
	}
	ExecuteCommandCapabilities executeCommand = null;
	if (workspace != null) {
		executeCommand = workspace.getExecuteCommand();
	}
	if (executeCommand != null) {
		commandRegistry.initialize(allLanguages, clientCapabilities, client);
		ExecuteCommandOptions executeCommandOptions = new ExecuteCommandOptions();
		executeCommandOptions.setCommands(commandRegistry.getCommands());
		serverCapabilities.setExecuteCommandProvider(executeCommandOptions);
	}
	semanticHighlightingRegistry.initialize(allLanguages, clientCapabilities, client);
	serverCapabilities.setSemanticHighlighting(new SemanticHighlightingServerCapabilities(
			semanticHighlightingRegistry.getAllScopes()));

	for (IResourceServiceProvider language : allLanguages) {
		ICapabilitiesContributor capabilitiesContributor = language.get(ICapabilitiesContributor.class);
		if (capabilitiesContributor != null) {
			capabilitiesContributor.contribute(serverCapabilities, params);
		}
	}
	return serverCapabilities;
}
 
Example #11
Source File: DefaultLanguageServerWrapper.java    From MSPaintIDE with MIT License 4 votes vote down vote up
@Override
    public InitializeParams getInitParams() {
        InitializeParams initParams = new InitializeParams();
        if (this.rootPath != null) {
            var root = rootPath.toURI().toString();
            if (this.useInputForWorkspace) {
                root = rootPath.toPath().relativize(inputFile.toPath()).toUri().toString();
            }

            initParams.setRootUri(root);
            LOGGER.info("Workspace root is {}", root);
        }
        WorkspaceClientCapabilities workspaceClientCapabilities = new WorkspaceClientCapabilities();
        workspaceClientCapabilities.setApplyEdit(true);
        workspaceClientCapabilities.setDidChangeWatchedFiles(new DidChangeWatchedFilesCapabilities());
        workspaceClientCapabilities.setExecuteCommand(new ExecuteCommandCapabilities());
        workspaceClientCapabilities.setWorkspaceEdit(new WorkspaceEditCapabilities());
//        workspaceClientCapabilities.setSymbol(new SymbolCapabilities());
        workspaceClientCapabilities.setWorkspaceFolders(true);
        workspaceClientCapabilities.setConfiguration(true);

        TextDocumentClientCapabilities textDocumentClientCapabilities = new TextDocumentClientCapabilities();
        textDocumentClientCapabilities.setCodeAction(new CodeActionCapabilities());
        textDocumentClientCapabilities.setCompletion(new CompletionCapabilities(new CompletionItemCapabilities(false)));
        textDocumentClientCapabilities.setDefinition(new DefinitionCapabilities());
//        textDocumentClientCapabilities.setDocumentHighlight(new DocumentHighlightCapabilities());
        textDocumentClientCapabilities.setFormatting(new FormattingCapabilities());
//        textDocumentClientCapabilities.setHover(new HoverCapabilities());
//        textDocumentClientCapabilities.setOnTypeFormatting(new OnTypeFormattingCapabilities());
//        textDocumentClientCapabilities.setRangeFormatting(new RangeFormattingCapabilities());
        textDocumentClientCapabilities.setReferences(new ReferencesCapabilities());
        textDocumentClientCapabilities.setRename(new RenameCapabilities());
        textDocumentClientCapabilities.setSemanticHighlightingCapabilities(new SemanticHighlightingCapabilities(false));
        textDocumentClientCapabilities.setSignatureHelp(new SignatureHelpCapabilities());
        textDocumentClientCapabilities.setSynchronization(new SynchronizationCapabilities(true, true, true));
        initParams.setCapabilities(
                new ClientCapabilities(workspaceClientCapabilities, textDocumentClientCapabilities, null));
//        initParams.setInitializationOptions(null);
//        initParams.setInitializationOptions(
//                serverDefinition.getInitializationOptions(URI.create(initParams.getRootUri())));

        return initParams;
    }
 
Example #12
Source File: AbstractLanguageServerTest.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
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 #13
Source File: LanguageServerImpl.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Configure the server capabilities for this instance.
 *
 * @param params
 *            the initialization parametrs
 * @return the server capabilities
 * @since 2.20
 */
protected ServerCapabilities createServerCapabilities(InitializeParams params) {
	ServerCapabilities serverCapabilities = new ServerCapabilities();
	serverCapabilities.setHoverProvider(true);
	serverCapabilities.setDefinitionProvider(true);
	serverCapabilities.setReferencesProvider(true);
	serverCapabilities.setDocumentSymbolProvider(true);
	serverCapabilities.setWorkspaceSymbolProvider(true);
	Set<? extends IResourceServiceProvider> allLanguages = getAllLanguages();
	if (allLanguages.stream().anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensService.class) != null)) {
		CodeLensOptions codeLensOptions = new CodeLensOptions();
		codeLensOptions.setResolveProvider(allLanguages.stream()
				.anyMatch((serviceProvider) -> serviceProvider.get(ICodeLensResolver.class) != null));
		serverCapabilities.setCodeLensProvider(codeLensOptions);
	}
	serverCapabilities.setCodeActionProvider(allLanguages.stream()
			.anyMatch((serviceProvider) -> serviceProvider.get(ICodeActionService2.class) != null));

	serverCapabilities.setSignatureHelpProvider(new SignatureHelpOptions(ImmutableList.of("(", ",")));
	serverCapabilities.setTextDocumentSync(TextDocumentSyncKind.Incremental);
	CompletionOptions completionOptions = new CompletionOptions();
	completionOptions.setResolveProvider(false);
	completionOptions.setTriggerCharacters(ImmutableList.of("."));
	serverCapabilities.setCompletionProvider(completionOptions);
	serverCapabilities.setDocumentFormattingProvider(true);
	serverCapabilities.setDocumentRangeFormattingProvider(true);
	serverCapabilities.setDocumentHighlightProvider(true);
	ClientCapabilities clientCapabilities = null;
	if (params != null) {
		clientCapabilities = params.getCapabilities();
	}
	TextDocumentClientCapabilities textDocument = null;
	if (clientCapabilities != null) {
		textDocument = clientCapabilities.getTextDocument();
	}
	RenameCapabilities rename = null;
	if (textDocument != null) {
		rename = textDocument.getRename();
	}
	Boolean prepareSupport = null;
	if (rename != null) {
		prepareSupport = rename.getPrepareSupport();
	}
	boolean clientPrepareSupport = Objects.equal(Boolean.TRUE, prepareSupport);
	if (clientPrepareSupport && allLanguages.stream()
			.anyMatch(serviceProvider -> serviceProvider.get(IRenameService2.class) != null)) {
		RenameOptions renameOptions = new RenameOptions();
		renameOptions.setPrepareProvider(true);
		serverCapabilities.setRenameProvider(Either.<Boolean, RenameOptions>forRight(renameOptions));
	} else {
		serverCapabilities.setRenameProvider(Either.forLeft(allLanguages.stream()
				.anyMatch((serviceProvider) -> serviceProvider.get(IRenameService2.class) != null)));
	}
	WorkspaceClientCapabilities workspace = null;
	if (clientCapabilities != null) {
		workspace = clientCapabilities.getWorkspace();
	}
	ExecuteCommandCapabilities executeCommand = null;
	if (workspace != null) {
		executeCommand = workspace.getExecuteCommand();
		if (workspace.getWorkspaceFolders() == Boolean.TRUE && workspaceManager.isSupportsWorkspaceFolders()) {
			WorkspaceFoldersOptions workspaceFoldersOptions = new WorkspaceFoldersOptions();
			workspaceFoldersOptions.setSupported(true);
			workspaceFoldersOptions.setChangeNotifications(true);
			serverCapabilities.setWorkspace(new WorkspaceServerCapabilities(workspaceFoldersOptions));
		}
	}
	if (executeCommand != null) {
		commandRegistry.initialize(allLanguages, clientCapabilities, client);
		ExecuteCommandOptions executeCommandOptions = new ExecuteCommandOptions();
		executeCommandOptions.setCommands(commandRegistry.getCommands());
		serverCapabilities.setExecuteCommandProvider(executeCommandOptions);
	}
	semanticHighlightingRegistry.initialize(allLanguages, clientCapabilities, client);
	serverCapabilities.setSemanticHighlighting(
			new SemanticHighlightingServerCapabilities(semanticHighlightingRegistry.getAllScopes()));

	for (IResourceServiceProvider language : allLanguages) {
		ICapabilitiesContributor capabilitiesContributor = language.get(ICapabilitiesContributor.class);
		if (capabilitiesContributor != null) {
			capabilitiesContributor.contribute(serverCapabilities, params);
		}
	}
	return serverCapabilities;
}
 
Example #14
Source File: ClientCapabilities.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
public ClientCapabilities(final WorkspaceClientCapabilities workspace, final TextDocumentClientCapabilities textDocument, final Object experimental) {
  this.workspace = workspace;
  this.textDocument = textDocument;
  this.experimental = experimental;
}
 
Example #15
Source File: ClientCapabilities.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Text document specific client capabilities.
 */
@Pure
public TextDocumentClientCapabilities getTextDocument() {
  return this.textDocument;
}
 
Example #16
Source File: ClientCapabilities.java    From lsp4j with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Text document specific client capabilities.
 */
public void setTextDocument(final TextDocumentClientCapabilities textDocument) {
  this.textDocument = textDocument;
}