Microsoft/vscode

Codelens references for properties of object in root module scope

Open

#224.338 geöffnet am 29. Juli 2023

Auf GitHub ansehen
 (4 Kommentare) (28 Reaktionen) (1 zugewiesene Person)TypeScript (10.221 Forks)batch import
feature-requesthelp wantedtypescript

Repository-Metriken

Stars
 (74.848 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 11h 43m) (1.000 gemergte PRs in 30 T)

Beschreibung

References with codelens are a great feature 👍 A while back there was an issue (.https://github.com/microsoft/vscode/issues/86495 ) that the references where displayed for every object property which is not always convenient. On the other hand, objects in top scope, possibly exported, or objects with as const modifier could benefit from this feature, imho.

Example:

const rootScopeObj = {
  foo: 1
}
export const exportedObj = {
  foo: 1
}
export const exportedConstObj = {
  foo: 1
} as const

const makeConstantObj = (val: string) => {
  return {foo: val} as const // questionable if really useful
}

Do these cases make sense - to show references for foo property? Similar to how enum works. image

If not desirable for everyone, it could possibly be hidden behind some option(s), right? I honestly believe it can be useful for many people.

Contributor Guide