Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 5.1.0 - 2026-11-08

### Changed

- Format CODEOWNERS with the gh-codeowners language server. Formatting behavior has changed (#43).

### Deprecated

- Unused settings are marked as deprecated: `githubCodeOwners.format.enabled` and `githubCodeOwners.format.alignmentOffset` (#43).

## 5.0.0 - 2026-11-07

### Changed
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Shows the first code owner. Click to see matching line in CODEOWNERS file.

### Language support

The extension uses [gh-codeowners](https://github.com/chdsbd/gh-codeowners) to count file matches and warn about unused or malformed rules.
The extension uses [gh-codeowners](https://github.com/chdsbd/gh-codeowners) to count file matches, warn about unused or malformed rules, and format CODEOWNERS.

#### Counts for matching rules

Expand All @@ -36,9 +36,9 @@ The extension uses [gh-codeowners](https://github.com/chdsbd/gh-codeowners) to c

#### Link usernames to Slack

<img src="./images/open-in-slack.png" alt="click to open username in GitHub" height="110px"/>
<img src="./images/open-in-slack.png" alt="click to open username in Slack" height="110px"/>

> Define a Slack mapping in your VSCode settings (`github-code-owners.team-mapping.slack`) to enable this feature.
> Define a Slack mapping in your VSCode settings (`githubCodeOwners.teamMapping.slack`) to enable this feature.

#### Auto complete

Expand All @@ -52,9 +52,9 @@ Escapes, wildcards, comments and owners are highlighted the way GitHub reads the

#### Formatting

> Enable formatting by setting `github-code-owners.format.enabled` to `true`.
Format Document lines up owners and trailing comments in each section.

<img src="./images/formatting.gif" alt="auto complete of paths and usernames" width="408px" height="185px"/>
<img src="./images/formatting.png" alt="owners lined up in each section of a CODEOWNERS file" height="193px"/>

### Command

Expand All @@ -78,7 +78,7 @@ Download the extension package from the [latest Github release](https://github.c

### From source

Clone [this repo](https://github.com/chdsbd/vscode-github-code-owners) and run `npm ci` and `npm run package`. Install the resulting package with `code --install-extension github-code-owners-*.vsix`
Clone [this repo](https://github.com/chdsbd/vscode-github-code-owners) and run `npm ci`, `s/download-server darwin-arm64` (or your platform) to bundle the language server, and `npm run package`. Install the resulting package with `code --install-extension github-code-owners-*.vsix`

## Related extensions

Expand All @@ -90,4 +90,4 @@ Clone [this repo](https://github.com/chdsbd/vscode-github-code-owners) and run `

## Fork

This repository is forked from [jasonnutter/vscode-codeowners](https://github.com/jasonnutter/vscode-codeowners), with UI changes and more correct CODEOWNERS compliance via [@snyk/github-codeowners](https://www.npmjs.com/package/@snyk/github-codeowners).
This repository is forked from [jasonnutter/vscode-codeowners](https://github.com/jasonnutter/vscode-codeowners), with UI changes and more correct CODEOWNERS compliance via [gh-codeowners](https://github.com/chdsbd/gh-codeowners).
Binary file removed images/formatting.gif
Binary file not shown.
Binary file added images/formatting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Quickly see GitHub Code Owners for the current file. Add syntax highlighting for CODEOWNERS files.",
"publisher": "chdsbd",
"license": "SEE LICENSE IN LICENSE",
"version": "5.0.0",
"version": "5.1.0",
"icon": "images/logo256.png",
"homepage": "https://github.com/chdsbd/vscode-github-code-owners/blob/master/README.md",
"keywords": [
Expand Down Expand Up @@ -67,14 +67,18 @@
"type": "boolean",
"default": false,
"order": 1,
"description": "Whether or not to enable formatting."
"description": "Whether or not to enable formatting.",
"markdownDeprecationMessage": "**Deprecated**: Formatting is always available from the language server. Use `Format Document` or `#editor.formatOnSave#`.",
"deprecationMessage": "Deprecated: Formatting is always available from the language server. Use Format Document or editor.formatOnSave."
},
"githubCodeOwners.format.alignmentOffset": {
"type": "number",
"default": 4,
"minimum": 1,
"order": 2,
"description": "Space offset to use from the longest file pattern the first code owner when aligning."
"description": "Space offset to use from the longest file pattern the first code owner when aligning.",
"markdownDeprecationMessage": "**Deprecated**: The language server lines up owners one space after the longest pattern in each section.",
"deprecationMessage": "Deprecated: The language server lines up owners one space after the longest pattern in each section."
},
"githubCodeOwners.fileCounts.enabled": {
"order": 6,
Expand Down Expand Up @@ -152,15 +156,15 @@
}
},
"github-code-owners.format.enabled": {
"markdownDeprecationMessage": "**Deprecated**: Please use `#githubCodeOwners.format.enabled#` instead.",
"deprecationMessage": "Deprecated: Please use githubCodeOwners.format.enabled instead.",
"markdownDeprecationMessage": "**Deprecated**: Formatting is always available from the language server. Use `Format Document` or `#editor.formatOnSave#`.",
"deprecationMessage": "Deprecated: Formatting is always available from the language server. Use Format Document or editor.formatOnSave.",
"type": "boolean",
"default": false,
"description": "Whether or not to enable formatting."
},
"github-code-owners.format.alignment-offset": {
"markdownDeprecationMessage": "**Deprecated**: Please use `#githubCodeOwners.format.alignmentOffset#` instead.",
"deprecationMessage": "Deprecated: Please use githubCodeOwners.format.alignmentOffset instead.",
"markdownDeprecationMessage": "**Deprecated**: The language server lines up owners one space after the longest pattern in each section.",
"deprecationMessage": "Deprecated: The language server lines up owners one space after the longest pattern in each section.",
"type": "number",
"default": 4,
"minimum": 1,
Expand Down
2 changes: 1 addition & 1 deletion s/download-server
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# darwin-arm64, into bin/, where the extension looks for its language server.
set -euo pipefail

GH_CODEOWNERS_VERSION=v0.2.0
GH_CODEOWNERS_VERSION=v0.3.0

target=$1
case "$target" in
Expand Down
133 changes: 0 additions & 133 deletions src/align-codeowners.ts

This file was deleted.

32 changes: 0 additions & 32 deletions src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,6 @@ export function getGitHubUrl(): string {
return setting
}

export function isFormatEnabled(): boolean {
const formatEnabled = vscode.workspace
.getConfiguration()
.get("githubCodeOwners.format.enabled")
if (typeof formatEnabled === "boolean") {
return formatEnabled
}
const formatEnabledDeprecated = vscode.workspace
.getConfiguration()
.get("github-code-owners.format.enabled")
if (typeof formatEnabledDeprecated === "boolean") {
return formatEnabledDeprecated
}
return false
}

export function getAlignmentOffset(): number {
const alignmentOffset = vscode.workspace
.getConfiguration()
.get("githubCodeOwners.format.alignmentOffset")
if (typeof alignmentOffset === "number") {
return alignmentOffset
}
const alignmentOffsetDeprecated = vscode.workspace
.getConfiguration()
.get("github-code-owners.format.alignment-offset")
if (typeof alignmentOffsetDeprecated === "number") {
return alignmentOffsetDeprecated
}
return 4
}

export type SlackMappingConfigurationItem = {
domain: string
channel: string
Expand Down
8 changes: 1 addition & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { OwnerNameCompletionItemProvider } from "./owner-name-completion-item-pr
import { showOwnersCommandHandler } from "./show-owners-command"
import { CodeownersHoverProvider } from "./codeowners-hover-provider"
import { statusBarTextEditorListener } from "./status-bar-text-editor-listener"
import { AlignOwnersFormattingProvider } from "./align-codeowners"
import { registerCodeownersDiagnostics } from "./codeowners-diagnostic-provider"
import { CodeownersLanguageServer } from "./language-server"
import { LANGUAGE_SERVER } from "./configuration"
Expand All @@ -23,7 +22,7 @@ export async function activate(context: vscode.ExtensionContext) {
log: true,
},
)
// Diagnostics, hovers, file counts and owners come from gh-codeowners'
// Diagnostics, hovers, file counts, owners and formatting come from gh-codeowners'
// language server, when this platform has it.
const server = await CodeownersLanguageServer.start(context, outputChannel)
const getServer = () => server
Expand All @@ -40,11 +39,6 @@ export async function activate(context: vscode.ExtensionContext) {
),
}

vscode.languages.registerDocumentFormattingEditProvider(
CODEOWNERS_SELECTOR,
new AlignOwnersFormattingProvider(),
)

context.subscriptions.push(
vscode.commands.registerCommand(
COMMAND_ID,
Expand Down
9 changes: 0 additions & 9 deletions test/data/align-codeowners/expected-formatted-with-offset-4

This file was deleted.

9 changes: 0 additions & 9 deletions test/data/align-codeowners/expected-formatted-with-offset-8

This file was deleted.

9 changes: 0 additions & 9 deletions test/data/align-codeowners/input-to-format

This file was deleted.

3 changes: 0 additions & 3 deletions test/data/align-codeowners/should-never-change

This file was deleted.

Loading
Loading