From 5370a0d74d90799ca010d308d54330283116ca5e Mon Sep 17 00:00:00 2001 From: _ov4 Date: Wed, 28 Oct 2026 13:38:39 +0000 Subject: feat(editor): highlight default return modifiers Co-Authored-By: Claude Opus 5.5 --- plugin/syntaxes/cie-pseudocode.tmLanguage.json | 7 +++++-- plugin/test/highlighting.test.js | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/syntaxes/cie-pseudocode.tmLanguage.json b/plugin/syntaxes/cie-pseudocode.tmLanguage.json index 14ef33c..ef8146f 100644 --- a/plugin/syntaxes/cie-pseudocode.tmLanguage.json +++ b/plugin/syntaxes/cie-pseudocode.tmLanguage.json @@ -139,12 +139,15 @@ } }, "return_type": { - "match": "(?[A-Za-z_][A-Za-z0-9_]*(?:\\s*<\\s*\\g(?:\\s*,\\s*\\g)*\\s*>)?(?:\\s*\\.\\.\\.)?))", + "match": "(?[A-Za-z_][A-Za-z0-9_]*(?:\\s*<\\s*\\g(?:\\s*,\\s*\\g)*\\s*>)?(?:\\s*\\.\\.\\.)?))", "captures": { "1": { "name": "storage.modifier.cie-pseudocode" }, "2": { + "name": "storage.modifier.cpp" + }, + "3": { "patterns": [ { "include": "#type_tokens" @@ -477,7 +480,7 @@ "name": "keyword.other.operator.overload.cpp" }, { - "match": "(? { + for (const [text, names] of [ + ['OVERLOAD FUNCTION Foo(X : STRING) RETURNS DEFAULT REAL', ['REAL']], + ['PUBLIC OVERLOAD FUNCTION Foo() RETURNS DEFAULT Box>', ['Box', 'Pair', 'Widget', 'REAL']] + ]) { + assert.ok(scopesAt(text, 'DEFAULT').includes('storage.modifier.cpp')); + assert.ok(!scopesAt(text, 'DEFAULT').includes('entity.name.type.cpp')); + for (const name of names) { + assert.ok(scopesAt(text, name).some(s => /^(entity\.name\.type|storage\.type)\./.test(s)), `${text}: ${name}`); + } + } + assert.ok(!scopesAt('OUTPUT "DEFAULT"', 'DEFAULT').includes('storage.modifier.cpp')); + assert.ok(!scopesAt('// DEFAULT', 'DEFAULT').includes('storage.modifier.cpp')); + assert.ok(!scopesAt('default()', 'default').includes('storage.modifier.cpp')); +}); + test('types are recognized in declarations, signatures, arrays, aliases, constructors and templates', () => { for (const [text, names] of [ ['TYPE Student', ['Student']], -- cgit v1.3.1-4-g156e