You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Go to definition hover preview should not open a document on TS Server #84875
bugIssue identified by VS Code Team member as probable bugjavascriptJavaScript support issuestypescriptTypescript support issuesverifiedVerification succeeded
changed the title [-]Go to definition hover preview should not open an text document that is visible to extensions[/-][+]Go to definition hover preview should not open a text document that is visible to extensions[/+]on Nov 14, 2019
There is only that one way to load a document, esp when being in the editor layer, this won't change. I don't understand why typescript reacts to this "in a bad way" but I guess what you want is something is knowledge about open editors/tabs, e.g this #15178.
The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines.
Closing as designed since there is no alternative and since text documents can be opened via various different paths (e.g by another extensions). Band aiding won't help the root issue which I believe is the lack of reflecting open editors or maybe TS being less aggressive in starting "an expensive project load"
This was a pain point that TS specifically brought up so we should prioritize addressing it (like they do for our issues). TypeScript is seeing users report unexpected project loads reported, and it seems these are most often triggered by hover (although you are correct that extensions can also trigger this by opening text documents)
#15178 would let us fix the issue. However are there any other workarounds we can try before #15178 is addressed? I'm tempted to try checking the file against visibleTextEditors but have a feeling that may not work
This was a pain point that TS specifically brought up so we should prioritize addressing it (like they do for our issues).
I am all for that, I just don't wanna do a hack which then only works half of the time.
I'm tempted to try checking the file against visibleTextEditors but have a feeling that may not work
That could work - it's by definition a subset of what open editors will be so you might miss things. You could try to wait a little when a document appears, esp one without an editor. In the hover case the model should be unref'ed/disposed very shortly after opening it. That could make things less aggressive
Could there be an intermediate state where VS Code regards the document as open but doesn't tell the TS server about it? That would be enough to prevent project load.
changed the title [-]Go to definition hover preview should not open a text document that is visible to extensions[/-][+]Go to definition hover preview should not open a document on TS Server[/+]on Nov 15, 2019
To verify this, use the listed repo steps. In the TS Server log, look for lines that show updateOpen requests:
{"seq":2,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"/Users/matb/projects/san/index.ts","fileContent":"import { a } from \"./a\";\n\nconsole.log(a)\n","projectRootPath":"/Users/matb/projects/san","scriptKindName":"TS"}]}}
Make sure that a.ts is never listed in one of these updateOpen requests on hover
bugIssue identified by VS Code Team member as probable bugjavascriptJavaScript support issuestypescriptTypescript support issuesverifiedVerification succeeded
Activity
mjbvz commentedon Nov 14, 2019
Place in code where this is triggered:
vscode/src/vs/editor/contrib/gotoSymbol/link/goToDefinitionAtPosition.ts
Line 177 in a537d00
[-]Go to definition hover preview should not open an text document that is visible to extensions[/-][+]Go to definition hover preview should not open a text document that is visible to extensions[/+]jrieken commentedon Nov 15, 2019
There is only that one way to load a document, esp when being in the editor layer, this won't change. I don't understand why typescript reacts to this "in a bad way" but I guess what you want is something is knowledge about open editors/tabs, e.g this #15178.
vscodebot commentedon Nov 15, 2019
The described behavior is how it is expected to work. If you disagree, please explain what is expected and what is not in more detail. See also our issue reporting guidelines.
Happy Coding!
jrieken commentedon Nov 15, 2019
Closing as designed since there is no alternative and since text documents can be opened via various different paths (e.g by another extensions). Band aiding won't help the root issue which I believe is the lack of reflecting open editors or maybe TS being less aggressive in starting "an expensive project load"
mjbvz commentedon Nov 15, 2019
This was a pain point that TS specifically brought up so we should prioritize addressing it (like they do for our issues). TypeScript is seeing users report unexpected project loads reported, and it seems these are most often triggered by hover (although you are correct that extensions can also trigger this by opening text documents)
#15178 would let us fix the issue. However are there any other workarounds we can try before #15178 is addressed? I'm tempted to try checking the file against
visibleTextEditorsbut have a feeling that may not workjrieken commentedon Nov 15, 2019
I am all for that, I just don't wanna do a hack which then only works half of the time.
That could work - it's by definition a subset of what open editors will be so you might miss things. You could try to wait a little when a document appears, esp one without an editor. In the hover case the model should be unref'ed/disposed very shortly after opening it. That could make things less aggressive
amcasey commentedon Nov 15, 2019
Could there be an intermediate state where VS Code regards the document as open but doesn't tell the TS server about it? That would be enough to prevent project load.
mjbvz commentedon Nov 15, 2019
Reopening and making this JS/TS specific. Will look into the fix today
[-]Go to definition hover preview should not open a text document that is visible to extensions[/-][+]Go to definition hover preview should not open a document on TS Server[/+]mjbvz commentedon Nov 15, 2019
To verify this, use the listed repo steps. In the TS Server log, look for lines that show
updateOpenrequests:Make sure that
a.tsis never listed in one of theseupdateOpenrequests on hover