All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.vespa.schemals.context.EventCodeActionContext Maven / Gradle / Ivy

There is a newer version: 8.441.21
Show newest version
package ai.vespa.schemals.context;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.lsp4j.CodeActionKind;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.Range;
import org.eclipse.lsp4j.TextDocumentIdentifier;

import ai.vespa.schemals.SchemaMessageHandler;
import ai.vespa.schemals.index.SchemaIndex;
import ai.vespa.schemals.schemadocument.SchemaDocumentScheduler;

/**
 * EventQuickfixContext
 */
public class EventCodeActionContext extends EventPositionContext {

    public final Range range;
    public final List diagnostics;
    public final List codeActionKinds;

	public EventCodeActionContext(
        SchemaDocumentScheduler scheduler, 
        SchemaIndex schemaIndex,
		SchemaMessageHandler messageHandler, 
        TextDocumentIdentifier documentIdentifier, 
        Range range, 
        List quickfixDiagnostics, 
        List onlyKinds) throws InvalidContextException {
		super(scheduler, schemaIndex, messageHandler, documentIdentifier, range.getStart());
        this.range = range;
        this.diagnostics = quickfixDiagnostics;
        this.codeActionKinds = new ArrayList<>();

        if (onlyKinds == null) {
            this.codeActionKinds.add(CodeActionKind.SourceOrganizeImports);
            this.codeActionKinds.add(CodeActionKind.QuickFix);
            this.codeActionKinds.add(CodeActionKind.Empty);
            this.codeActionKinds.add(CodeActionKind.Source);
            this.codeActionKinds.add(CodeActionKind.Refactor);
            this.codeActionKinds.add(CodeActionKind.SourceFixAll);
            this.codeActionKinds.add(CodeActionKind.RefactorInline);
            this.codeActionKinds.add(CodeActionKind.RefactorExtract);
            this.codeActionKinds.add(CodeActionKind.RefactorRewrite);
        } else {
            this.codeActionKinds.addAll(onlyKinds);
        }
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy