implements PLN-0023

This commit is contained in:
2026-03-31 16:57:31 +01:00
parent 53552ca012
commit 8dd3b58f39
24 changed files with 297 additions and 9 deletions
@@ -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);
}
@@ -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);
}
@@ -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();
}
}
@@ -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");
}
}