From 3d03ca5864f231f89d6b0b4c44f41275a8b93bf4 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 08:00:16 +0000 Subject: fix(plugin): use C++ assignment highlighting for the arrow operator Co-Authored-By: Claude Fable 5.1 --- plugin/test/highlighting.test.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'plugin/test') diff --git a/plugin/test/highlighting.test.js b/plugin/test/highlighting.test.js index 89e031a..24751bf 100644 --- a/plugin/test/highlighting.test.js +++ b/plugin/test/highlighting.test.js @@ -36,7 +36,7 @@ test('C++ style scopes distinguish keywords, types, literals, operators and buil ['X <- TRUE', 'TRUE', 'constant.language'], ['X <- 12.5', '12.5', 'constant.numeric'], ['X <- 2 DIV 1', 'DIV', 'keyword.operator.word'], - ['X <- 1', '<-', 'keyword.operator'], + ['X <- 1', '<-', 'keyword.operator.assignment.cpp'], ['OUTPUT "text"', 'text', 'string.quoted.double'], ["X <- 'A'", 'A', 'string.quoted.single'] ]) assert.ok(scopesAt(text, word).some(s => s.startsWith(scope)), text); @@ -46,6 +46,13 @@ test('C++ style scopes distinguish keywords, types, literals, operators and buil } }); +test('both assignment characters share the C++ assignment scope', () => { + const text = 'X <- 1'; + assert.deepEqual(scopesAt(text, '<-'), scopesAt(text, '-')); + assert.ok(!scopesAt('X < 1', '<').includes('keyword.operator.assignment.cpp')); + assert.ok(!scopesAt('X - 1', '-').includes('keyword.operator.assignment.cpp')); +}); + test('comments, strings, lowercase and keyword prefixes cannot become keywords', () => { assert.ok(scopesAt('// IF [(', 'IF').some(s => s.startsWith('comment.'))); assert.ok(scopesAt('OUTPUT "IF // ["', 'IF').some(s => s.startsWith('string.'))); -- cgit v1.3.1-4-g156e