Skip to content

Commit

Permalink
feat: -big annoyance, meet removeDefinitionFromReferences!
Browse files Browse the repository at this point in the history
Thanks, talk2much!
  • Loading branch information
zardoy committed Sep 11, 2022
1 parent 3bae152 commit f016cab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/configurationType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,9 @@ export type Configuration = {
* @default []
*/
replaceSuggestions: ReplaceRule[]
/**
* https://github.com/microsoft/vscode/issues/160637
* @default true
*/
removeDefinitionFromReferences: boolean
}
8 changes: 8 additions & 0 deletions typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,14 @@ export = function ({ typescript }: { typescript: typeof import('typescript/lib/t
return prior
}

proxy.findReferences = (fileName, position) => {
let prior = info.languageService.findReferences(fileName, position)
if (prior && c('removeDefinitionFromReferences')) {
prior = prior.map(({ references, ...other }) => ({ ...other, references: references.filter(({ isDefinition }) => !isDefinition) }))
}
return prior
}

info.languageService[thisPluginMarker] = true

return proxy
Expand Down

0 comments on commit f016cab

Please sign in to comment.