Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for imperative JavaScript code in QML files, introduces syntax error diagnostics, and improves the completion provider's error handling. The changes follow the codebase's vertical architecture pattern by adding new classification rules for JavaScript contexts and a new diagnostics provider.
Key changes:
- Added semantic token classification for JavaScript expressions (console.log, Math operations, ternary operators, etc.)
- Introduced real-time syntax error diagnostics via tree-sitter parsing
- Enhanced completion provider to avoid suggesting completions in broken syntax contexts
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test-workspace/ImportTest.qml | Adds onClicked handler test case for button interaction |
| test-workspace/ImperativeTest.qml | Comprehensive new test file covering JavaScript expressions, Math/console APIs, ternary operators, and imperative bindings |
| syntaxes/qml.tmLanguage.json | Adds TextMate grammar patterns for operators (ternary, comparison, logical, arithmetic, bitwise) to improve syntax highlighting |
| src/providers/semanticTokens/tokenClassifier.ts | Reorganizes rule application to prioritize QML rules, then imperative rules, with proper fallback chain |
| src/providers/semanticTokens/imperativeClassificationRules.ts | New file implementing the Rules pattern for JavaScript context classification (builtins, member expressions, variables) |
| src/providers/semanticTokens/classificationRules.ts | Refactors rules into qmlRules array and delegates JavaScript contexts to imperative rules |
| src/providers/semanticTokens/builtinTypes.ts | Adds JavaScript global objects (console, Math, JSON, etc.) and their methods/properties for semantic classification |
| src/providers/diagnostics/syntaxDiagnosticsProvider.ts | New provider implementing real-time syntax error detection and reporting using tree-sitter ERROR nodes |
| src/providers/completion/completionProvider.ts | Adds error context detection to prevent completions when syntax is broken |
| src/indexer/shared/CacheValidator.ts | Removes unused getFileModTime function |
| src/extension.ts | Registers the new syntax diagnostics provider during extension activation |
8d5f709 to
a252360
Compare
2f062fa to
aa1fcba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small features and fixes here and there