implements PLN-0072

This commit is contained in:
2026-05-06 15:24:21 +01:00
parent cab0e92e60
commit 9d75f2f0e2
9 changed files with 330 additions and 7 deletions
@@ -1,6 +1,7 @@
package p.studio.compiler.pbs;
import org.junit.jupiter.api.Test;
import p.studio.compiler.PBSFrontendHostProjections;
import p.studio.compiler.PBSDefinitions;
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -21,6 +22,7 @@ final class PbsSemanticPresentationContractTest {
assertEquals("#d9e2ec", presentation.defaultTheme().editorPalette().baseForeground());
assertEquals("#569cd6", presentation.defaultTheme().requireTokenStyle("pbs-keyword").foreground());
assertTrue(presentation.defaultTheme().requireTokenStyle("pbs-comment").italic());
assertEquals(PBSFrontendHostProjections.VSCODE_HOST_ID, presentation.requireHostProjection("vscode").hostId());
}
@Test
@@ -32,4 +34,19 @@ final class PbsSemanticPresentationContractTest {
PbsSemanticKind.semanticKeys(),
defaultTheme.tokenStyles().stream().map(tokenStyle -> tokenStyle.semanticKey()).toList());
}
@Test
void shouldCoverTheWholePbsSemanticVocabularyInTheVscodeProjection() {
final var presentation = PBSDefinitions.PBS.getSemanticPresentation();
final var vscodeProjection = presentation.requireHostProjection(PBSFrontendHostProjections.VSCODE_HOST_ID);
assertEquals(
PbsSemanticKind.semanticKeys(),
vscodeProjection.tokenProjections().stream().map(tokenProjection -> tokenProjection.semanticKey()).toList());
assertEquals("keyword", vscodeProjection.requireProjection(PbsSemanticKind.KEYWORD.semanticKey()).hostTokenType());
assertEquals("type", vscodeProjection.requireProjection(PbsSemanticKind.STRUCT.semanticKey()).fallbackTokenType());
assertEquals(
java.util.List.of("readonly"),
vscodeProjection.requireProjection(PbsSemanticKind.GLOBAL.semanticKey()).hostTokenModifiers());
}
}