Skip to content

fix(elasticsearch): support nested JSON folding and diagnostics in REST requests - #10749

Merged
eryajf merged 2 commits into
t8y2:mainfrom
OOMEcho:codex/fix-10741-elasticsearch-json-language
Oct 29, 2026
Merged

eryajf merged 2 commits into
t8y2:mainfrom
OOMEcho:codex/fix-10741-elasticsearch-json-language

Conversation

@OOMEcho

@OOMEcho OOMEcho commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

变更说明 / 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.

  • Reuse the execution request boundaries and retain existing METHOD /path folds.
  • Parse each bulk/multi-search NDJSON line independently and retain SQL parsing for non-REST documents.
  • Preserve comment preambles and language reconfiguration; skip automatic JSON diagnostics in the existing large-document mode.
  • Align @lezer/common 1.5.3 with the JSON parser runtime used by current main.

变更类型 / Change Type

  • 新功能 / New feature
  • Bug 修复 / Bug fix
  • 性能优化 / Performance improvement
  • 代码重构 / Code refactoring
  • 文档更新 / Documentation
  • CI / 构建 / CI or build

涉及前端 / Frontend Changes

  • 本 PR 涉及前端改动,已附截图/录屏 / This PR includes frontend changes and screenshots or a recording are attached.

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 filter key was parsed as a SQL quoted identifier. Both new Elasticsearch/Easysearch component regression cases failed because the nested query fold was absent.
image

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 the query fold 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.
image

验证 / Validation

  • make check 通过 / make check passes

  • make cargo-check-fast 通过 / make cargo-check-fast passes

  • 相关测试通过 / 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

@github-actions github-actions Bot added area/desktop Desktop application or Tauri shell bug Something isn't working dependencies/frontend Adds a frontend dependency ui-change Changes user-visible interface, text, or visual assets labels Sep 30, 2026
@eryajf

eryajf commented Oct 29, 2026

Copy link
Copy Markdown
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.
@OOMEcho

OOMEcho commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

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!

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!

@eryajf eryajf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed exact HEAD 8fecd2c. The head is unchanged from the reviewed revision, and the applicable CI checks have passed. Approved based on the reviewed diff and available validation evidence.

@eryajf
eryajf merged commit ba8093f into t8y2:main Oct 29, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/desktop Desktop application or Tauri shell bug Something isn't working dependencies/frontend Adds a frontend dependency ui-change Changes user-visible interface, text, or visual assets

Projects

None yet

2 participants