Draft
Conversation
Integrate tree-sitter as an optional syntax highlighting engine that supplements the existing keyword-based CrystalEdit parsers. When a grammar DLL and highlight query (.scm) are present in the TreeSitterGrammars directory, tree-sitter provides full AST-based highlighting; otherwise the existing parser runs unchanged. Core components: - TreeSitterParser.h/.cpp: CTreeSitterParser, CTreeSitterColorMap, CTreeSitterLanguage, and TreeSitterRegistry classes - ParseLine virtual override in CMergeEditView for tree-sitter results - Incremental parsing via ts_tree_edit() on each edit operation - Lazy reparse with dirty flag (fires once per paint cycle) - Status bar indicator showing [TS:language] in encoding pane - Post-build step to copy grammar DLLs from Release to Debug/Test Supported languages: bash, c, c-sharp, cpp, css, dtd, flow, fsharp, fsharp_signature, go, html, java, javascript, json, php, php_only, python, ruby, rust, tsx, typescript, xml. Grammar DLLs are built separately via build-grammars.ps1.
- build-grammars.ps1: downloads and compiles grammar DLLs from GitHub releases using MSVC cl.exe/link.exe - grammars.json: defines 17 grammar repos and release tags - fsharp-highlights.scm: F# syntax highlight queries for tree-sitter
Wire in scope-aware highlighting (locals.scm) and language injection (injections.scm) alongside the existing highlights.scm support. - CTreeSitterLanguage: add LoadQuery() helper, load all three .scm files - CTreeSitterParser: add RunLocalsQuery() for scope/def/ref tracking, RunInjectionQuery() for embedded language highlighting, GetSetProperty() for #set! predicate parsing; RunHighlightQuery() cross-references locals - TreeSitterRegistry: add GetLanguageForName() for injection language lookup - build-grammars.ps1: resolve and copy locals.scm and injections.scm files - Fix type mismatch (RefInfo vs PendingRef) and remove dead code
- Add tree-sitter shared items to solution and projects - Update SampleStatic project to include tree-sitter - Fix build-grammars.ps1 to use Git Bash explicitly - Add missing <algorithm> include - Minor solution cleanup and add Italian translation
* fix: bundle inherited tree-sitter queries for grammars Agent-Logs-Url: https://github.com/Thorium/winmerge/sessions/234ce03d-a145-4b8c-b4c2-37eed3e33cf0 Co-authored-by: Thorium <229355+Thorium@users.noreply.github.com> * refine tree-sitter query bundling helpers Agent-Logs-Url: https://github.com/Thorium/winmerge/sessions/234ce03d-a145-4b8c-b4c2-37eed3e33cf0 Co-authored-by: Thorium <229355+Thorium@users.noreply.github.com> * polish tree-sitter query bundle handling Agent-Logs-Url: https://github.com/Thorium/winmerge/sessions/234ce03d-a145-4b8c-b4c2-37eed3e33cf0 Co-authored-by: Thorium <229355+Thorium@users.noreply.github.com> * Earlier CoPilot feedback addressed. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Thorium <229355+Thorium@users.noreply.github.com>
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.
No description provided.