Skip to content

Conversation

@ulugbekna
Copy link
Contributor

Improved isAdditiveEdit to use subsequence matching instead of simple substring containment. This correctly detects additive edits where text is inserted in the middle of a line.

Example: 'function fib() {' → 'function fib(n: number) {' is now correctly identified as additive.

The algorithm is O(n) with O(1) space - a single pass through the new line checking if all original characters appear in order.

Copilot AI review requested due to automatic review settings January 29, 2026 19:08
@ulugbekna ulugbekna enabled auto-merge January 29, 2026 19:08
@ulugbekna ulugbekna self-assigned this Jan 29, 2026
Improved isAdditiveEdit to use subsequence matching instead of simple
substring containment. This correctly detects additive edits where text
is inserted in the middle of a line.

Example: 'function fib() {' → 'function fib(n: number) {' is now
correctly identified as additive.

The algorithm is O(n) with O(1) space - a single pass through the new
line checking if all original characters appear in order.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends “fast cursor line change” emitting to support an additive-only mode by improving additive-edit detection from substring containment to subsequence matching (so insertions in the middle of a line qualify).

Changes:

  • Replaces the emitFastCursorLineChange boolean with an EmitFastCursorLineChange enum (off / always / additive-only) and adds a boolean→enum mapping helper.
  • Adds isAdditiveEdit using subsequence matching and gates fast-cursor emission when configured to additive-only.
  • Adds unit tests covering isAdditiveEdit behavior.

Reviewed changes

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

File Description
src/platform/inlineEdits/common/responseProcessor.ts Introduces enum-based fast-cursor emitting and subsequence-based additive detection.
src/platform/configuration/common/configurationService.ts Updates the xtab config key type/default for fast-cursor emitting.
src/extension/xtab/node/xtabProvider.ts Maps the config value into the new enum-based diff options.
src/extension/xtab/test/common/responseProcessor.spec.ts Adds test coverage for additive edit detection.
Comments suppressed due to low confidence (1)

src/platform/configuration/common/configurationService.ts:798

  • This setting now accepts a string enum at runtime, but no validator is provided. A typo or unexpected value (including legacy boolean values from existing user settings) will flow through unvalidated and can result in unintended behavior. Consider adding a validator (e.g., vUnion(vBoolean(), vEnum('off','always','additive-only'))) and/or changing the config type to boolean | ResponseProcessor.EmitFastCursorLineChange so legacy boolean values are explicitly supported and invalid strings fall back to the default.
		export const InlineEditsXtabProviderEmitFastCursorLineChange = defineTeamInternalSetting<ResponseProcessor.EmitFastCursorLineChange>('chat.advanced.inlineEdits.xtabProvider.emitFastCursorLineChange', ConfigType.ExperimentBased, ResponseProcessor.DEFAULT_DIFF_PARAMS.emitFastCursorLineChange);
		export const InlineEditsXtabIncludeViewedFiles = defineTeamInternalSetting<boolean>('chat.advanced.inlineEdits.xtabProvider.includeViewedFiles', ConfigType.ExperimentBased, xtabPromptOptions.DEFAULT_OPTIONS.recentlyViewedDocuments.includeViewedFiles);

@ulugbekna ulugbekna added this pull request to the merge queue Jan 29, 2026
Merged via the queue into main with commit c849a6d Jan 29, 2026
19 checks passed
@ulugbekna ulugbekna deleted the ulugbekna/brainy-ladybug branch January 29, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants