Highlight color adjustments
This commit is contained in:
+63
-3
@@ -23,9 +23,19 @@ final class PbsSemanticPresentationContractTest {
|
||||
assertEquals(1, presentation.themes().size());
|
||||
assertEquals("PBS Default", presentation.defaultTheme().displayName());
|
||||
assertEquals("#d9e2ec", presentation.defaultTheme().editorPalette().baseForeground());
|
||||
assertEquals("#d2a8ff", presentation.defaultTheme().requireTokenStyle("pbs-keyword").foreground());
|
||||
assertEquals("#7fb8ff", presentation.defaultTheme().requireTokenStyle("pbs-keyword").foreground());
|
||||
assertEquals("#d8b86a", presentation.defaultTheme().requireTokenStyle("pbs-string").foreground());
|
||||
assertEquals("#ff8cc6", presentation.defaultTheme().requireTokenStyle("pbs-number").foreground());
|
||||
assertEquals("#7fb8ff", presentation.defaultTheme().requireTokenStyle("pbs-literal").foreground());
|
||||
assertEquals("#7ee787", presentation.defaultTheme().requireTokenStyle("pbs-function").foreground());
|
||||
assertEquals("#7ee787", presentation.defaultTheme().requireTokenStyle("pbs-method").foreground());
|
||||
assertEquals("#7ee787", presentation.defaultTheme().requireTokenStyle("pbs-constructor").foreground());
|
||||
assertEquals("#56d4dd", presentation.defaultTheme().requireTokenStyle("pbs-struct").foreground());
|
||||
assertTrue(presentation.defaultTheme().requireTokenStyle("pbs-struct").italic());
|
||||
assertEquals("#56d4dd", presentation.defaultTheme().requireTokenStyle("pbs-builtin-type").foreground());
|
||||
assertFalse(presentation.defaultTheme().requireTokenStyle("pbs-builtin-type").italic());
|
||||
assertEquals("#ff8e7a", presentation.defaultTheme().requireTokenStyle("pbs-service").foreground());
|
||||
assertTrue(presentation.defaultTheme().requireTokenStyle("pbs-builtin-type").italic());
|
||||
assertEquals("#c297ff", presentation.defaultTheme().requireTokenStyle("pbs-asset").foreground());
|
||||
assertTrue(presentation.defaultTheme().requireTokenStyle("pbs-comment").italic());
|
||||
assertEquals(PBSFrontendHostProjections.VSCODE_HOST_ID, presentation.requireHostProjection("vscode").hostId());
|
||||
}
|
||||
@@ -50,6 +60,7 @@ final class PbsSemanticPresentationContractTest {
|
||||
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("variable", vscodeProjection.requireProjection(PbsSemanticKind.ASSET.semanticKey()).hostTokenType());
|
||||
assertEquals(
|
||||
java.util.List.of("readonly"),
|
||||
vscodeProjection.requireProjection(PbsSemanticKind.GLOBAL.semanticKey()).hostTokenModifiers());
|
||||
@@ -73,7 +84,7 @@ final class PbsSemanticPresentationContractTest {
|
||||
}
|
||||
""");
|
||||
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.STRUCT.semanticKey())));
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.BUILTIN_TYPE.semanticKey())));
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.FUNCTION.semanticKey())));
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.CONST.semanticKey())));
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.BUILTIN_TYPE.semanticKey())));
|
||||
@@ -83,4 +94,53 @@ final class PbsSemanticPresentationContractTest {
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.HOST.semanticKey())));
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.ENUM.semanticKey())));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldClassifyStdlibImportsUsingTheirPublishedBarrelKinds() {
|
||||
final List<FrontendSemanticToken> semanticTokens = PBSDefinitions.PBS.getSemanticTokenProvider().tokenize("""
|
||||
import { Log } from @sdk:log;
|
||||
import { Composer } from @sdk:composer;
|
||||
import { Color as Paint } from @core:color;
|
||||
|
||||
fn main() -> void {
|
||||
Log.info("hello");
|
||||
Composer.emit_sprite(0, 0, 0, 0, 0, 0, false, false, 0);
|
||||
let paint: Paint;
|
||||
}
|
||||
""");
|
||||
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.SERVICE.semanticKey())));
|
||||
assertTrue(semanticTokens.stream().anyMatch(token -> token.semanticKey().equals(PbsSemanticKind.BUILTIN_TYPE.semanticKey())));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldClassifyAssetRootedAliasesUsingDedicatedSemanticKind() {
|
||||
final List<FrontendSemanticToken> semanticTokens = PBSDefinitions.PBS.getSemanticTokenProvider().tokenize("""
|
||||
import { Assets } from @sdk:asset;
|
||||
|
||||
fn main() -> void {
|
||||
Assets.load(assets.ui.atlas2, 3);
|
||||
}
|
||||
""");
|
||||
|
||||
final long assetTokenCount = semanticTokens.stream()
|
||||
.filter(token -> token.semanticKey().equals(PbsSemanticKind.ASSET.semanticKey()))
|
||||
.count();
|
||||
|
||||
assertEquals(3, assetTokenCount);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldClassifyBuiltinTypesExposedByImportedStdlibModules() {
|
||||
final List<FrontendSemanticToken> semanticTokens = PBSDefinitions.PBS.getSemanticTokenProvider().tokenize("""
|
||||
import { Input } from @sdk:input;
|
||||
|
||||
fn main() -> void {
|
||||
let touch : InputTouch = Input.touch();
|
||||
let pad : InputPad = Input.pad();
|
||||
}
|
||||
""");
|
||||
|
||||
assertTrue(semanticTokens.stream().filter(token -> token.semanticKey().equals(PbsSemanticKind.BUILTIN_TYPE.semanticKey())).count() >= 2);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user