Skip to content

Add githubCodeOwners.format.align and spacing - #44

Merged
chdsbd merged 4 commits into
masterfrom
claude/formatting-cli-extension-option-zpeww8
Nov 10, 2026
Merged

chdsbd merged 4 commits into
masterfrom
claude/formatting-cli-extension-option-zpeww8

Conversation

@chdsbd

@chdsbd chdsbd commented Nov 9, 2026 •

Copy link
Copy Markdown
Owner

Add new formatting option (file) to match legacy behavior.


🤖 Adds settings for how the gh-codeowners language server formats CODEOWNERS, including the pre-5.1.0 formatting, and bundles gh-codeowners v0.4.0, which supports them.

  • githubCodeOwners.format.align: group (the default, the current behavior) or file (one column for the whole file, like before 5.1.0).
  • githubCodeOwners.format.spacing: the number of spaces between the longest pattern and the owners. It defaults to 1. To format exactly like before 5.1.0, use align: file with spacing: 5.
  • The deprecated githubCodeOwners.format.alignmentOffset and github-code-owners.format.alignment-offset are deprecated again, now pointing to spacing. If the user set one of them and hasn't set spacing, the extension sends offset + 1, so their files format as before.
  • The deprecation message for format.enabled explains how to get the old formatting.
  • The extension sends { format: { align, spacing } } as initializationOptions, and sends workspace/didChangeConfiguration when any of these settings change, so no restart is needed.
  • s/download-server bundles gh-codeowners v0.4.0 (Add --align and --spacing to fmt and the language server gh-codeowners#43), which reads these settings.
  • Adds an integration test that covers the deprecated offset, and spacing overriding it.
  • Fixes a flaky test: "offers to escape brackets" now waits for the language server's quick fix, since VS Code's own AI actions, which have no edit, can arrive first.

Verification

  • npm run typecheck, npm run eslint, npm run fmt:check and npm run compile pass.
  • The published v0.4.0 linux-amd64 binary matches the release's SHA-256 digest, reports version 0.4.0, and formats with --align file --spacing 3.
  • The test's expected text comes from the server's real output.
  • I couldn't run the VS Code integration tests in my environment, because the network blocks the VS Code download, so CI is the first full run.

Setting it to legacy asks the gh-codeowners language server to line up
the first owner of every rule, offset by githubCodeOwners.format.alignmentOffset,
which is no longer deprecated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM
Match gh-codeowners' fmt --align group|file and --spacing. The deprecated
alignmentOffset settings still apply, as spacing one more than the offset,
until spacing is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM
@chdsbd chdsbd changed the title Add githubCodeOwners.format.style to format like before 5.1.0 Add githubCodeOwners.format.align and spacing Nov 10, 2026
VS Code's own AI actions can answer first, so the test sometimes saw
only those.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM
It reads the format settings this extension sends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018s9fHcEQxmXZ7pQ6v9W2KM
@chdsbd
chdsbd marked this pull request as ready for review November 10, 2026 12:50
@chdsbd
chdsbd merged commit 5bea478 into master Nov 10, 2026
8 checks passed
@chdsbd
chdsbd deleted the claude/formatting-cli-extension-option-zpeww8 branch November 10, 2026 12:50
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