Skip to content

Commit 0b5826b

Browse files
committed
add more information to hover
1 parent 0e53758 commit 0b5826b

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

src/codeowners-hover-provider.ts

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ export class CodeownersHoverProvider implements vscode.HoverProvider {
2929
const x = new vscode.MarkdownString()
3030
x.appendCodeblock(m)
3131

32-
const isPattern = !m.startsWith("/")
32+
const hasLeadingSlash = m.startsWith("/")
33+
const hasTrailingSlash = m.endsWith("/")
34+
const hasTrailingGlob = m.endsWith("/*")
3335

3436
const range = new vscode.Range(
3537
new vscode.Position(position.line, idx),
@@ -38,12 +40,30 @@ export class CodeownersHoverProvider implements vscode.HoverProvider {
3840
if (!range.contains(position)) {
3941
return { contents: [] }
4042
}
43+
44+
const lines: string[] = []
45+
46+
if (hasLeadingSlash) {
47+
lines.push("**Anchored to repo root** — only matches at the top level")
48+
} else {
49+
lines.push(
50+
"**Matches at any depth** — applies to this path anywhere in the repository)",
51+
)
52+
}
53+
54+
if (hasTrailingGlob) {
55+
lines.push(
56+
"**Shallow match** — covers only direct children, not subdirectories",
57+
)
58+
} else if (hasTrailingSlash) {
59+
lines.push(
60+
"**Recursive directory match** — covers the directory and all its contents at any depth",
61+
)
62+
}
63+
4164
return {
4265
range,
43-
contents: [
44-
x,
45-
isPattern ? "Substring pattern match" : `Matches path exactly`,
46-
],
66+
contents: [x, lines.join("\n\n")],
4767
}
4868
}
4969
}

0 commit comments

Comments
 (0)