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
11 changes: 10 additions & 1 deletion .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ jobs:
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
include:
- { os: macos-latest, target: darwin-arm64 }
- { os: ubuntu-latest, target: linux-x64 }
- { os: windows-latest, target: win32-x64 }
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
Expand All @@ -81,6 +84,12 @@ jobs:
node-version-file: "package.json"
- name: Install dependencies
run: npm ci
- name: Download gh-codeowners
shell: bash
run: ./s/download-server "$TARGET"
env:
TARGET: ${{ matrix.target }}
GH_TOKEN: ${{ github.token }}
- name: Run tests ${{ matrix.os }}
if: runner.os == 'Linux'
run: xvfb-run -a npm test
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,24 @@ on:
permissions: {}

jobs:
# A build for each platform bundles gh-codeowners as the language server.
# The universal build has no binary, for other platforms, and falls back to
# the built-in features.
publish:
if: ${{ !github.event.release.prerelease }}
strategy:
fail-fast: false
matrix:
target:
- darwin-arm64
- darwin-x64
- linux-x64
- linux-arm64
- alpine-x64
- alpine-arm64
- win32-x64
- win32-arm64
- universal
runs-on: ubuntu-latest
environment: marketplace
permissions:
Expand All @@ -28,5 +44,18 @@ jobs:
run: test "$GITHUB_REF_NAME" = "v$(node -p "require('./package.json').version")"
- name: Install dependencies
run: npm ci
- name: Download gh-codeowners
if: matrix.target != 'universal'
run: ./s/download-server "$TARGET"
env:
TARGET: ${{ matrix.target }}
GH_TOKEN: ${{ github.token }}
- name: Publish to Visual Studio Marketplace
run: npx --no-install vsce publish --oidc
run: |
if [[ "$TARGET" == universal ]]; then
npx --no-install vsce publish --oidc
else
npx --no-install vsce publish --oidc --target "$TARGET"
fi
env:
TARGET: ${{ matrix.target }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
*.vsix
out
.vscode-test
/bin
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 5.0.0 - 2026-11-07

### Changed

- Use the gh-codeowners language server for errors and file counts (#42).

## 4.3.0 - 2026-11-04

### Changed
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# [github-code-owners](https://github.com/chdsbd/vscode-github-code-owners) [![Visual Studio Marketplace Version](https://img.shields.io/visual-studio-marketplace/v/chdsbd.github-code-owners.svg)](https://marketplace.visualstudio.com/items?itemName=chdsbd.github-code-owners) [![Visual Studio Marketplace Installs](https://img.shields.io/visual-studio-marketplace/i/chdsbd.github-code-owners.svg)](https://marketplace.visualstudio.com/items?itemName=chdsbd.github-code-owners)
# GitHub Code Owners

A VS Code extension to display the GitHub Code Owners for the current file, as defined in the [CODEOWNERS](https://help.github.com/articles/about-codeowners/) file.

[Install on the Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=chdsbd.github-code-owners)

## Features

### Status bar
Expand All @@ -12,6 +14,22 @@ 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.

#### Counts for matching rules

<img src="./images/owns-4-files.png" alt="hover showing a rule owns 4 files" height="87px"/>

#### Warning for unused rules

<img src="./images/no-files-match.png" alt="warning that a rule owns no files" height="93px"/>

#### Quick fixes for invalid patterns

<img src="./images/invalid-pattern.png" alt="error for an invalid pattern, with the escaped version to use instead" height="142px"/>

<img src="./images/quick-fix.png" alt="quick fix escaping the brackets in an invalid pattern" height="122px"/>

#### Link usernames to GitHub

<img src="./images/open-in-github.png" alt="click to open username in GitHub" height="70px"/>
Expand Down
Binary file added images/invalid-pattern.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/no-files-match.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/owns-4-files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/quick-fix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 92 additions & 9 deletions package-lock.json

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

31 changes: 26 additions & 5 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": "4.3.0",
"version": "5.0.0",
"icon": "images/logo256.png",
"homepage": "https://github.com/chdsbd/vscode-github-code-owners/blob/master/README.md",
"keywords": [
Expand All @@ -21,15 +21,16 @@
"url": "https://github.com/chdsbd/vscode-github-code-owners/issues"
},
"engines": {
"vscode": "^1.53.0"
"vscode": "^1.91.0"
},
"categories": [
"Programming Languages",
"Formatters",
"Other"
],
"activationEvents": [
"workspaceContains:**/CODEOWNERS"
"workspaceContains:**/CODEOWNERS",
"onLanguage:codeowners"
],
"main": "./out/extension.js",
"contributes": {
Expand Down Expand Up @@ -75,6 +76,25 @@
"order": 2,
"description": "Space offset to use from the longest file pattern the first code owner when aligning."
},
"githubCodeOwners.fileCounts.enabled": {
"order": 6,
"type": "boolean",
"default": true,
"description": "Show how many files each rule owns at the end of its line."
},
"githubCodeOwners.languageServer.enabled": {
"order": 4,
"type": "boolean",
"default": true,
"markdownDescription": "Run [gh-codeowners](https://github.com/chdsbd/gh-codeowners) as a language server for errors, unused rules, file counts and owners. When disabled, the extension uses its simpler built-in checks."
},
"githubCodeOwners.languageServer.path": {
"order": 5,
"type": "string",
"default": "",
"scope": "machine",
"markdownDescription": "Path to a [gh-codeowners](https://github.com/chdsbd/gh-codeowners) binary to run as the language server, instead of the one bundled with the extension."
},
"githubCodeOwners.teamMapping.slack": {
"order": 3,
"type": "array",
Expand Down Expand Up @@ -215,7 +235,7 @@
"@types/lodash": "^4.14.195",
"@types/mocha": "^10.0.4",
"@types/node": "^24.19.2",
"@types/vscode": "^1.53.0",
"@types/vscode": "^1.91.0",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
"@vscode/test-cli": "^0.0.9",
Expand All @@ -231,7 +251,8 @@
},
"dependencies": {
"@snyk/github-codeowners": "github:chdsbd/github-codeowners#bb24c2adb022a88e03f25a3680a23934a281a5c3",
"lodash": "^4.17.21"
"lodash": "^4.17.21",
"vscode-languageclient": "^11.0.0"
},
"volta": {
"node": "24.22.1"
Expand Down
40 changes: 40 additions & 0 deletions s/download-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env bash
# s/download-server <vsce target>
#
# Download the gh-codeowners binary for a VS Code platform, like
# darwin-arm64, into bin/, where the extension looks for its language server.
set -euo pipefail

GH_CODEOWNERS_VERSION=v0.2.0

target=$1
case "$target" in
darwin-arm64) asset=gh-codeowners-darwin-arm64 ;;
darwin-x64) asset=gh-codeowners-darwin-amd64 ;;
# The Linux binaries are static, so they run on Alpine too.
linux-x64 | alpine-x64) asset=gh-codeowners-linux-amd64 ;;
linux-arm64 | alpine-arm64) asset=gh-codeowners-linux-arm64 ;;
win32-x64) asset=gh-codeowners-windows-amd64.exe ;;
win32-arm64) asset=gh-codeowners-windows-arm64.exe ;;
*)
echo "No gh-codeowners binary for $target" >&2
exit 1
;;
esac

exe=""
if [[ "$asset" == *.exe ]]; then
exe=.exe
fi

cd "$(dirname "$0")/.."
rm -rf bin
mkdir bin
gh release download "$GH_CODEOWNERS_VERSION" \
--repo chdsbd/gh-codeowners \
--pattern "$asset" \
--output "bin/gh-codeowners$exe"
# The release is immutable, so GitHub's attestation lists each binary's digest.
gh release verify-asset "$GH_CODEOWNERS_VERSION" "bin/gh-codeowners$exe" \
--repo chdsbd/gh-codeowners
chmod +x "bin/gh-codeowners$exe"
Loading
Loading