TypeScript References Code Lens Provider#18205
Conversation
There was a problem hiding this comment.
@jrieken What is the proper way to reject code lenses if resolving them fails? I tried using Promise.reject, but that leaves a bunch of ugly blank lines in the document:
There was a problem hiding this comment.
I am afraid you cannot. The idea is that the editor does shake while we resolve things, e.g in the first, hopefully quick, phase we create all the empty space which make the editor 'jump' and then in the second phase we fill in those holes. Two options
- know in the first phase which lenses you cannot fill in (this the very much preferred solution), or
- use the new API of being able to tell the editor your set of lenses has changed. Will cause jumping/flicker and still requires you know valid lenses in the first phase
So, actually you only have one option ;-) and that is to only advertise lenses where you are sure you can fill them in
Fixes microsoft#18054 Adds an references code lens provide for JS and TS
17825b3 to
6f25d8f
Compare
|
Very nice. One additional idea is to resolve the code lens even if it fails with a string like 'No references found' or 'Reference resolving failed' if it doesn't happen too often. |
|
@dbaeumer Thanks. There are a few cases where TS has an internal error when attempting to determine the references (such as for |


Fixes #18054
Adds an initial references code lens provider implementation for JS and TS
Remaining work and issues:
export const ...export functionpublic construtor() {...}- (needs TS: Find All References Does not Work For constructors with Access Modifiers TypeScript#13330)We also need to investigate the perf impact of the code lens further. It will be opt in to start with