Skip to content

Conversation

@markijbema
Copy link
Contributor

Summary

When the current line prefix contains no word characters (e.g., only whitespace/indentation after typing comma and Enter in an array of objects), show the whole multi-line suggestion instead of truncating to the first line.

Problem

When editing an array of objects and typing , then Enter, the cursor is on a new line with only whitespace/indentation. Previously, multi-line suggestions would be truncated to just the first line (e.g., showing only { instead of the complete object block).

Solution

Add a check in shouldShowOnlyFirstLine to return false (show whole block) when the current line prefix contains no word characters (\w).

Changes

  • Add word character check in shouldShowOnlyFirstLine function
  • Add tests for the new behavior
  • Fix existing test that was incorrectly expecting truncation when the current line has only whitespace

Testing

All 111 tests pass.

When the current line prefix contains no word characters (e.g., only
whitespace/indentation after typing comma and Enter in an array of
objects), show the whole multi-line suggestion instead of truncating
to the first line.

This improves the autocomplete experience when adding new items to
arrays or objects, where the user expects to see the complete
suggested block.

Also add tests to cover this scenario and fix existing test that was
incorrectly expecting truncation when the current line has only
whitespace.
@changeset-bot
Copy link

changeset-bot bot commented Jan 8, 2026

⚠️ No Changeset found

Latest commit: ce73e90

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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