File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments