Skip to content

Commit 1c99b5e

Browse files
committed
fix: align cross-editor symbol identities
1 parent ea696b4 commit 1c99b5e

10 files changed

Lines changed: 64 additions & 21 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Context normally adds formatting without replacing a symbol's identity color:
6060
- A reassigned variable or parameter gains an underline but keeps its foreground.
6161
- Static members are italic; instance members are not.
6262
- Inspection results add their underline, wave, border, or background over the existing syntax colors.
63-
- Read-only and other contextual distinctions may use bold or italic where the editor exposes them reliably.
63+
- Constancy does not change variable or field formatting.
6464

6565
A captured Java variable is a useful boundary case. A method parameter is blue in the enclosing method, but IntelliJ presents its use inside a lambda as a neutral field-like capture. Its semantic role has changed: the generated lambda object effectively carries that value as state.
6666

docs/releases/1.3.2.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Invariant 1.3.2
2+
3+
This release aligns JavaScript and JSON symbol identities across the IntelliJ and
4+
Visual Studio Code themes.
5+
6+
## IntelliJ
7+
8+
- JavaScript local and global variables now use the warm-neutral variable color
9+
instead of inherited Darcula and Islands colors.
10+
- Resolved JavaScript instance methods now use function green instead of
11+
parameter-like blue.
12+
- Each JavaScript key resets to its exact fallback declared by IntelliJ. Missing
13+
libraries may still prevent the IDE from identifying imported types or member
14+
methods semantically.
15+
16+
## Visual Studio Code
17+
18+
- JSON, JSON with Comments, and JSON Lines property names now use the neutral
19+
variable/property color instead of type cyan.
20+
- Read-only semantic tokens no longer become bold, so local `const` and `let`
21+
variables keep the same identity styling.
22+
23+
The JetBrains ZIP and Visual Studio Code VSIX are attached to this release. Vim
24+
and Neovim package managers can install the `invariant-v1.3.2` tag directly.

docs/research/intellij-language-color-inheritance.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ backgrounds.
119119

120120
For Python, type annotations fall back to `DEFAULT_IDENTIFIER` and are left to do so, which is why a type hint reads as neutral text. Python 3.12 type parameters fall back to `DEFAULT_PARAMETER` rather than Java's `TYPE_PARAMETER_NAME_ATTRIBUTES`, so they are pinned to the type-parameter orange explicitly. The plugin's remaining syntax, function, class, parameter, local-variable, decorator, and punctuation keys already fall back to the corresponding Language Defaults.
121121

122+
JavaScript's bundled Darcula fragment overrides `JS.LOCAL_VARIABLE`,
123+
`JS.GLOBAL_VARIABLE`, and `JS.INSTANCE_MEMBER_FUNCTION`. IntelliJ source declares their
124+
fallbacks as `DEFAULT_LOCAL_VARIABLE`, `DEFAULT_GLOBAL_VARIABLE`, and
125+
`DEFAULT_INSTANCE_METHOD`, respectively. Invariant resets each key with that exact declared
126+
`baseAttributes` value, clearing the parent override without trying to redirect inheritance.
127+
Locals and globals therefore render warm neutral, while resolved instance methods render green.
128+
When a reference cannot resolve because its library is missing, the JavaScript highlighter may
129+
guess a variable or member category instead; a color scheme cannot recover the missing identity.
130+
122131
Known debt: pale blue `#bed6ff` carries two meanings. It marks signature-only methods
123132
(`ABSTRACT_METHOD_ATTRIBUTES`, `INHERITED_METHOD_ATTRIBUTES`) and also runtime built-ins
124133
(`PY.BUILTIN_NAME`, `BASH.EXTERNAL_COMMAND`, `CSS.FUNCTION`), and the Visual Studio Code and

jetbrains/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = "com.github.andrebrait"
8-
version = providers.environmentVariable("PLUGIN_VERSION").orElse("1.3.1").get()
8+
version = providers.environmentVariable("PLUGIN_VERSION").orElse("1.3.2").get()
99

1010
repositories {
1111
mavenCentral()

jetbrains/invariant.icls

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -826,17 +826,9 @@
826826
<option name="FOREGROUND" value="9c9cff" />
827827
</value>
828828
</option>
829-
<option name="JS.INSTANCE_MEMBER_FUNCTION">
830-
<value>
831-
<option name="FOREGROUND" value="56a8f5" />
832-
</value>
833-
</option>
834-
<option name="JS.GLOBAL_VARIABLE">
835-
<value>
836-
<option name="FOREGROUND" value="c77dba" />
837-
<option name="FONT_TYPE" value="2" />
838-
</value>
839-
</option>
829+
<option name="JS.INSTANCE_MEMBER_FUNCTION" baseAttributes="DEFAULT_INSTANCE_METHOD" />
830+
<option name="JS.GLOBAL_VARIABLE" baseAttributes="DEFAULT_GLOBAL_VARIABLE" />
831+
<option name="JS.LOCAL_VARIABLE" baseAttributes="DEFAULT_LOCAL_VARIABLE" />
840832
<option name="JS.GLOBAL_FUNCTION" baseAttributes="DEFAULT_FUNCTION_DECLARATION" />
841833
<option name="KOTLIN_COLON">
842834
<value>

jetbrains/src/main/resources/META-INF/plugin.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
<description><![CDATA[
77
<p>Invariant is a semantic dark editor color scheme based on Monokai.</p>
88
<p>Color identifies what a symbol is; formatting shows how it is being used. Common code stays relatively quiet, while types, parameters, methods, reserved names, annotations, and comments remain easy to find.</p>
9-
<p>The scheme provides explicit coverage for Java, Kotlin, Python, CSS, and shell scripts, with Language Defaults for other supported languages.</p>
9+
<p>The scheme provides explicit coverage for Java, Kotlin, JavaScript, Python, CSS, and shell scripts, with Language Defaults for other supported languages.</p>
1010
]]></description>
1111

1212
<change-notes><![CDATA[
13-
<p>Fixes the plugin so its color scheme appears in the IDE.</p>
13+
<p>Aligns JavaScript semantic colors with Invariant's cross-editor identity model.</p>
1414
<ul>
15-
<li>Invariant named Islands Dark as its parent scheme. That scheme is contributed by a plugin and is absent unless the Islands UI is active, so the IDE discarded Invariant on load and it never appeared under Settings | Editor | Color Scheme.</li>
16-
<li>The scheme now inherits from Darcula and defines every color and attribute it previously inherited, so its appearance is unchanged.</li>
15+
<li>Local and global variables now use the neutral variable color instead of inherited Darcula and Islands colors.</li>
16+
<li>Resolved instance methods now use function green instead of parameter-like blue.</li>
1717
</ul>
1818
]]></change-notes>
1919

scripts/check.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,21 @@ const functionScopes = theme.tokenColors.find(rule => rule.name === 'Functions a
2828
assert.ok(!functionScopes.includes('meta.function-call'));
2929
assert.ok(functionScopes.includes('meta.function-call.generic.python'));
3030
assert.equal(theme.semanticTokenColors.variable, theme.semanticTokenColors.property);
31+
const propertyRule = theme.tokenColors.find(rule => rule.name === 'Variables and properties');
32+
assert.equal(propertyRule.settings.foreground, theme.semanticTokenColors.property);
33+
for (const scope of [
34+
'support.type.property-name.json',
35+
'support.type.property-name.json.comments',
36+
'support.type.property-name.json.lines'
37+
]) {
38+
assert.ok(propertyRule.scope.includes(scope));
39+
}
3140
assert.equal(theme.semanticTokenColors.parameter, '#79abff');
3241
assert.deepEqual(theme.semanticTokenColors.selfParameter, { foreground: '#ff007f', bold: true });
3342
assert.deepEqual(theme.semanticTokenColors.clsParameter, { foreground: '#ff007f', bold: true });
3443
assert.deepEqual(theme.semanticTokenColors['*.modification'], { underline: true });
3544
assert.deepEqual(theme.semanticTokenColors['*.static'], { italic: true });
45+
assert.ok(!Object.hasOwn(theme.semanticTokenColors, '*.readonly'));
3646
assert.equal(theme.tokenColors.find(rule => rule.name === 'Comments').settings.foreground, '#ffffff');
3747
assert.deepEqual(theme.tokenColors.find(rule => rule.name === 'Python self and cls').settings, {
3848
foreground: '#ff007f',
@@ -138,6 +148,9 @@ for (const pythonModule of ['namespace:python', 'module:python']) {
138148
['DEFAULT_INSTANCE_METHOD', 'DEFAULT_FUNCTION_DECLARATION'],
139149
['DEFAULT_LABEL', 'DEFAULT_IDENTIFIER'],
140150
['DEFAULT_LOCAL_VARIABLE', 'DEFAULT_IDENTIFIER'],
151+
['JS.GLOBAL_VARIABLE', 'DEFAULT_GLOBAL_VARIABLE'],
152+
['JS.INSTANCE_MEMBER_FUNCTION', 'DEFAULT_INSTANCE_METHOD'],
153+
['JS.LOCAL_VARIABLE', 'DEFAULT_LOCAL_VARIABLE'],
141154
['PY.ANNOTATION', 'DEFAULT_IDENTIFIER'],
142155
['PY.STRING.B', 'DEFAULT_STRING'],
143156
['STATIC_METHOD_ATTRIBUTES', 'DEFAULT_STATIC_METHOD'],

vscode/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 1.3.2
4+
5+
- JSON, JSON with Comments, and JSON Lines property names now use the neutral variable/property color instead of type cyan, matching IntelliJ's field styling.
6+
- Read-only semantic tokens no longer become bold, so a local `const` keeps the same variable styling as a local `let`.
7+
38
## 1.3.1
49

510
- The JetBrains plugin now installs a color scheme the IDE can actually load. It named Islands Dark as its parent scheme, which is contributed by a plugin and is absent unless the Islands UI is active, so IntelliJ discarded the scheme on load and Invariant never appeared under Settings | Editor | Color Scheme. The scheme now inherits from Darcula and spells out every color and attribute it had been inheriting, leaving its appearance unchanged.

vscode/invariant-color-theme.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@
432432
"scope": [
433433
"variable",
434434
"meta.object-literal.key",
435+
"support.type.property-name.json",
436+
"support.type.property-name.json.comments",
437+
"support.type.property-name.json.lines",
435438
"support.variable"
436439
],
437440
"settings": {
@@ -636,9 +639,6 @@
636639
"foreground": "#ff007f",
637640
"bold": true
638641
},
639-
"*.readonly": {
640-
"bold": true
641-
},
642642
"*.modification": {
643643
"underline": true
644644
},

vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "invariant-colors",
33
"displayName": "Invariant",
44
"description": "A semantic dark editor theme based on Monokai, where color identifies what a symbol is and formatting shows how it is used.",
5-
"version": "1.3.1",
5+
"version": "1.3.2",
66
"publisher": "andrebrait",
77
"license": "EPL-2.0",
88
"repository": {

0 commit comments

Comments
 (0)