implements PLN-0069
This commit is contained in:
+16
@@ -8,6 +8,7 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class CompilerLanguageServiceBridgeTest {
|
||||
@@ -55,6 +56,21 @@ class CompilerLanguageServiceBridgeTest {
|
||||
assertTrue(semanticTokens.tokens().stream().anyMatch(token -> token.semanticKey().equals("pbs-number")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void describeServerPublishesFrontendVisualThemes() {
|
||||
final CompilerLanguageServiceBridge bridge = new CompilerLanguageServiceBridge();
|
||||
|
||||
final var description = bridge.describeServer(new LspProjectContext("main", "pbs", Path.of(".")));
|
||||
|
||||
assertEquals("pbs-default", description.activeVisualThemeId());
|
||||
assertEquals(1, description.visualThemes().size());
|
||||
assertEquals("PBS Default", description.visualThemes().getFirst().displayName());
|
||||
assertEquals("#d9e2ec", description.visualThemes().getFirst().editorPalette().baseForeground());
|
||||
assertTrue(description.visualThemes().getFirst().tokenStyles().stream()
|
||||
.anyMatch(tokenStyle -> tokenStyle.semanticKey().equals("pbs-keyword")
|
||||
&& tokenStyle.foreground().equals("#569cd6")));
|
||||
}
|
||||
|
||||
private Path findRepoRoot(final Path start) {
|
||||
var current = start;
|
||||
while (current != null) {
|
||||
|
||||
+14
-1
@@ -12,9 +12,12 @@ import org.eclipse.lsp4j.services.LanguageClient;
|
||||
import org.eclipse.lsp4j.services.TextDocumentService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import p.studio.lsp.messages.BaselineDocumentAnalysis;
|
||||
import p.studio.lsp.messages.BaselineEditorPalette;
|
||||
import p.studio.lsp.messages.BaselineHover;
|
||||
import p.studio.lsp.messages.BaselineSemanticTokens;
|
||||
import p.studio.lsp.messages.BaselineServerDescription;
|
||||
import p.studio.lsp.messages.BaselineTokenStyle;
|
||||
import p.studio.lsp.messages.BaselineVisualTheme;
|
||||
import p.studio.lsp.messages.LspProjectContext;
|
||||
import p.studio.lsp.services.LanguageServiceBridge;
|
||||
import p.studio.lsp.services.protocol.mapping.ProtocolMessageMapper;
|
||||
@@ -79,7 +82,17 @@ class PrometeuLanguageServerTest {
|
||||
|
||||
private static final class RecordingBridge implements LanguageServiceBridge {
|
||||
private int describeServerCalls;
|
||||
private final BaselineServerDescription serverDescription = new BaselineServerDescription("demo", "1", true, List.of());
|
||||
private final BaselineServerDescription serverDescription = new BaselineServerDescription(
|
||||
"demo",
|
||||
"1",
|
||||
true,
|
||||
List.of(),
|
||||
List.of(new BaselineVisualTheme(
|
||||
"demo-default",
|
||||
"Demo Default",
|
||||
new BaselineEditorPalette("#111111", "#222222", "#333333", "#444444", "#555555", "#666666", "#777777"),
|
||||
List.of(new BaselineTokenStyle("demo-keyword", "#888888", false, false, false)))),
|
||||
"demo-default");
|
||||
|
||||
@Override
|
||||
public BaselineServerDescription describeServer(final LspProjectContext project) {
|
||||
|
||||
Reference in New Issue
Block a user