-
Notifications
You must be signed in to change notification settings - Fork 707
Improve commit line break unwrapping for variable-length list markers #8417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Fix list continuation to use content indent (not marker indent) - Support variable-length numbered list markers (1., 10., 100., etc.) - Allow flexible continuation spacing (1+ spaces, but not 4+ which is code) - Preserve multi-paragraph list formatting (blank lines within list items) - Track list context across blank lines for proper paragraph unwrapping - Add comprehensive test cases for all scenarios Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Use appendWithSpace with trimmed text to avoid double spaces when joining lines with leading whitespace. Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
| // Pattern to detect list item markers at the start of a line | ||
| const LIST_ITEM_PATTERN = /^[ \t]*([*+\-]|\d+\.)\s/; | ||
| // Pattern to detect list item markers at the start of a line and capture the marker | ||
| const LIST_ITEM_PATTERN = /^([ \t]*)([*+\-]|\d+\.)([ \t]+)/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Use named captures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in f64389c. The regex now uses named capture groups: leadingWhitespace, marker, and markerTrailingWhitespace.
Renamed capture groups for clarity: - leadingWhitespace: spaces/tabs before marker - marker: the list item marker (*, +, -, or digits.) - markerTrailingWhitespace: spaces after marker Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
There was a problem hiding this 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 fixes the commit message body unwrapping logic to correctly handle variable-length list markers, particularly for numbered lists with multi-digit numbers (e.g., 10., 11.). The previous implementation assumed a fixed continuation indent, which broke with multi-digit numbered lists.
Changes:
- Modified
LIST_ITEM_PATTERNregex to use named capture groups for extracting marker components - Replaced simple indent tracking with a stack storing both
markerIndentandcontentIndentfor each list level - Updated blank line handling to preserve list context for multi-paragraph lists
- Added comprehensive test coverage for multi-digit lists, multi-paragraph lists, code blocks within lists, and various continuation indent scenarios
- Included routine updates to VS Code proposed API type definitions
Reviewed changes
Copilot reviewed 2 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/github/folderRepositoryManager.ts |
Core implementation fix: uses named regex captures to calculate proper content indent for variable-length list markers, enabling correct handling of multi-digit numbered lists and multi-paragraph list items |
src/test/github/folderRepositoryManager.test.ts |
Adds 13 new test cases covering multi-digit numbered lists, multi-paragraph lists, code blocks within lists, variable space continuations, and nested variations |
src/@types/vscode.proposed.chatSessionsProvider.d.ts |
Updates proposed API type definitions to add CancellationToken parameter to refresh handlers and simplifies changes property types |
src/@types/vscode.proposed.chatParticipantPrivate.d.ts |
Bumps API version from 11 to 12 |
src/@types/vscode.proposed.chatParticipantAdditions.d.ts |
Adds new ChatQuestion and ChatResponseQuestionCarouselPart types for question carousel UI feature |
src/@types/vscode.proposed.chatContextProvider.d.ts |
Refactors context provider APIs into separate workspace, explicit, and resource provider interfaces with clearer separation of concerns |
| * - For a resource. Make sure to pass a selector that matches the resource you want to provide context for. | ||
| * Providers registered without a selector will not be called for resource-based context. | ||
| * - Explicitly. These context items are shown as options when the user explicitly attaches context. | ||
| * Register a chat workspace context provider. Workspace context is automatically included in all chat requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They get updated as part of npm install, which Copilot runs.
unwrapCommitMessageBodyfunctionfolderRepositoryManager.test.tsactiveIndent + 2) but numbered list markers can be variable-length (e.g.,1.vs10.)Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.