Repository navigation
fix(elasticsearch): support nested JSON folding and diagnostics in REST requests - #10749
Merged
eryajf merged 2 commits intoOct 29, 2026
Merged
Conversation
Collaborator
|
Thank you for submitting this PR! This PR currently has merge conflicts with the target branch. Please sync with the target branch and resolve all conflicts before requesting review and merge. After confirming that the code and relevant checks pass, please request review and merge again. Thank you! |
Preserve current language routing and regressions, and align Lezer with the JSON parser runtime.
Contributor
Author
Conflicts have been resolved and the branch is synced with main. All relevant local checks and CI have passed. Ready for re-review. Thank you! |
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.
变更说明 / Change Description
Elasticsearch and Easysearch REST request bodies used the SQL grammar, so only whole requests could be folded. Mount the CodeMirror JSON grammar inside each request body to enable nested object/array folding, JSON highlighting, bracket matching, and syntax diagnostics.
@lezer/common1.5.3 with the JSON parser runtime used by current main.变更类型 / Change Type
涉及前端 / Frontend Changes
Before
In a real QueryEditor mounted with two REST requests and the original SQL-language configuration, only request-header lines 1 and 15 were foldable. The JSON

filterkey was parsed as a SQL quoted identifier. Both new Elasticsearch/Easysearch component regression cases failed because the nestedqueryfold was absent.After
With the same request text, foldable lines are 1, 2, 3, 4, 5, 8, 15, 16, and 17. JSON keys are parsed as

PropertyName. Clicking thequeryfold hides only that object and leaves the next request visible. Positioning the cursor next to the filter array highlights both matching brackets. A malformed body produces a diagnostic and underline; correcting it clears the diagnostic.验证 / Validation
make check通过 /make checkpassesmake cargo-check-fast通过 /make cargo-check-fastpasses相关测试通过 / Relevant tests pass
pnpm exec vitest run apps/desktop/src/lib/elasticsearch/__tests__/elasticsearchLanguage.spec.ts apps/desktop/src/lib/editor/__tests__/codemirrorSqlBlockFolding.spec.ts apps/desktop/src/components/editor/__tests__/QueryEditor.largeDocument.integration.spec.ts apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts apps/desktop/src/components/editor/__tests__/QueryEditor.formatCompressRequestReplay.spec.ts apps/desktop/src/components/editor/__tests__/useQueryEditorCompletion.spec.ts apps/desktop/src/components/editor/__tests__/QueryEditor.language.integration.spec.ts apps/desktop/src/components/editor/__tests__/QueryEditor.graph.integration.spec.ts apps/desktop/src/lib/__tests__/editor/codemirrorSqlDialect.spec.ts— 9 files, 304 tests passed.NODE_OPTIONS=--max-old-space-size=8192 pnpm typecheck— passed.pnpm exec oxlint --vue-plugin apps/desktop/src/lib/elasticsearch/elasticsearchLanguage.ts apps/desktop/src/lib/elasticsearch/__tests__/elasticsearchLanguage.spec.ts apps/desktop/src/components/editor/queryEditorSqlExtensions.ts apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts— passed.pnpm exec oxfmt --check apps/desktop/src/lib/elasticsearch/elasticsearchLanguage.ts apps/desktop/src/lib/elasticsearch/__tests__/elasticsearchLanguage.spec.ts apps/desktop/src/components/editor/queryEditorSqlExtensions.ts apps/desktop/src/components/editor/__tests__/QueryEditor.componentSplit.integration.spec.ts— passed.git diff --cached upstream/main --check— passed.Original Chromium verification used the real QueryEditor with local request text, covering nested folding, bracket highlighting, invalid/corrected JSON, and switching to Easysearch. No live Elasticsearch/Easysearch server or query execution was used. Component coverage verifies the execution event retains the exact request text. The main-branch synchronization was revalidated with the automated checks above. Repository-wide checks and Rust checks were not run.
关联 Issue / Related Issue
Close #10741