package moving
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
package p.studio.lsp.api;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
|
||||
public record LspProjectContext(
|
||||
String projectKey,
|
||||
String languageId,
|
||||
Path projectRoot) {
|
||||
|
||||
public LspProjectContext {
|
||||
projectKey = requireText(projectKey, "projectKey");
|
||||
languageId = requireText(languageId, "languageId");
|
||||
projectRoot = Objects.requireNonNull(projectRoot, "projectRoot").toAbsolutePath().normalize();
|
||||
}
|
||||
|
||||
private static String requireText(
|
||||
final String value,
|
||||
final String field) {
|
||||
final String candidate = Objects.requireNonNull(value, field).trim();
|
||||
if (candidate.isEmpty()) {
|
||||
throw new IllegalArgumentException(field + " must not be blank");
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package p.studio.lsp.api;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record LspServerBootRequest(
|
||||
LspProjectContext project,
|
||||
LspServerConfiguration configuration) {
|
||||
|
||||
public LspServerBootRequest {
|
||||
project = Objects.requireNonNull(project, "project");
|
||||
configuration = Objects.requireNonNull(configuration, "configuration");
|
||||
}
|
||||
|
||||
public static LspServerBootRequest defaults(final LspProjectContext project) {
|
||||
return new LspServerBootRequest(project, LspServerConfiguration.defaults());
|
||||
}
|
||||
}
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
package p.studio.lsp.api;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record LspServerConfiguration(
|
||||
String host,
|
||||
int port) {
|
||||
public static final String DEFAULT_HOST = "127.0.0.1";
|
||||
public static final int DEFAULT_PORT = 7777;
|
||||
|
||||
public LspServerConfiguration {
|
||||
host = requireHost(host);
|
||||
if (port < 0 || port > 65535) {
|
||||
throw new IllegalArgumentException("port must be between 0 and 65535");
|
||||
}
|
||||
}
|
||||
|
||||
public static LspServerConfiguration defaults() {
|
||||
return new LspServerConfiguration(DEFAULT_HOST, DEFAULT_PORT);
|
||||
}
|
||||
|
||||
private static String requireHost(final String value) {
|
||||
final String candidate = Objects.requireNonNull(value, "host").trim();
|
||||
if (candidate.isEmpty()) {
|
||||
throw new IllegalArgumentException("host must not be blank");
|
||||
}
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package p.studio.lsp.api;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record LspServerEndpoint(
|
||||
String host,
|
||||
int port) {
|
||||
|
||||
public LspServerEndpoint {
|
||||
final String candidate = Objects.requireNonNull(host, "host").trim();
|
||||
if (candidate.isEmpty()) {
|
||||
throw new IllegalArgumentException("host must not be blank");
|
||||
}
|
||||
if (port < 0 || port > 65535) {
|
||||
throw new IllegalArgumentException("port must be between 0 and 65535");
|
||||
}
|
||||
host = candidate;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package p.studio.lsp.api;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public record LspServerHandle(
|
||||
LspProjectContext project,
|
||||
LspServerEndpoint endpoint) {
|
||||
|
||||
public LspServerHandle {
|
||||
project = Objects.requireNonNull(project, "project");
|
||||
endpoint = Objects.requireNonNull(endpoint, "endpoint");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package p.studio.lsp.api;
|
||||
|
||||
import p.studio.lsp.messages.LspProjectContext;
|
||||
import p.studio.lsp.messages.LspServerBootRequest;
|
||||
import p.studio.lsp.messages.LspServerHandle;
|
||||
|
||||
public interface LspServerLifecycle {
|
||||
LspServerHandle bootServer(LspServerBootRequest request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user