Search in sources :

Example 1 with CodeActionRegistrationOptions

use of org.eclipse.lsp4j.CodeActionRegistrationOptions in project lxtk by lxtk-org.

the class CodeActionFeature method initialize.

@Override
void initialize(ServerCapabilities capabilities, List<DocumentFilter> documentSelector) {
    if (documentSelector == null)
        return;
    Either<Boolean, CodeActionOptions> capability = capabilities.getCodeActionProvider();
    if (capability == null || !(capability.isRight() || Boolean.TRUE.equals(capability.getLeft())))
        return;
    CodeActionRegistrationOptions registerOptions = new CodeActionRegistrationOptions();
    registerOptions.setDocumentSelector(documentSelector);
    CodeActionOptions options = capability.getRight();
    if (options != null) {
        registerOptions.setWorkDoneProgress(options.getWorkDoneProgress());
        registerOptions.setCodeActionKinds(options.getCodeActionKinds());
        registerOptions.setResolveProvider(options.getResolveProvider());
    }
    register(new Registration(UUID.randomUUID().toString(), METHOD, registerOptions));
}
Also used : CodeActionOptions(org.eclipse.lsp4j.CodeActionOptions) CodeActionRegistrationOptions(org.eclipse.lsp4j.CodeActionRegistrationOptions) Registration(org.eclipse.lsp4j.Registration)

Aggregations

CodeActionOptions (org.eclipse.lsp4j.CodeActionOptions)1 CodeActionRegistrationOptions (org.eclipse.lsp4j.CodeActionRegistrationOptions)1 Registration (org.eclipse.lsp4j.Registration)1