DanTup · GitHub

@DanTup

…om the server
Fixes #6120

@DanTup

gemini-code-assist[bot]

Pull request overview

This PR introduces a client-side workaround in the Dart-Code VS Code extension to ensure snippet-based workspace edits preserve indentation by forcing keepWhitespace=true on SnippetTextEdits converted from LSP responses, addressing the whitespace regression described in #6120.

Changes:

  • Overrides the LSP client’s internal protocol-to-code workspace edit conversion to set SnippetTextEdit.keepWhitespace = true.
  • Routes code actions’ edit conversion through the custom workspace edit converter.
  • Adjusts an assist code action provider test to account for legacy vs new snippet edit behaviors.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/extension/analysis/analyzer.ts Adds a custom workspace edit converter to force keepWhitespace=true for snippet edits and wires it into code action conversion.
src/test/flutter/providers/assist_code_action_provider.test.ts Updates the snippet-related test to handle legacy vs inline-edit code action results.
src/extension/analysis/analyzer_snippet_text_edits.ts Minor whitespace-only cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DanTup

@codecov

Codecov Report

❌ Patch coverage is 44.44444% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.11%. Comparing base (e86e12a) to head (8219b6e).

Files with missing lines Patch % Lines
src/extension/analysis/analyzer.ts 44.44% 13 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6121      +/-   ##
==========================================
- Coverage   71.18%   71.11%   -0.07%     
==========================================
  Files         170      170
  Lines       13096    13124      +28
  Branches     2633     2642       +9
==========================================
+ Hits         9322     9333      +11     
- Misses       3263     3274      +11     
- Partials      511      517       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DanTup

@DanTup

DanTup deleted the fix-snippet-keep-whitespace branch

July 16, 2026 09:50

Read the original on github.com ↗