implements PLN-0023
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package p.lsp;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
|
||||
public record PrometeuLspProjectContext(
|
||||
String projectName,
|
||||
String languageId,
|
||||
Path rootPath) {
|
||||
|
||||
public PrometeuLspProjectContext {
|
||||
Objects.requireNonNull(projectName, "projectName");
|
||||
Objects.requireNonNull(languageId, "languageId");
|
||||
rootPath = Objects.requireNonNull(rootPath, "rootPath").toAbsolutePath().normalize();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package p.lsp;
|
||||
|
||||
import p.lsp.dtos.PrometeuLspSessionStateDTO;
|
||||
import p.studio.vfs.ProjectDocumentVfs;
|
||||
|
||||
public interface PrometeuLspService extends AutoCloseable {
|
||||
PrometeuLspProjectContext projectContext();
|
||||
|
||||
ProjectDocumentVfs projectDocumentVfs();
|
||||
|
||||
PrometeuLspSessionStateDTO snapshot();
|
||||
|
||||
@Override
|
||||
default void close() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package p.lsp;
|
||||
|
||||
import p.studio.vfs.ProjectDocumentVfs;
|
||||
|
||||
public interface PrometeuLspServiceFactory {
|
||||
PrometeuLspService open(PrometeuLspProjectContext projectContext, ProjectDocumentVfs projectDocumentVfs);
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package p.lsp.dtos;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public record PrometeuLspSessionStateDTO(
|
||||
boolean semanticReadReady,
|
||||
List<String> declaredCapabilities) {
|
||||
|
||||
public PrometeuLspSessionStateDTO {
|
||||
declaredCapabilities = List.copyOf(Objects.requireNonNull(declaredCapabilities, "declaredCapabilities"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package p.lsp.events;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record PrometeuLspEvent(
|
||||
PrometeuLspEventKind kind,
|
||||
String message) {
|
||||
|
||||
public PrometeuLspEvent {
|
||||
Objects.requireNonNull(kind, "kind");
|
||||
Objects.requireNonNull(message, "message");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package p.lsp.events;
|
||||
|
||||
public enum PrometeuLspEventKind {
|
||||
SESSION_READY
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package p.lsp.events;
|
||||
|
||||
public interface PrometeuLspEventSink {
|
||||
void publish(PrometeuLspEvent event);
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package p.lsp.messages;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
|
||||
public record PrometeuLspAnalyzeDocumentRequest(
|
||||
Path documentPath) {
|
||||
|
||||
public PrometeuLspAnalyzeDocumentRequest {
|
||||
documentPath = Objects.requireNonNull(documentPath, "documentPath").toAbsolutePath().normalize();
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package p.lsp.messages;
|
||||
|
||||
import p.lsp.dtos.PrometeuLspSessionStateDTO;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record PrometeuLspAnalyzeDocumentResult(
|
||||
PrometeuLspSessionStateDTO sessionState) {
|
||||
|
||||
public PrometeuLspAnalyzeDocumentResult {
|
||||
Objects.requireNonNull(sessionState, "sessionState");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user