package moving
This commit is contained in:
parent
ba88dee8cb
commit
7415b70d1b
@ -2,12 +2,11 @@ package p.studio;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import p.packer.Packer;
|
import p.packer.Packer;
|
||||||
import p.studio.lsp.api.LspServerLifecycle;
|
|
||||||
import p.studio.lsp.events.StudioEventBus;
|
import p.studio.lsp.events.StudioEventBus;
|
||||||
import p.studio.lsp.events.StudioPackerEventAdapter;
|
import p.studio.lsp.events.StudioPackerEventAdapter;
|
||||||
import p.studio.lsp.v1.bootstrap.LspV1ServerLifecycle;
|
import p.studio.lsp.services.LspServerLifecycle;
|
||||||
import p.studio.lsp.v1.compiler.CompilerLanguageServiceBridge;
|
import p.studio.lsp.services.compiler.CompilerLanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.host.TcpLspServerHostFactory;
|
import p.studio.lsp.services.host.TcpLspServerHostFactory;
|
||||||
import p.studio.utilities.ThemeService;
|
import p.studio.utilities.ThemeService;
|
||||||
import p.studio.utilities.i18n.I18nService;
|
import p.studio.utilities.i18n.I18nService;
|
||||||
|
|
||||||
@ -23,7 +22,7 @@ public final class AppContainer implements Container {
|
|||||||
private final ObjectMapper mapper;
|
private final ObjectMapper mapper;
|
||||||
private final EmbeddedPacker embeddedPacker;
|
private final EmbeddedPacker embeddedPacker;
|
||||||
private final StudioBackgroundTasks backgroundTasks;
|
private final StudioBackgroundTasks backgroundTasks;
|
||||||
private final LspServerLifecycle lspServerLifecycle;
|
private final p.studio.lsp.api.LspServerLifecycle lspServerLifecycle;
|
||||||
|
|
||||||
public AppContainer() {
|
public AppContainer() {
|
||||||
this.i18nService = new I18nService();
|
this.i18nService = new I18nService();
|
||||||
@ -34,7 +33,7 @@ public final class AppContainer implements Container {
|
|||||||
this.backgroundTasks = new StudioBackgroundTasks(backgroundExecutor);
|
this.backgroundTasks = new StudioBackgroundTasks(backgroundExecutor);
|
||||||
final Packer packer = Packer.bootstrap(this.mapper, new StudioPackerEventAdapter(studioEventBus));
|
final Packer packer = Packer.bootstrap(this.mapper, new StudioPackerEventAdapter(studioEventBus));
|
||||||
this.embeddedPacker = new EmbeddedPacker(packer.workspaceService(), packer::close);
|
this.embeddedPacker = new EmbeddedPacker(packer.workspaceService(), packer::close);
|
||||||
this.lspServerLifecycle = new LspV1ServerLifecycle(
|
this.lspServerLifecycle = new LspServerLifecycle(
|
||||||
new TcpLspServerHostFactory(),
|
new TcpLspServerHostFactory(),
|
||||||
new CompilerLanguageServiceBridge());
|
new CompilerLanguageServiceBridge());
|
||||||
}
|
}
|
||||||
@ -70,7 +69,7 @@ public final class AppContainer implements Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LspServerLifecycle getLspServerLifecycle() {
|
public p.studio.lsp.api.LspServerLifecycle getLspServerLifecycle() {
|
||||||
return lspServerLifecycle;
|
return lspServerLifecycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
package p.studio.lsp.api;
|
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 {
|
public interface LspServerLifecycle {
|
||||||
LspServerHandle bootServer(LspServerBootRequest request);
|
LspServerHandle bootServer(LspServerBootRequest request);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.api;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.api;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.api;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.api;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.api;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,6 +1,9 @@
|
|||||||
package p.studio.lsp.api;
|
package p.studio.lsp.api;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
|
import p.studio.lsp.messages.LspServerConfiguration;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
public enum BaselineIssueSeverity {
|
public enum BaselineIssueSeverity {
|
||||||
INFORMATION,
|
INFORMATION,
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.messages;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,6 +1,9 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.services;
|
||||||
|
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.BaselineDocumentAnalysis;
|
||||||
|
import p.studio.lsp.messages.BaselineHover;
|
||||||
|
import p.studio.lsp.messages.BaselineServerDescription;
|
||||||
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
|
|
||||||
public interface LanguageServiceBridge {
|
public interface LanguageServiceBridge {
|
||||||
BaselineServerDescription describeServer(LspProjectContext project);
|
BaselineServerDescription describeServer(LspProjectContext project);
|
||||||
@ -1,23 +1,22 @@
|
|||||||
package p.studio.lsp.v1.bootstrap;
|
package p.studio.lsp.services;
|
||||||
|
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.api.LspServerBootRequest;
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
import p.studio.lsp.api.LspServerHandle;
|
import p.studio.lsp.messages.LspServerHandle;
|
||||||
import p.studio.lsp.api.LspServerLifecycle;
|
import p.studio.lsp.services.compiler.CompilerLanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.compiler.CompilerLanguageServiceBridge;
|
import p.studio.lsp.services.host.ProjectScopedLspServerHost;
|
||||||
import p.studio.lsp.v1.host.ProjectScopedLspServerHost;
|
import p.studio.lsp.services.host.ProjectScopedLspServerHostFactory;
|
||||||
import p.studio.lsp.v1.host.ProjectScopedLspServerHostFactory;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
public final class LspV1ServerLifecycle implements LspServerLifecycle {
|
public final class LspServerLifecycle implements p.studio.lsp.api.LspServerLifecycle {
|
||||||
private final ProjectScopedLspServerHostFactory serverHostFactory;
|
private final ProjectScopedLspServerHostFactory serverHostFactory;
|
||||||
private final CompilerLanguageServiceBridge compilerBridge;
|
private final CompilerLanguageServiceBridge compilerBridge;
|
||||||
private final ConcurrentMap<String, ProjectScopedLspServerHost> activeServers;
|
private final ConcurrentMap<String, ProjectScopedLspServerHost> activeServers;
|
||||||
|
|
||||||
public LspV1ServerLifecycle(
|
public LspServerLifecycle(
|
||||||
final ProjectScopedLspServerHostFactory serverHostFactory,
|
final ProjectScopedLspServerHostFactory serverHostFactory,
|
||||||
final CompilerLanguageServiceBridge compilerBridge) {
|
final CompilerLanguageServiceBridge compilerBridge) {
|
||||||
this.serverHostFactory = Objects.requireNonNull(serverHostFactory, "serverHostFactory");
|
this.serverHostFactory = Objects.requireNonNull(serverHostFactory, "serverHostFactory");
|
||||||
@ -1,7 +1,8 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.services.compiler;
|
||||||
|
|
||||||
import p.studio.compiler.workspaces.BuilderPipelineService;
|
import p.studio.compiler.workspaces.BuilderPipelineService;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.*;
|
||||||
|
import p.studio.lsp.services.LanguageServiceBridge;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
package p.studio.lsp.v1.host;
|
package p.studio.lsp.services.host;
|
||||||
|
|
||||||
import p.studio.lsp.api.LspServerEndpoint;
|
import p.studio.lsp.messages.LspServerEndpoint;
|
||||||
|
|
||||||
public interface ProjectScopedLspServerHost extends AutoCloseable {
|
public interface ProjectScopedLspServerHost extends AutoCloseable {
|
||||||
LspServerEndpoint start();
|
LspServerEndpoint start();
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package p.studio.lsp.v1.host;
|
package p.studio.lsp.services.host;
|
||||||
|
|
||||||
import p.studio.lsp.api.LspServerBootRequest;
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
import p.studio.lsp.v1.compiler.CompilerLanguageServiceBridge;
|
import p.studio.lsp.services.compiler.CompilerLanguageServiceBridge;
|
||||||
|
|
||||||
public interface ProjectScopedLspServerHostFactory {
|
public interface ProjectScopedLspServerHostFactory {
|
||||||
ProjectScopedLspServerHost create(
|
ProjectScopedLspServerHost create(
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package p.studio.lsp.v1.host;
|
package p.studio.lsp.services.host;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.jsonrpc.Launcher;
|
import org.eclipse.lsp4j.jsonrpc.Launcher;
|
||||||
import org.eclipse.lsp4j.launch.LSPLauncher;
|
import org.eclipse.lsp4j.launch.LSPLauncher;
|
||||||
import org.eclipse.lsp4j.services.LanguageClient;
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
import p.studio.lsp.api.LspServerBootRequest;
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
import p.studio.lsp.api.LspServerEndpoint;
|
import p.studio.lsp.messages.LspServerEndpoint;
|
||||||
import p.studio.lsp.v1.compiler.CompilerLanguageServiceBridge;
|
import p.studio.lsp.services.compiler.CompilerLanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.protocol.PrometeuLanguageServer;
|
import p.studio.lsp.services.protocol.PrometeuLanguageServer;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package p.studio.lsp.v1.host;
|
package p.studio.lsp.services.host;
|
||||||
|
|
||||||
import p.studio.lsp.api.LspServerBootRequest;
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
import p.studio.lsp.v1.compiler.CompilerLanguageServiceBridge;
|
import p.studio.lsp.services.compiler.CompilerLanguageServiceBridge;
|
||||||
|
|
||||||
public final class TcpLspServerHostFactory implements ProjectScopedLspServerHostFactory {
|
public final class TcpLspServerHostFactory implements ProjectScopedLspServerHostFactory {
|
||||||
@Override
|
@Override
|
||||||
@ -1,11 +1,11 @@
|
|||||||
package p.studio.lsp.v1.protocol;
|
package p.studio.lsp.services.protocol;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.InitializeParams;
|
import org.eclipse.lsp4j.InitializeParams;
|
||||||
import org.eclipse.lsp4j.WorkspaceFolder;
|
import org.eclipse.lsp4j.WorkspaceFolder;
|
||||||
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
|
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
|
||||||
import org.eclipse.lsp4j.jsonrpc.messages.ResponseError;
|
import org.eclipse.lsp4j.jsonrpc.messages.ResponseError;
|
||||||
import org.eclipse.lsp4j.jsonrpc.messages.ResponseErrorCode;
|
import org.eclipse.lsp4j.jsonrpc.messages.ResponseErrorCode;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.protocol;
|
package p.studio.lsp.services.protocol;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.*;
|
import org.eclipse.lsp4j.*;
|
||||||
import org.eclipse.lsp4j.services.LanguageClient;
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
@ -6,11 +6,11 @@ import org.eclipse.lsp4j.services.LanguageClientAware;
|
|||||||
import org.eclipse.lsp4j.services.LanguageServer;
|
import org.eclipse.lsp4j.services.LanguageServer;
|
||||||
import org.eclipse.lsp4j.services.TextDocumentService;
|
import org.eclipse.lsp4j.services.TextDocumentService;
|
||||||
import org.eclipse.lsp4j.services.WorkspaceService;
|
import org.eclipse.lsp4j.services.WorkspaceService;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.v1.compiler.CompilerLanguageServiceBridge;
|
import p.studio.lsp.services.compiler.CompilerLanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.compiler.LanguageServiceBridge;
|
import p.studio.lsp.services.LanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.protocol.mapping.Lsp4jProtocolMessageMapper;
|
import p.studio.lsp.services.protocol.mapping.Lsp4jProtocolMessageMapper;
|
||||||
import p.studio.lsp.v1.protocol.mapping.ProtocolMessageMapper;
|
import p.studio.lsp.services.protocol.mapping.ProtocolMessageMapper;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -62,8 +62,11 @@ public final class PrometeuLanguageServer implements LanguageServer, LanguageCli
|
|||||||
try {
|
try {
|
||||||
ProjectConnectionValidator.validateProjectBinding(project, params);
|
ProjectConnectionValidator.validateProjectBinding(project, params);
|
||||||
} catch (RuntimeException runtimeException) {
|
} catch (RuntimeException runtimeException) {
|
||||||
client.logMessage(protocolMessageMapper.mapInfoMessage(
|
final LanguageClient currentClient = client;
|
||||||
"Failed to initialize Prometeu Studio LSP for project " + project.projectKey() + ": " + runtimeException.getMessage()));
|
if (currentClient != null) {
|
||||||
|
currentClient.logMessage(protocolMessageMapper.mapInfoMessage(
|
||||||
|
"Failed to initialize Prometeu Studio LSP for project " + project.projectKey() + ": " + runtimeException.getMessage()));
|
||||||
|
}
|
||||||
return CompletableFuture.failedFuture(runtimeException);
|
return CompletableFuture.failedFuture(runtimeException);
|
||||||
}
|
}
|
||||||
return CompletableFuture.completedFuture(protocolMessageMapper.mapInitializeResult(
|
return CompletableFuture.completedFuture(protocolMessageMapper.mapInitializeResult(
|
||||||
@ -1,11 +1,11 @@
|
|||||||
package p.studio.lsp.v1.protocol;
|
package p.studio.lsp.services.protocol;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.*;
|
import org.eclipse.lsp4j.*;
|
||||||
import org.eclipse.lsp4j.services.LanguageClient;
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
import org.eclipse.lsp4j.services.TextDocumentService;
|
import org.eclipse.lsp4j.services.TextDocumentService;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.v1.compiler.LanguageServiceBridge;
|
import p.studio.lsp.services.LanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.protocol.mapping.ProtocolMessageMapper;
|
import p.studio.lsp.services.protocol.mapping.ProtocolMessageMapper;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.protocol;
|
package p.studio.lsp.services.protocol;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.DidChangeConfigurationParams;
|
import org.eclipse.lsp4j.DidChangeConfigurationParams;
|
||||||
import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
|
import org.eclipse.lsp4j.DidChangeWatchedFilesParams;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package p.studio.lsp.v1.protocol.mapping;
|
package p.studio.lsp.services.protocol.mapping;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.*;
|
import org.eclipse.lsp4j.*;
|
||||||
import p.studio.lsp.v1.compiler.*;
|
import p.studio.lsp.messages.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package p.studio.lsp.v1.protocol.mapping;
|
package p.studio.lsp.services.protocol.mapping;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.Hover;
|
import org.eclipse.lsp4j.Hover;
|
||||||
import org.eclipse.lsp4j.InitializeResult;
|
import org.eclipse.lsp4j.InitializeResult;
|
||||||
import org.eclipse.lsp4j.MessageParams;
|
import org.eclipse.lsp4j.MessageParams;
|
||||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||||
import p.studio.lsp.v1.compiler.BaselineDocumentAnalysis;
|
import p.studio.lsp.messages.BaselineDocumentAnalysis;
|
||||||
import p.studio.lsp.v1.compiler.BaselineHover;
|
import p.studio.lsp.messages.BaselineHover;
|
||||||
import p.studio.lsp.v1.compiler.BaselineServerDescription;
|
import p.studio.lsp.messages.BaselineServerDescription;
|
||||||
|
|
||||||
public interface ProtocolMessageMapper {
|
public interface ProtocolMessageMapper {
|
||||||
InitializeResult mapInitializeResult(BaselineServerDescription description);
|
InitializeResult mapInitializeResult(BaselineServerDescription description);
|
||||||
@ -1,12 +1,12 @@
|
|||||||
package p.studio.lsp.v1.bootstrap;
|
package p.studio.lsp.services;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.api.LspServerBootRequest;
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
import p.studio.lsp.api.LspServerEndpoint;
|
import p.studio.lsp.messages.LspServerEndpoint;
|
||||||
import p.studio.lsp.v1.compiler.CompilerLanguageServiceBridge;
|
import p.studio.lsp.services.compiler.CompilerLanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.host.ProjectScopedLspServerHost;
|
import p.studio.lsp.services.host.ProjectScopedLspServerHost;
|
||||||
import p.studio.lsp.v1.host.ProjectScopedLspServerHostFactory;
|
import p.studio.lsp.services.host.ProjectScopedLspServerHostFactory;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
@ -14,13 +14,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
|||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
class LspV1ServerLifecycleTest {
|
class LspServerLifecycleTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void lifecycleBootsAndShutsDownProjectScopedHost() {
|
void lifecycleBootsAndShutsDownProjectScopedHost() {
|
||||||
final FakeHost host = new FakeHost();
|
final FakeHost host = new FakeHost();
|
||||||
final ProjectScopedLspServerHostFactory factory = (request, compilerBridge) -> host;
|
final ProjectScopedLspServerHostFactory factory = (request, compilerBridge) -> host;
|
||||||
final var lifecycle = new LspV1ServerLifecycle(factory, new CompilerLanguageServiceBridge());
|
final var lifecycle = new LspServerLifecycle(factory, new CompilerLanguageServiceBridge());
|
||||||
final var project = new LspProjectContext("demo", "pbs", Path.of("."));
|
final var project = new LspProjectContext("demo", "pbs", Path.of("."));
|
||||||
|
|
||||||
final var handle = lifecycle.bootServer(LspServerBootRequest.defaults(project));
|
final var handle = lifecycle.bootServer(LspServerBootRequest.defaults(project));
|
||||||
@ -37,7 +37,7 @@ class LspV1ServerLifecycleTest {
|
|||||||
@Test
|
@Test
|
||||||
void lifecycleRejectsDoubleBootForSameProject() {
|
void lifecycleRejectsDoubleBootForSameProject() {
|
||||||
final ProjectScopedLspServerHostFactory factory = (request, compilerBridge) -> new FakeHost();
|
final ProjectScopedLspServerHostFactory factory = (request, compilerBridge) -> new FakeHost();
|
||||||
final var lifecycle = new LspV1ServerLifecycle(factory, new CompilerLanguageServiceBridge());
|
final var lifecycle = new LspServerLifecycle(factory, new CompilerLanguageServiceBridge());
|
||||||
final var request = LspServerBootRequest.defaults(new LspProjectContext("demo", "pbs", Path.of(".")));
|
final var request = LspServerBootRequest.defaults(new LspProjectContext("demo", "pbs", Path.of(".")));
|
||||||
|
|
||||||
lifecycle.bootServer(request);
|
lifecycle.bootServer(request);
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.boundary;
|
package p.studio.lsp.services.boundary;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
@ -7,6 +7,7 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
class LspV1BoundaryTest {
|
class LspV1BoundaryTest {
|
||||||
@ -39,8 +40,7 @@ class LspV1BoundaryTest {
|
|||||||
|
|
||||||
for (final Path javaFile : javaFiles) {
|
for (final Path javaFile : javaFiles) {
|
||||||
final String source = Files.readString(javaFile);
|
final String source = Files.readString(javaFile);
|
||||||
assertTrue(!source.contains("org.eclipse.lsp4j"),
|
assertFalse(source.contains("org.eclipse.lsp4j"), () -> "LSP4J leaked outside lsp-v1: " + javaFile);
|
||||||
() -> "LSP4J leaked outside lsp-v1: " + javaFile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,7 +1,10 @@
|
|||||||
package p.studio.lsp.v1.compiler;
|
package p.studio.lsp.services.compiler;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.BaselineDocumentAnalysis;
|
||||||
|
import p.studio.lsp.messages.BaselineHover;
|
||||||
|
import p.studio.lsp.messages.BaselineServerDescription;
|
||||||
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package p.studio.lsp.v1.protocol;
|
package p.studio.lsp.services.protocol;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.InitializeParams;
|
import org.eclipse.lsp4j.InitializeParams;
|
||||||
import org.eclipse.lsp4j.InitializeResult;
|
import org.eclipse.lsp4j.InitializeResult;
|
||||||
@ -6,11 +6,13 @@ import org.eclipse.lsp4j.WorkspaceFolder;
|
|||||||
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
|
import org.eclipse.lsp4j.jsonrpc.ResponseErrorException;
|
||||||
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
import org.eclipse.lsp4j.PublishDiagnosticsParams;
|
||||||
import org.eclipse.lsp4j.services.TextDocumentService;
|
import org.eclipse.lsp4j.services.TextDocumentService;
|
||||||
import org.eclipse.lsp4j.services.WorkspaceService;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.BaselineDocumentAnalysis;
|
||||||
import p.studio.lsp.v1.compiler.*;
|
import p.studio.lsp.messages.BaselineHover;
|
||||||
import p.studio.lsp.v1.protocol.mapping.ProtocolMessageMapper;
|
import p.studio.lsp.messages.BaselineServerDescription;
|
||||||
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
|
import p.studio.lsp.services.LanguageServiceBridge;
|
||||||
|
import p.studio.lsp.services.protocol.mapping.ProtocolMessageMapper;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -1,11 +1,11 @@
|
|||||||
package p.studio.lsp.v1.protocol;
|
package p.studio.lsp.services.protocol;
|
||||||
|
|
||||||
import org.eclipse.lsp4j.*;
|
import org.eclipse.lsp4j.*;
|
||||||
import org.eclipse.lsp4j.services.LanguageClient;
|
import org.eclipse.lsp4j.services.LanguageClient;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.*;
|
||||||
import p.studio.lsp.v1.compiler.*;
|
import p.studio.lsp.services.LanguageServiceBridge;
|
||||||
import p.studio.lsp.v1.protocol.mapping.ProtocolMessageMapper;
|
import p.studio.lsp.services.protocol.mapping.ProtocolMessageMapper;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package p.studio.projectsessions;
|
package p.studio.projectsessions;
|
||||||
|
|
||||||
import p.studio.execution.StudioExecutionSessionService;
|
import p.studio.execution.StudioExecutionSessionService;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.api.LspServerHandle;
|
import p.studio.lsp.messages.LspServerHandle;
|
||||||
import p.studio.lsp.api.LspServerLifecycle;
|
import p.studio.lsp.api.LspServerLifecycle;
|
||||||
import p.studio.projectstate.ProjectLocalStudioSetup;
|
import p.studio.projectstate.ProjectLocalStudioSetup;
|
||||||
import p.studio.projectstate.ProjectLocalStudioState;
|
import p.studio.projectstate.ProjectLocalStudioState;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
package p.studio.projectsessions;
|
package p.studio.projectsessions;
|
||||||
|
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.api.LspServerBootRequest;
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
import p.studio.lsp.api.LspServerHandle;
|
import p.studio.lsp.messages.LspServerHandle;
|
||||||
import p.studio.lsp.api.LspServerLifecycle;
|
import p.studio.lsp.api.LspServerLifecycle;
|
||||||
import p.studio.execution.StudioExecutionSessionService;
|
import p.studio.execution.StudioExecutionSessionService;
|
||||||
import p.studio.projectstate.ProjectLocalStudioSetupService;
|
import p.studio.projectstate.ProjectLocalStudioSetupService;
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
package p.studio.projectsessions;
|
package p.studio.projectsessions;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.api.LspServerBootRequest;
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
import p.studio.lsp.api.LspServerHandle;
|
import p.studio.lsp.messages.LspServerHandle;
|
||||||
import p.studio.lsp.api.LspServerLifecycle;
|
import p.studio.lsp.api.LspServerLifecycle;
|
||||||
|
import p.studio.lsp.messages.LspServerEndpoint;
|
||||||
import p.studio.projectstate.ProjectLocalStudioSetup;
|
import p.studio.projectstate.ProjectLocalStudioSetup;
|
||||||
import p.studio.projectstate.ProjectLocalStudioSetupService;
|
import p.studio.projectstate.ProjectLocalStudioSetupService;
|
||||||
import p.studio.projectstate.ProjectLocalStudioState;
|
import p.studio.projectstate.ProjectLocalStudioState;
|
||||||
@ -105,7 +106,7 @@ final class StudioProjectSessionFactoryTest {
|
|||||||
lastRequest = request;
|
lastRequest = request;
|
||||||
return new LspServerHandle(
|
return new LspServerHandle(
|
||||||
request.project(),
|
request.project(),
|
||||||
new p.studio.lsp.api.LspServerEndpoint("127.0.0.1", request.configuration().port()));
|
new LspServerEndpoint("127.0.0.1", request.configuration().port()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -2,9 +2,11 @@ package p.studio.projectsessions;
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import p.studio.execution.StudioExecutionSessionService;
|
import p.studio.execution.StudioExecutionSessionService;
|
||||||
import p.studio.lsp.api.LspProjectContext;
|
import p.studio.lsp.messages.LspProjectContext;
|
||||||
import p.studio.lsp.api.LspServerHandle;
|
import p.studio.lsp.messages.LspServerHandle;
|
||||||
import p.studio.lsp.api.LspServerLifecycle;
|
import p.studio.lsp.api.LspServerLifecycle;
|
||||||
|
import p.studio.lsp.messages.LspServerBootRequest;
|
||||||
|
import p.studio.lsp.messages.LspServerEndpoint;
|
||||||
import p.studio.projectstate.ProjectLocalStudioSetup;
|
import p.studio.projectstate.ProjectLocalStudioSetup;
|
||||||
import p.studio.projectstate.ProjectLocalStudioState;
|
import p.studio.projectstate.ProjectLocalStudioState;
|
||||||
import p.studio.projectstate.ProjectLocalStudioStateService;
|
import p.studio.projectstate.ProjectLocalStudioStateService;
|
||||||
@ -61,7 +63,7 @@ final class StudioProjectSessionTest {
|
|||||||
final RecordingLspServerLifecycle lspServerLifecycle = new RecordingLspServerLifecycle();
|
final RecordingLspServerLifecycle lspServerLifecycle = new RecordingLspServerLifecycle();
|
||||||
final LspServerHandle lspServerHandle = new LspServerHandle(
|
final LspServerHandle lspServerHandle = new LspServerHandle(
|
||||||
new LspProjectContext("demo", "pbs", Path.of("/tmp/example")),
|
new LspProjectContext("demo", "pbs", Path.of("/tmp/example")),
|
||||||
new p.studio.lsp.api.LspServerEndpoint("127.0.0.1", 7777));
|
new LspServerEndpoint("127.0.0.1", 7777));
|
||||||
final StudioProjectSession session = new StudioProjectSession(
|
final StudioProjectSession session = new StudioProjectSession(
|
||||||
projectReference(),
|
projectReference(),
|
||||||
stateService,
|
stateService,
|
||||||
@ -100,7 +102,7 @@ final class StudioProjectSessionTest {
|
|||||||
private LspProjectContext lastProject;
|
private LspProjectContext lastProject;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LspServerHandle bootServer(final p.studio.lsp.api.LspServerBootRequest request) {
|
public LspServerHandle bootServer(final LspServerBootRequest request) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user