Skip to content

Commit f016cab

Browse files
committed
feat: -big annoyance, meet removeDefinitionFromReferences!
Thanks, talk2much!
1 parent 3bae152 commit f016cab

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/configurationType.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,9 @@ export type Configuration = {
136136
* @default []
137137
*/
138138
replaceSuggestions: ReplaceRule[]
139+
/**
140+
* https://github.com/microsoft/vscode/issues/160637
141+
* @default true
142+
*/
143+
removeDefinitionFromReferences: boolean
139144
}

typescript/src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ export = function ({ typescript }: { typescript: typeof import('typescript/lib/t
140140
return prior
141141
}
142142

143+
proxy.findReferences = (fileName, position) => {
144+
let prior = info.languageService.findReferences(fileName, position)
145+
if (prior && c('removeDefinitionFromReferences')) {
146+
prior = prior.map(({ references, ...other }) => ({ ...other, references: references.filter(({ isDefinition }) => !isDefinition) }))
147+
}
148+
return prior
149+
}
150+
143151
info.languageService[thisPluginMarker] = true
144152

145153
return proxy

0 commit comments

Comments
 (0)