refactor, rename and reducing complexity
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
package p.studio;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import p.lsp.PrometeuLspServiceFactory;
|
||||
import p.studio.events.StudioEventBus;
|
||||
import p.studio.lsp.LspServiceFactory;
|
||||
import p.studio.lsp.events.StudioEventBus;
|
||||
import p.studio.utilities.ThemeService;
|
||||
import p.studio.utilities.i18n.I18nService;
|
||||
import p.studio.vfs.ProjectDocumentVfsFactory;
|
||||
@@ -19,7 +19,7 @@ public interface Container {
|
||||
|
||||
ObjectMapper getMapper();
|
||||
|
||||
PrometeuLspServiceFactory getPrometeuLspServiceFactory();
|
||||
LspServiceFactory getPrometeuLspServiceFactory();
|
||||
|
||||
ProjectDocumentVfsFactory getProjectDocumentVfsFactory();
|
||||
|
||||
@@ -66,7 +66,7 @@ public interface Container {
|
||||
return current().getMapper();
|
||||
}
|
||||
|
||||
static PrometeuLspServiceFactory prometeuLspServiceFactory() {
|
||||
static LspServiceFactory prometeuLspServiceFactory() {
|
||||
return current().getPrometeuLspServiceFactory();
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.controls.forms;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
public record StudioFormEditScopeChangedEvent(
|
||||
String scopeKey,
|
||||
|
||||
@@ -6,7 +6,7 @@ import javafx.scene.Parent;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.VBox;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.controls.shell;
|
||||
|
||||
import p.studio.events.*;
|
||||
import p.studio.lsp.events.*;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetsWorkspaceRefreshFailedEvent;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetsWorkspaceRefreshStartedEvent;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetsWorkspaceRefreshedEvent;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ import javafx.scene.layout.VBox;
|
||||
import p.studio.Container;
|
||||
import p.studio.controls.lifecycle.StudioControlLifecycle;
|
||||
import p.studio.controls.lifecycle.StudioControlLifecycleSupport;
|
||||
import p.studio.events.*;
|
||||
import p.studio.lsp.events.*;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.events.EventSubscription;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import p.studio.utilities.events.SimpleEvent;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import p.studio.utilities.events.EventSubscription;
|
||||
import p.studio.utilities.events.TypedEventBus;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import p.packer.events.PackerEvent;
|
||||
import p.packer.events.PackerEventSink;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import p.packer.events.PackerEventKind;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
public record StudioProjectCreatedEvent() implements StudioEvent {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
public record StudioProjectLoadingCompletedEvent() implements StudioEvent {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
public enum StudioProjectLoadingPhase {
|
||||
RESOLVING_PROJECT,
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
public record StudioProjectLoadingStartedEvent() implements StudioEvent {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
public record StudioProjectOpenedEvent() implements StudioEvent {
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import p.studio.utilities.events.EventSubscription;
|
||||
import p.studio.utilities.events.TypedEventBus;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import p.studio.workspaces.WorkspaceId;
|
||||
|
||||
@@ -2,7 +2,7 @@ package p.studio.projects;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import p.packer.messages.PackerProjectContext;
|
||||
import p.studio.vfs.VfsProjectContext;
|
||||
import p.studio.vfs.messages.VfsProjectContext;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
package p.studio.projectsessions;
|
||||
|
||||
import p.lsp.PrometeuLspService;
|
||||
import p.studio.lsp.LspService;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.vfs.ProjectDocumentVfs;
|
||||
import p.studio.vfs.VfsProjectDocument;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public final class StudioProjectSession implements AutoCloseable {
|
||||
private final ProjectReference projectReference;
|
||||
private final PrometeuLspService prometeuLspService;
|
||||
private final ProjectDocumentVfs projectDocumentVfs;
|
||||
private final LspService prometeuLspService;
|
||||
private final VfsProjectDocument vfsProjectDocument;
|
||||
private boolean closed;
|
||||
|
||||
public StudioProjectSession(
|
||||
final ProjectReference projectReference,
|
||||
final PrometeuLspService prometeuLspService,
|
||||
final ProjectDocumentVfs projectDocumentVfs) {
|
||||
final LspService prometeuLspService,
|
||||
final VfsProjectDocument vfsProjectDocument) {
|
||||
this.projectReference = Objects.requireNonNull(projectReference, "projectReference");
|
||||
this.prometeuLspService = Objects.requireNonNull(prometeuLspService, "prometeuLspService");
|
||||
this.projectDocumentVfs = Objects.requireNonNull(projectDocumentVfs, "projectDocumentVfs");
|
||||
this.vfsProjectDocument = Objects.requireNonNull(vfsProjectDocument, "vfsProjectDocument");
|
||||
}
|
||||
|
||||
public ProjectReference projectReference() {
|
||||
return projectReference;
|
||||
}
|
||||
|
||||
public ProjectDocumentVfs projectDocumentVfs() {
|
||||
return projectDocumentVfs;
|
||||
public VfsProjectDocument projectDocumentVfs() {
|
||||
return vfsProjectDocument;
|
||||
}
|
||||
|
||||
public PrometeuLspService prometeuLspService() {
|
||||
public LspService prometeuLspService() {
|
||||
return prometeuLspService;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,6 @@ public final class StudioProjectSession implements AutoCloseable {
|
||||
}
|
||||
closed = true;
|
||||
prometeuLspService.close();
|
||||
projectDocumentVfs.close();
|
||||
vfsProjectDocument.close();
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -1,35 +1,35 @@
|
||||
package p.studio.projectsessions;
|
||||
|
||||
import p.lsp.PrometeuLspProjectContext;
|
||||
import p.lsp.PrometeuLspServiceFactory;
|
||||
import p.studio.lsp.messages.LspProjectContext;
|
||||
import p.studio.lsp.LspServiceFactory;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.vfs.ProjectDocumentVfs;
|
||||
import p.studio.vfs.VfsProjectDocument;
|
||||
import p.studio.vfs.ProjectDocumentVfsFactory;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public final class StudioProjectSessionFactory {
|
||||
private final PrometeuLspServiceFactory prometeuLspServiceFactory;
|
||||
private final LspServiceFactory lspServiceFactory;
|
||||
private final ProjectDocumentVfsFactory projectDocumentVfsFactory;
|
||||
|
||||
public StudioProjectSessionFactory(
|
||||
final PrometeuLspServiceFactory prometeuLspServiceFactory,
|
||||
final LspServiceFactory lspServiceFactory,
|
||||
final ProjectDocumentVfsFactory projectDocumentVfsFactory) {
|
||||
this.prometeuLspServiceFactory = Objects.requireNonNull(prometeuLspServiceFactory, "prometeuLspServiceFactory");
|
||||
this.lspServiceFactory = Objects.requireNonNull(lspServiceFactory, "prometeuLspServiceFactory");
|
||||
this.projectDocumentVfsFactory = Objects.requireNonNull(projectDocumentVfsFactory, "projectDocumentVfsFactory");
|
||||
}
|
||||
|
||||
public StudioProjectSession open(final ProjectReference projectReference) {
|
||||
final ProjectReference target = Objects.requireNonNull(projectReference, "projectReference");
|
||||
final ProjectDocumentVfs projectDocumentVfs = projectDocumentVfsFactory.open(target.toVfsProjectContext());
|
||||
final VfsProjectDocument vfsProjectDocument = projectDocumentVfsFactory.open(target.toVfsProjectContext());
|
||||
return new StudioProjectSession(
|
||||
target,
|
||||
prometeuLspServiceFactory.open(lspProjectContext(target), projectDocumentVfs),
|
||||
projectDocumentVfs);
|
||||
lspServiceFactory.open(lspProjectContext(target), vfsProjectDocument),
|
||||
vfsProjectDocument);
|
||||
}
|
||||
|
||||
private PrometeuLspProjectContext lspProjectContext(final ProjectReference projectReference) {
|
||||
return new PrometeuLspProjectContext(
|
||||
private LspProjectContext lspProjectContext(final ProjectReference projectReference) {
|
||||
return new LspProjectContext(
|
||||
projectReference.name(),
|
||||
projectReference.languageId(),
|
||||
projectReference.rootPath());
|
||||
|
||||
@@ -3,7 +3,7 @@ package p.studio.window;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import p.studio.Container;
|
||||
import p.studio.controls.shell.*;
|
||||
import p.studio.events.StudioWorkspaceSelectedEvent;
|
||||
import p.studio.lsp.events.StudioWorkspaceSelectedEvent;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.projectsessions.StudioProjectSession;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
|
||||
@@ -6,7 +6,7 @@ import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
import p.packer.messages.InitWorkspaceRequest;
|
||||
import p.studio.Container;
|
||||
import p.studio.events.*;
|
||||
import p.studio.lsp.events.*;
|
||||
import p.studio.projects.KnownProjectsService;
|
||||
import p.studio.projects.ProjectCatalogService;
|
||||
import p.studio.projects.ProjectReference;
|
||||
|
||||
@@ -2,7 +2,7 @@ package p.studio.workspaces;
|
||||
|
||||
import p.studio.Container;
|
||||
import p.studio.controls.lifecycle.StudioControlLifecycle;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package p.studio.workspaces.assets;
|
||||
|
||||
import p.studio.Container;
|
||||
import p.studio.events.StudioPackerOperationEvent;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioPackerOperationEvent;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.utilities.logspane.LogsPane;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetLogEvent;
|
||||
|
||||
+1
-2
@@ -15,7 +15,7 @@ import p.packer.messages.*;
|
||||
import p.studio.Container;
|
||||
import p.studio.controls.forms.StudioFormEditScopeChangedEvent;
|
||||
import p.studio.controls.forms.StudioSection;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.workspaces.assets.dialogs.AssetDiagnosticsDialog;
|
||||
@@ -38,7 +38,6 @@ import p.studio.workspaces.assets.wizards.MoveAssetWizard;
|
||||
import p.studio.workspaces.framework.StudioEventAware;
|
||||
import p.studio.workspaces.framework.StudioEventBindings;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
|
||||
+1
-2
@@ -11,10 +11,9 @@ import p.studio.controls.banks.StudioAssetCapacityMeter;
|
||||
import p.studio.controls.forms.StudioFormEditScopeChangedEvent;
|
||||
import p.studio.controls.forms.StudioFormMode;
|
||||
import p.studio.controls.forms.StudioFormSection;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.workspaces.assets.details.AssetDetailsUiSupport;
|
||||
import p.studio.workspaces.assets.messages.AssetWorkspaceDetailsViewState;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetBankCompositionAppliedEvent;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetBankCompositionApplyFailedEvent;
|
||||
|
||||
+1
-2
@@ -6,7 +6,6 @@ import javafx.scene.Node;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.Control;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.HBox;
|
||||
@@ -22,7 +21,7 @@ import p.studio.controls.forms.StudioFormSession;
|
||||
import p.studio.controls.forms.StudioFormSection;
|
||||
import p.studio.controls.lifecycle.StudioControlLifecycle;
|
||||
import p.studio.controls.lifecycle.StudioControlLifecycleSupport;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.workspaces.assets.details.AssetDetailsUiSupport;
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import p.studio.Container;
|
||||
import p.studio.controls.forms.StudioFormEditScopeChangedEvent;
|
||||
import p.studio.controls.forms.StudioFormMode;
|
||||
import p.studio.controls.forms.StudioFormSection;
|
||||
import p.studio.events.StudioPackerOperationEvent;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioPackerOperationEvent;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.workspaces.assets.messages.AssetWorkspaceDetailsViewState;
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import javafx.scene.layout.VBox;
|
||||
import p.studio.Container;
|
||||
import p.studio.controls.lifecycle.StudioControlLifecycle;
|
||||
import p.studio.controls.lifecycle.StudioControlLifecycleSupport;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.workspaces.assets.details.AssetDetailsUiSupport;
|
||||
|
||||
@@ -14,7 +14,7 @@ import p.packer.dtos.PackerAssetSummaryDTO;
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.packer.messages.ListAssetsRequest;
|
||||
import p.studio.Container;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.workspaces.assets.AssetWorkspaceState;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import p.packer.messages.assets.AssetFamilyCatalog;
|
||||
import p.studio.Container;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.workspaces.assets.messages.AssetWorkspaceAssetState;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.studio.controls.banks.StudioAssetCapacitySeverity;
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
public record StudioAssetLogEvent(
|
||||
String source,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
import p.studio.workspaces.assets.messages.AssetWorkspaceDetailsViewState;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
import p.studio.workspaces.assets.messages.AssetListViewState;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
public record StudioAssetsRefreshRequestedEvent(
|
||||
AssetReference preferredAssetReference,
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
public record StudioAssetsWorkspaceRefreshStartedEvent() implements StudioEvent {
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
public record StudioAssetsWorkspaceRefreshedEvent(int assetCount) implements StudioEvent {
|
||||
public StudioAssetsWorkspaceRefreshedEvent {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.assets.messages.events;
|
||||
|
||||
import p.packer.messages.AssetReference;
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.editor;
|
||||
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentResult;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentResult;
|
||||
import p.studio.workspaces.editor.syntaxhighlight.EditorDocumentSemanticHighlighting;
|
||||
|
||||
final class EditorDocumentHighlightingRouter {
|
||||
@@ -10,7 +10,7 @@ final class EditorDocumentHighlightingRouter {
|
||||
static EditorDocumentHighlightingResult route(
|
||||
final EditorOpenFileBuffer fileBuffer,
|
||||
final EditorDocumentPresentation presentation,
|
||||
final PrometeuLspAnalyzeDocumentResult analysis) {
|
||||
final LspAnalyzeDocumentResult analysis) {
|
||||
if (fileBuffer.frontendDocument()
|
||||
&& analysis != null
|
||||
&& !analysis.semanticHighlights().isEmpty()) {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.editor;
|
||||
|
||||
import p.studio.compiler.FrontendRegistryService;
|
||||
import p.studio.vfs.VfsDocumentTypeIds;
|
||||
import p.studio.vfs.messages.VfsDocumentTypeIds;
|
||||
import p.studio.workspaces.editor.syntaxhighlight.EditorDocumentSyntaxHighlighting;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package p.studio.workspaces.editor;
|
||||
|
||||
import p.studio.vfs.VfsDocumentAccessMode;
|
||||
import p.studio.vfs.messages.VfsDocumentAccessMode;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -4,8 +4,8 @@ import javafx.geometry.Insets;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import p.lsp.dtos.PrometeuLspDiagnosticDTO;
|
||||
import p.lsp.dtos.PrometeuLspSymbolDTO;
|
||||
import p.studio.lsp.dtos.LspDiagnosticDTO;
|
||||
import p.studio.lsp.dtos.LspSymbolDTO;
|
||||
import p.studio.Container;
|
||||
import p.studio.controls.WorkspaceDockPane;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
@@ -63,21 +63,21 @@ public final class EditorOutlinePanel extends WorkspaceDockPane {
|
||||
|
||||
public void showSemanticReadResult(
|
||||
final Path documentPath,
|
||||
final List<PrometeuLspDiagnosticDTO> diagnostics,
|
||||
final List<PrometeuLspSymbolDTO> symbols) {
|
||||
final List<LspDiagnosticDTO> diagnostics,
|
||||
final List<LspSymbolDTO> symbols) {
|
||||
summary.textProperty().unbind();
|
||||
summary.setText(documentPath.getFileName() + " • semantic read-only");
|
||||
rebuildDiagnostics(diagnostics);
|
||||
rebuildSymbols(symbols);
|
||||
}
|
||||
|
||||
private void rebuildDiagnostics(final List<PrometeuLspDiagnosticDTO> diagnostics) {
|
||||
private void rebuildDiagnostics(final List<LspDiagnosticDTO> diagnostics) {
|
||||
diagnosticsBox.getChildren().clear();
|
||||
if (diagnostics.isEmpty()) {
|
||||
diagnosticsBox.getChildren().add(placeholderLabel(I18n.CODE_EDITOR_OUTLINE_EMPTY_DIAGNOSTICS));
|
||||
return;
|
||||
}
|
||||
for (final PrometeuLspDiagnosticDTO diagnostic : diagnostics) {
|
||||
for (final LspDiagnosticDTO diagnostic : diagnostics) {
|
||||
final var label = new Label(formatDiagnostic(diagnostic));
|
||||
label.setWrapText(true);
|
||||
label.getStyleClass().addAll(
|
||||
@@ -89,24 +89,24 @@ public final class EditorOutlinePanel extends WorkspaceDockPane {
|
||||
}
|
||||
}
|
||||
|
||||
private void rebuildSymbols(final List<PrometeuLspSymbolDTO> symbols) {
|
||||
private void rebuildSymbols(final List<LspSymbolDTO> symbols) {
|
||||
symbolsBox.getChildren().clear();
|
||||
if (symbols.isEmpty()) {
|
||||
symbolsBox.getChildren().add(placeholderLabel(I18n.CODE_EDITOR_OUTLINE_EMPTY_SYMBOLS));
|
||||
return;
|
||||
}
|
||||
for (final PrometeuLspSymbolDTO symbol : symbols) {
|
||||
for (final LspSymbolDTO symbol : symbols) {
|
||||
appendSymbol(symbol, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void appendSymbol(final PrometeuLspSymbolDTO symbol, final int depth) {
|
||||
private void appendSymbol(final LspSymbolDTO symbol, final int depth) {
|
||||
final var label = new Label(symbol.name() + " • " + symbol.kind().name().toLowerCase());
|
||||
label.setWrapText(true);
|
||||
label.setPadding(new Insets(0, 0, 0, depth * 12));
|
||||
label.getStyleClass().add("editor-workspace-outline-item");
|
||||
symbolsBox.getChildren().add(label);
|
||||
for (final PrometeuLspSymbolDTO child : symbol.children()) {
|
||||
for (final LspSymbolDTO child : symbol.children()) {
|
||||
appendSymbol(child, depth + 1);
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public final class EditorOutlinePanel extends WorkspaceDockPane {
|
||||
return label;
|
||||
}
|
||||
|
||||
private String formatDiagnostic(final PrometeuLspDiagnosticDTO diagnostic) {
|
||||
private String formatDiagnostic(final LspDiagnosticDTO diagnostic) {
|
||||
return "%s [%d,%d) %s".formatted(
|
||||
diagnostic.severity().name(),
|
||||
diagnostic.range().startOffset(),
|
||||
|
||||
+2
-2
@@ -15,8 +15,8 @@ import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import p.studio.Container;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.vfs.VfsProjectNode;
|
||||
import p.studio.vfs.VfsProjectSnapshot;
|
||||
import p.studio.vfs.messages.VfsProjectNode;
|
||||
import p.studio.vfs.messages.VfsProjectSnapshot;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.HashSet;
|
||||
|
||||
@@ -5,22 +5,17 @@ import javafx.scene.control.Alert;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.SplitPane;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.layout.*;
|
||||
import org.fxmisc.richtext.CodeArea;
|
||||
import org.fxmisc.richtext.LineNumberFactory;
|
||||
import p.lsp.PrometeuLspService;
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentRequest;
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentResult;
|
||||
import p.studio.lsp.LspService;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentRequest;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentResult;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.utilities.i18n.I18n;
|
||||
import p.studio.vfs.ProjectDocumentVfs;
|
||||
import p.studio.vfs.VfsProjectDocument;
|
||||
import p.studio.vfs.VfsDocumentOpenResult;
|
||||
import p.studio.vfs.VfsProjectNode;
|
||||
import p.studio.vfs.VfsTextDocument;
|
||||
import p.studio.vfs.messages.VfsProjectNode;
|
||||
import p.studio.workspaces.Workspace;
|
||||
import p.studio.workspaces.WorkspaceId;
|
||||
|
||||
@@ -41,18 +36,18 @@ public final class EditorWorkspace extends Workspace {
|
||||
private final EditorStatusBar statusBar = new EditorStatusBar();
|
||||
private final EditorTabStrip tabStrip = new EditorTabStrip();
|
||||
private final EditorDocumentPresentationRegistry presentationRegistry = new EditorDocumentPresentationRegistry();
|
||||
private final PrometeuLspService prometeuLspService;
|
||||
private final ProjectDocumentVfs projectDocumentVfs;
|
||||
private final LspService prometeuLspService;
|
||||
private final VfsProjectDocument vfsProjectDocument;
|
||||
private final EditorOpenFileSession openFileSession = new EditorOpenFileSession();
|
||||
private final List<String> activePresentationStylesheets = new ArrayList<>();
|
||||
private boolean syncingEditor;
|
||||
|
||||
public EditorWorkspace(
|
||||
final ProjectReference projectReference,
|
||||
final ProjectDocumentVfs projectDocumentVfs,
|
||||
final PrometeuLspService prometeuLspService) {
|
||||
final VfsProjectDocument vfsProjectDocument,
|
||||
final LspService prometeuLspService) {
|
||||
super(projectReference);
|
||||
this.projectDocumentVfs = Objects.requireNonNull(projectDocumentVfs, "projectDocumentVfs");
|
||||
this.vfsProjectDocument = Objects.requireNonNull(vfsProjectDocument, "vfsProjectDocument");
|
||||
this.prometeuLspService = Objects.requireNonNull(prometeuLspService, "prometeuLspService");
|
||||
root.getStyleClass().add("editor-workspace");
|
||||
codeArea.setParagraphGraphicFactory(LineNumberFactory.get(codeArea));
|
||||
@@ -93,19 +88,19 @@ public final class EditorWorkspace extends Workspace {
|
||||
public CodeArea codeArea() { return codeArea; }
|
||||
|
||||
private void refreshNavigator() {
|
||||
navigatorPanel.setSnapshot(projectDocumentVfs.refresh());
|
||||
navigatorPanel.setSnapshot(vfsProjectDocument.refresh());
|
||||
}
|
||||
|
||||
private void openNode(final VfsProjectNode node) {
|
||||
final VfsDocumentOpenResult result = projectDocumentVfs.openDocument(node.path());
|
||||
if (result instanceof VfsTextDocument textDocument) {
|
||||
final VfsDocumentOpenResult result = vfsProjectDocument.openDocument(node.path());
|
||||
if (result instanceof VfsDocumentOpenResult.VfsTextDocument textDocument) {
|
||||
openFile(textDocument);
|
||||
return;
|
||||
}
|
||||
showUnsupportedFileModal(node.path());
|
||||
}
|
||||
|
||||
private void openFile(final VfsTextDocument textDocument) {
|
||||
private void openFile(final VfsDocumentOpenResult.VfsTextDocument textDocument) {
|
||||
openFileSession.open(bufferFrom(textDocument));
|
||||
renderSession();
|
||||
}
|
||||
@@ -128,8 +123,8 @@ public final class EditorWorkspace extends Workspace {
|
||||
|
||||
final var fileBuffer = activeFile.orElseThrow();
|
||||
final EditorDocumentPresentation presentation = presentationRegistry.resolve(fileBuffer.typeId());
|
||||
final PrometeuLspAnalyzeDocumentResult analysis = fileBuffer.frontendDocument()
|
||||
? prometeuLspService.analyzeDocument(new PrometeuLspAnalyzeDocumentRequest(fileBuffer.path()))
|
||||
final LspAnalyzeDocumentResult analysis = fileBuffer.frontendDocument()
|
||||
? prometeuLspService.analyzeDocument(new LspAnalyzeDocumentRequest(fileBuffer.path()))
|
||||
: null;
|
||||
final EditorDocumentHighlightingResult highlighting = EditorDocumentHighlightingRouter.route(
|
||||
fileBuffer,
|
||||
@@ -261,7 +256,7 @@ public final class EditorWorkspace extends Workspace {
|
||||
openFileSession.activeFile()
|
||||
.filter(EditorOpenFileBuffer::editable)
|
||||
.ifPresent(activeFile -> {
|
||||
final VfsTextDocument updatedDocument = projectDocumentVfs.updateDocument(activeFile.path(), content);
|
||||
final VfsDocumentOpenResult.VfsTextDocument updatedDocument = vfsProjectDocument.updateDocument(activeFile.path(), content);
|
||||
openFileSession.open(bufferFrom(updatedDocument));
|
||||
tabStrip.showOpenFiles(
|
||||
openFileSession.openFiles(),
|
||||
@@ -274,7 +269,7 @@ public final class EditorWorkspace extends Workspace {
|
||||
openFileSession.activeFile()
|
||||
.filter(EditorOpenFileBuffer::saveEnabled)
|
||||
.ifPresent(activeFile -> {
|
||||
projectDocumentVfs.saveDocument(activeFile.path());
|
||||
vfsProjectDocument.saveDocument(activeFile.path());
|
||||
reloadOpenFilesFromVfs(activeFile.path());
|
||||
renderSession();
|
||||
});
|
||||
@@ -284,7 +279,7 @@ public final class EditorWorkspace extends Workspace {
|
||||
if (!openFileSession.hasDirtyEditableFiles()) {
|
||||
return;
|
||||
}
|
||||
projectDocumentVfs.saveAllDocuments();
|
||||
vfsProjectDocument.saveAllDocuments();
|
||||
reloadOpenFilesFromVfs(openFileSession.activeFile().map(EditorOpenFileBuffer::path).orElse(null));
|
||||
renderSession();
|
||||
}
|
||||
@@ -294,8 +289,8 @@ public final class EditorWorkspace extends Workspace {
|
||||
.map(EditorOpenFileBuffer::path)
|
||||
.toList();
|
||||
for (final var path : openPaths) {
|
||||
final var result = projectDocumentVfs.openDocument(path);
|
||||
if (result instanceof VfsTextDocument textDocument) {
|
||||
final var result = vfsProjectDocument.openDocument(path);
|
||||
if (result instanceof VfsDocumentOpenResult.VfsTextDocument textDocument) {
|
||||
openFileSession.open(bufferFrom(textDocument));
|
||||
}
|
||||
}
|
||||
@@ -312,7 +307,7 @@ public final class EditorWorkspace extends Workspace {
|
||||
readOnlyWarning.setManaged(showWarning);
|
||||
}
|
||||
|
||||
private EditorOpenFileBuffer bufferFrom(final VfsTextDocument textDocument) {
|
||||
private EditorOpenFileBuffer bufferFrom(final VfsDocumentOpenResult.VfsTextDocument textDocument) {
|
||||
return new EditorOpenFileBuffer(
|
||||
textDocument.path(),
|
||||
textDocument.documentName(),
|
||||
@@ -326,7 +321,7 @@ public final class EditorWorkspace extends Workspace {
|
||||
|
||||
private void refreshSemanticOutline(
|
||||
final EditorOpenFileBuffer fileBuffer,
|
||||
final PrometeuLspAnalyzeDocumentResult analysis) {
|
||||
final LspAnalyzeDocumentResult analysis) {
|
||||
if (!fileBuffer.frontendDocument() || analysis == null) {
|
||||
outlinePanel.showPlaceholder();
|
||||
return;
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@ package p.studio.workspaces.editor.syntaxhighlight;
|
||||
|
||||
import org.fxmisc.richtext.model.StyleSpans;
|
||||
import org.fxmisc.richtext.model.StyleSpansBuilder;
|
||||
import p.lsp.dtos.PrometeuLspHighlightSpanDTO;
|
||||
import p.studio.lsp.dtos.LspHighlightSpanDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -15,13 +15,13 @@ public final class EditorDocumentSemanticHighlighting {
|
||||
|
||||
public static StyleSpans<Collection<String>> highlight(
|
||||
final String content,
|
||||
final List<PrometeuLspHighlightSpanDTO> semanticHighlights) {
|
||||
final List<LspHighlightSpanDTO> semanticHighlights) {
|
||||
final StyleSpansBuilder<Collection<String>> builder = new StyleSpansBuilder<>();
|
||||
final List<PrometeuLspHighlightSpanDTO> orderedHighlights = semanticHighlights.stream()
|
||||
final List<LspHighlightSpanDTO> orderedHighlights = semanticHighlights.stream()
|
||||
.sorted(Comparator.comparingInt(highlight -> highlight.range().startOffset()))
|
||||
.toList();
|
||||
int cursor = 0;
|
||||
for (final PrometeuLspHighlightSpanDTO highlight : orderedHighlights) {
|
||||
for (final LspHighlightSpanDTO highlight : orderedHighlights) {
|
||||
final int start = Math.max(cursor, highlight.range().startOffset());
|
||||
final int end = Math.min(content.length(), highlight.range().endOffset());
|
||||
if (start > cursor) {
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
package p.studio.workspaces.framework;
|
||||
|
||||
import p.studio.events.StudioEvent;
|
||||
import p.studio.events.StudioEventBus;
|
||||
import p.studio.events.StudioWorkspaceEventBus;
|
||||
import p.studio.lsp.events.StudioEvent;
|
||||
import p.studio.lsp.events.StudioEventBus;
|
||||
import p.studio.lsp.events.StudioWorkspaceEventBus;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ package p.studio.controls.shell;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.packer.events.PackerEventKind;
|
||||
import p.studio.events.StudioPackerOperationEvent;
|
||||
import p.studio.events.StudioProjectOpenedEvent;
|
||||
import p.studio.lsp.events.StudioPackerOperationEvent;
|
||||
import p.studio.lsp.events.StudioProjectOpenedEvent;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetsWorkspaceRefreshFailedEvent;
|
||||
import p.studio.workspaces.assets.messages.events.StudioAssetsWorkspaceRefreshedEvent;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.packer.events.PackerEvent;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package p.studio.events;
|
||||
package p.studio.lsp.events;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.studio.workspaces.WorkspaceId;
|
||||
+29
-29
@@ -1,21 +1,21 @@
|
||||
package p.studio.projectsessions;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.lsp.PrometeuLspProjectContext;
|
||||
import p.lsp.PrometeuLspService;
|
||||
import p.lsp.PrometeuLspServiceFactory;
|
||||
import p.lsp.dtos.PrometeuLspSessionStateDTO;
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentRequest;
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentResult;
|
||||
import p.lsp.messages.PrometeuLspDefinitionRequest;
|
||||
import p.lsp.messages.PrometeuLspDefinitionResult;
|
||||
import p.studio.lsp.messages.LspProjectContext;
|
||||
import p.studio.lsp.LspService;
|
||||
import p.studio.lsp.LspServiceFactory;
|
||||
import p.studio.lsp.dtos.LspSessionStateDTO;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentRequest;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentResult;
|
||||
import p.studio.lsp.messages.LspDefinitionRequest;
|
||||
import p.studio.lsp.messages.LspDefinitionResult;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.vfs.ProjectDocumentVfs;
|
||||
import p.studio.vfs.VfsProjectDocument;
|
||||
import p.studio.vfs.ProjectDocumentVfsFactory;
|
||||
import p.studio.vfs.VfsDocumentOpenResult;
|
||||
import p.studio.vfs.VfsProjectContext;
|
||||
import p.studio.vfs.VfsProjectSnapshot;
|
||||
import p.studio.vfs.VfsRefreshRequest;
|
||||
import p.studio.vfs.messages.VfsProjectContext;
|
||||
import p.studio.vfs.messages.VfsProjectSnapshot;
|
||||
import p.studio.vfs.messages.VfsRefreshRequest;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
@@ -50,31 +50,31 @@ final class StudioProjectSessionFactoryTest {
|
||||
|
||||
private static final class RecordingVfsFactory implements ProjectDocumentVfsFactory {
|
||||
private VfsProjectContext capturedContext;
|
||||
private final ProjectDocumentVfs vfs = new NoOpProjectDocumentVfs();
|
||||
private final VfsProjectDocument vfs = new NoOpVfsProjectDocument();
|
||||
|
||||
@Override
|
||||
public ProjectDocumentVfs open(VfsProjectContext projectContext) {
|
||||
public VfsProjectDocument open(VfsProjectContext projectContext) {
|
||||
this.capturedContext = projectContext;
|
||||
return vfs;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class RecordingLspFactory implements PrometeuLspServiceFactory {
|
||||
private PrometeuLspProjectContext capturedContext;
|
||||
private ProjectDocumentVfs capturedVfs;
|
||||
private final PrometeuLspService service = new NoOpPrometeuLspService();
|
||||
private static final class RecordingLspFactory implements LspServiceFactory {
|
||||
private LspProjectContext capturedContext;
|
||||
private VfsProjectDocument capturedVfs;
|
||||
private final LspService service = new NoOpPrometeuLspService();
|
||||
|
||||
@Override
|
||||
public PrometeuLspService open(
|
||||
final PrometeuLspProjectContext projectContext,
|
||||
final ProjectDocumentVfs projectDocumentVfs) {
|
||||
public LspService open(
|
||||
final LspProjectContext projectContext,
|
||||
final VfsProjectDocument vfsProjectDocument) {
|
||||
this.capturedContext = projectContext;
|
||||
this.capturedVfs = projectDocumentVfs;
|
||||
this.capturedVfs = vfsProjectDocument;
|
||||
return service;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class NoOpProjectDocumentVfs implements ProjectDocumentVfs {
|
||||
private static final class NoOpVfsProjectDocument implements VfsProjectDocument {
|
||||
@Override
|
||||
public VfsProjectContext projectContext() {
|
||||
throw new UnsupportedOperationException();
|
||||
@@ -101,29 +101,29 @@ final class StudioProjectSessionFactoryTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static final class NoOpPrometeuLspService implements PrometeuLspService {
|
||||
private static final class NoOpPrometeuLspService implements LspService {
|
||||
@Override
|
||||
public PrometeuLspProjectContext projectContext() {
|
||||
public LspProjectContext projectContext() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectDocumentVfs projectDocumentVfs() {
|
||||
public VfsProjectDocument projectDocumentVfs() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrometeuLspSessionStateDTO snapshot() {
|
||||
public LspSessionStateDTO snapshot() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrometeuLspAnalyzeDocumentResult analyzeDocument(final PrometeuLspAnalyzeDocumentRequest request) {
|
||||
public LspAnalyzeDocumentResult analyzeDocument(final LspAnalyzeDocumentRequest request) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrometeuLspDefinitionResult definition(final PrometeuLspDefinitionRequest request) {
|
||||
public LspDefinitionResult definition(final LspDefinitionRequest request) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
+23
-23
@@ -1,19 +1,19 @@
|
||||
package p.studio.projectsessions;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.lsp.PrometeuLspProjectContext;
|
||||
import p.lsp.PrometeuLspService;
|
||||
import p.lsp.dtos.PrometeuLspSessionStateDTO;
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentRequest;
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentResult;
|
||||
import p.lsp.messages.PrometeuLspDefinitionRequest;
|
||||
import p.lsp.messages.PrometeuLspDefinitionResult;
|
||||
import p.studio.lsp.messages.LspProjectContext;
|
||||
import p.studio.lsp.LspService;
|
||||
import p.studio.lsp.dtos.LspSessionStateDTO;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentRequest;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentResult;
|
||||
import p.studio.lsp.messages.LspDefinitionRequest;
|
||||
import p.studio.lsp.messages.LspDefinitionResult;
|
||||
import p.studio.projects.ProjectReference;
|
||||
import p.studio.vfs.ProjectDocumentVfs;
|
||||
import p.studio.vfs.VfsProjectDocument;
|
||||
import p.studio.vfs.VfsDocumentOpenResult;
|
||||
import p.studio.vfs.VfsProjectContext;
|
||||
import p.studio.vfs.VfsProjectSnapshot;
|
||||
import p.studio.vfs.VfsRefreshRequest;
|
||||
import p.studio.vfs.messages.VfsProjectContext;
|
||||
import p.studio.vfs.messages.VfsProjectSnapshot;
|
||||
import p.studio.vfs.messages.VfsRefreshRequest;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
@@ -22,7 +22,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
final class StudioProjectSessionTest {
|
||||
@Test
|
||||
void closeDelegatesToUnderlyingServicesOnlyOnce() {
|
||||
final CountingProjectDocumentVfs vfs = new CountingProjectDocumentVfs();
|
||||
final CountingVfsProjectDocument vfs = new CountingVfsProjectDocument();
|
||||
final CountingPrometeuLspService lsp = new CountingPrometeuLspService(vfs);
|
||||
final StudioProjectSession session = new StudioProjectSession(projectReference(), lsp, vfs);
|
||||
|
||||
@@ -37,7 +37,7 @@ final class StudioProjectSessionTest {
|
||||
return new ProjectReference("Example", "1.0.0", "pbs", 1, Path.of("/tmp/example"));
|
||||
}
|
||||
|
||||
private static final class CountingProjectDocumentVfs implements ProjectDocumentVfs {
|
||||
private static final class CountingVfsProjectDocument implements VfsProjectDocument {
|
||||
private int closeCalls;
|
||||
|
||||
@Override
|
||||
@@ -71,36 +71,36 @@ final class StudioProjectSessionTest {
|
||||
}
|
||||
}
|
||||
|
||||
private static final class CountingPrometeuLspService implements PrometeuLspService {
|
||||
private final ProjectDocumentVfs projectDocumentVfs;
|
||||
private static final class CountingPrometeuLspService implements LspService {
|
||||
private final VfsProjectDocument vfsProjectDocument;
|
||||
private int closeCalls;
|
||||
|
||||
private CountingPrometeuLspService(final ProjectDocumentVfs projectDocumentVfs) {
|
||||
this.projectDocumentVfs = projectDocumentVfs;
|
||||
private CountingPrometeuLspService(final VfsProjectDocument vfsProjectDocument) {
|
||||
this.vfsProjectDocument = vfsProjectDocument;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrometeuLspProjectContext projectContext() {
|
||||
public LspProjectContext projectContext() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProjectDocumentVfs projectDocumentVfs() {
|
||||
return projectDocumentVfs;
|
||||
public VfsProjectDocument projectDocumentVfs() {
|
||||
return vfsProjectDocument;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrometeuLspSessionStateDTO snapshot() {
|
||||
public LspSessionStateDTO snapshot() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrometeuLspAnalyzeDocumentResult analyzeDocument(final PrometeuLspAnalyzeDocumentRequest request) {
|
||||
public LspAnalyzeDocumentResult analyzeDocument(final LspAnalyzeDocumentRequest request) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrometeuLspDefinitionResult definition(final PrometeuLspDefinitionRequest request) {
|
||||
public LspDefinitionResult definition(final LspDefinitionRequest request) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
+11
-11
@@ -1,11 +1,11 @@
|
||||
package p.studio.workspaces.editor;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.lsp.dtos.PrometeuLspHighlightSpanDTO;
|
||||
import p.lsp.dtos.PrometeuLspRangeDTO;
|
||||
import p.lsp.dtos.PrometeuLspSessionStateDTO;
|
||||
import p.lsp.messages.PrometeuLspAnalyzeDocumentResult;
|
||||
import p.studio.vfs.VfsDocumentAccessMode;
|
||||
import p.studio.lsp.dtos.LspHighlightSpanDTO;
|
||||
import p.studio.lsp.dtos.LspRangeDTO;
|
||||
import p.studio.lsp.dtos.LspSessionStateDTO;
|
||||
import p.studio.lsp.messages.LspAnalyzeDocumentResult;
|
||||
import p.studio.vfs.messages.VfsDocumentAccessMode;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
@@ -26,10 +26,10 @@ final class EditorDocumentHighlightingRouterTest {
|
||||
VfsDocumentAccessMode.READ_ONLY,
|
||||
false);
|
||||
|
||||
final PrometeuLspAnalyzeDocumentResult analysis = new PrometeuLspAnalyzeDocumentResult(
|
||||
new PrometeuLspSessionStateDTO(true, List.of("highlight")),
|
||||
final LspAnalyzeDocumentResult analysis = new LspAnalyzeDocumentResult(
|
||||
new LspSessionStateDTO(true, List.of("highlight")),
|
||||
List.of(),
|
||||
List.of(new PrometeuLspHighlightSpanDTO(new PrometeuLspRangeDTO(0, 2), "fe-keyword")),
|
||||
List.of(new LspHighlightSpanDTO(new LspRangeDTO(0, 2), "fe-keyword")),
|
||||
List.of(),
|
||||
List.of());
|
||||
|
||||
@@ -54,10 +54,10 @@ final class EditorDocumentHighlightingRouterTest {
|
||||
VfsDocumentAccessMode.EDITABLE,
|
||||
false);
|
||||
|
||||
final PrometeuLspAnalyzeDocumentResult analysis = new PrometeuLspAnalyzeDocumentResult(
|
||||
new PrometeuLspSessionStateDTO(true, List.of("highlight")),
|
||||
final LspAnalyzeDocumentResult analysis = new LspAnalyzeDocumentResult(
|
||||
new LspSessionStateDTO(true, List.of("highlight")),
|
||||
List.of(),
|
||||
List.of(new PrometeuLspHighlightSpanDTO(new PrometeuLspRangeDTO(0, 1), "fe-punctuation")),
|
||||
List.of(new LspHighlightSpanDTO(new LspRangeDTO(0, 1), "fe-punctuation")),
|
||||
List.of(),
|
||||
List.of());
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package p.studio.workspaces.editor;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.studio.vfs.VfsDocumentAccessMode;
|
||||
import p.studio.vfs.messages.VfsDocumentAccessMode;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user