Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 29, 2025

Type names following the Новый/New keyword were not receiving semantic token highlighting. This adds type highlighting for constructor expressions.

Changes

  • Add NewExpressionSemanticTokensSupplier that finds newExpression AST nodes and emits SemanticTokenTypes.Type for the type name
  • Add unit tests covering Russian/English syntax and edge cases

Example

Массив = Новый Массив();        // "Массив" now highlighted as Type
Список = Новый СписокЗначений(); // "СписокЗначений" now highlighted as Type

Note: The Новый("TypeName") syntax where the type is passed as a string literal is intentionally not highlighted, as that's a string argument rather than a type identifier.

Original prompt

Раскраска имен типов после ключевого слова "Новый" как type


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

… 'Новый' keyword

Co-authored-by: nixel2007 <1132840+nixel2007@users.noreply.github.com>
Copilot AI changed the title [WIP] Add type coloring after the 'New' keyword Add semantic highlighting for type names after 'Новый' keyword Dec 29, 2025
Copilot AI requested a review from nixel2007 December 29, 2025 19:50
@github-actions
Copy link
Contributor

Test Results

 2 799 files  + 9   2 799 suites  +9   48m 53s ⏱️ - 2m 5s
 1 128 tests + 5   1 128 ✅ + 5  0 💤 ±0  0 ❌ ±0 
10 152 runs  +45  10 152 ✅ +45  0 💤 ±0  0 ❌ ±0 

Results for commit 0a5ce3f. ± Comparison against base commit 11a5848.

This pull request removes 8 and adds 9 tests. Note that renamed tests count towards both.
#, count=1
, count=0
, count=1
A, count=1
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [2] content=
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [6] content=
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [7] content=#
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [8] content=
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [2] content=
, count=0
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [6] content=
A, count=1
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [7] content=#
, count=1
com.github._1c_syntax.bsl.languageserver.diagnostics.MetadataObjectNameLengthDiagnosticTest ‑ [8] content=
#, count=1
com.github._1c_syntax.bsl.languageserver.semantictokens.NewExpressionSemanticTokensSupplierTest ‑ testMultipleNewExpressions()
com.github._1c_syntax.bsl.languageserver.semantictokens.NewExpressionSemanticTokensSupplierTest ‑ testNewExpressionEnglish()
com.github._1c_syntax.bsl.languageserver.semantictokens.NewExpressionSemanticTokensSupplierTest ‑ testNewExpressionWithTypeMethod()
com.github._1c_syntax.bsl.languageserver.semantictokens.NewExpressionSemanticTokensSupplierTest ‑ testNewExpressionWithTypeName()
com.github._1c_syntax.bsl.languageserver.semantictokens.NewExpressionSemanticTokensSupplierTest ‑ testNoTokensWithoutNewExpression()

@nixel2007 nixel2007 marked this pull request as ready for review December 30, 2025 08:02
Copilot AI review requested due to automatic review settings December 30, 2025 08:02
@nixel2007 nixel2007 enabled auto-merge December 30, 2025 08:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds semantic highlighting for type names following the Новый/New keyword in constructor expressions and introduces a reusable test helper to improve test maintainability across semantic token tests.

  • Implements NewExpressionSemanticTokensSupplier to highlight type names in Новый ТипИмя() expressions as SemanticTokenTypes.Type
  • Introduces SemanticTokensTestHelper with utilities for decoding and asserting semantic tokens in tests
  • Refactors existing semantic token tests to use the new helper, improving consistency and reducing boilerplate

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
NewExpressionSemanticTokensSupplier.java Implements the semantic token supplier for highlighting type names after the Новый/New keyword
NewExpressionSemanticTokensSupplierTest.java Comprehensive test coverage for the new supplier including Russian/English syntax and edge cases
SemanticTokensTestHelper.java New test utility class providing token decoding and assertion methods
SymbolsSemanticTokensSupplierTest.java Refactored to use the new test helper, removing manual token filtering
PreprocessorSemanticTokensSupplierTest.java Refactored with explicit expected token assertions using the helper
ModuleReferenceSemanticTokensSupplierTest.java Updated to extend AbstractServerContextAwareTest and use the helper
MethodCallSemanticTokensSupplierTest.java Simplified using the test helper with clear expected token definitions
LexicalSemanticTokensSupplierTest.java Refactored with more precise assertions using the helper
CommentSemanticTokensSupplierTest.java Improved test clarity with explicit expected token lists
BslDocSemanticTokensSupplierTest.java Refactored to use helper methods for cleaner assertions
AnnotationSemanticTokensSupplierTest.java Simplified test assertions using the new helper patterns

@sonarqubecloud
Copy link

@nixel2007 nixel2007 disabled auto-merge December 30, 2025 08:11
@nixel2007 nixel2007 merged commit 1cb9cc0 into develop Dec 30, 2025
46 checks passed
@nixel2007 nixel2007 deleted the copilot/add-type-coloring-feature branch December 30, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants