-
Notifications
You must be signed in to change notification settings - Fork 12.8k
TypeScript slow to respond when switching between projects #34843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thank you very much for reporting on this! I believe I've run into similar issues as well. @amcasey's been working on perf for a bunch of different projects and he's currently got his hands full, but may be able to look into this soon. Just wanted to be up-front about expectations here. |
Thanks for the update @DanielRosenwasser, let me know if there's anything we can do to help. |
btw, this might be a more-actionable version of #34783. |
@dgieselaar Thanks for the details! I'm having a bit of trouble with |
@amcasey It doesn't make a lot of difference, from what I can tell. I increased it to 8gb as well. Something I didn't notice before is that while a regular hover is pretty much instant, holding down If you're having trouble running |
@dgieselaar Thanks for the update. Your log didn't indicate memory issues, but sometimes it crashes before writing that error, so it seemed worth a shot. Assuming that the mapping is straightforward (i.e. that command-click on Mac = ctrl-click on Windows), you're probably seeing speculative go-to-definition execution when your cursor passes over an identifier while you're holding command. That's consistent with other reports of GTD causing this issue. I'll give |
@dgieselaar Still no luck. Some ignorant questions:
Thanks, Edit: I switched to Windows, installed Edit 2: I can repro the issue as original described. |
Once you've got ApmHeader and DatePicker open, you can flip between them and ctrl-mouse over |
The repro starts with just |
Thanks for looking into this Andrew, and glad you reproduced it. I am away
for our conf this week so a little low on bandwidth, but let me know if you
need anything else.
Op di 5 nov. 2019 18:53 schreef Andrew Casey <[email protected]>:
… The repro starts with just kibana/x-pack/tsconfig.json open but, as soon
as you open ***@***.***/react/index.d.ts,
kibana/tsconfig.json gets loaded too. The second initialization is for
that project. Probably, GTD should never trigger loading of another
project. The first step is for editors to specify which project they're
opening the file for. After that, there may be some cleanup required for
project references (I think we call the feature "declaration mapping").
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#34843?email_source=notifications&email_token=AACWDXECFW7KMXQGFGCYCOTQSIBPTA5CNFSM4JHCMDE2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDEYB5A#issuecomment-550076660>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACWDXGEWDGXXW34UJLRKMLQSIBPTANCNFSM4JHCMDEQ>
.
|
@dgieselaar I've got a reduced repro, so I don't think there'll be anything for you to do until there's a fix to test. Thanks again for the detailed steps! |
@dgieselaar Turns out I do have a question: do you ever build that root tsconfig.json or is it just a base file that others extend? If the latter, you can probably eliminate the delay just by renaming it to Here's what's going on:
I found (4) pretty surprising, but it's by design and some customers rely on it. We think there might be a special case where we shouldn't do it for node_modules specifically, but if you happened to go to a non-node_modules module in an analogous location, then you would still end up doing another project load. By renaming your root tsconfig.json to anything other than "tsconfig.json", you prevent (5) and, thus, (6). It will fall back on opening the target file in an already open project (i.e. the one from (1)). |
@amcasey We're not using project references AFAIK. I see you've opened a draft PR, that's awesome! Is it in a state that I can give it a try as well to see if it improves things? |
@dgieselaar Are all of you on the same team/project? I can't tell how many repros I'm working with here. You can try the PR. We're still discussing some of the implications, but it should be usable. However, for your particular project, I'd still recommend just renaming your root tsconfig.json to tsconfig.base.json, assuming that's an option. |
@amcasey thanks! Yeah, all the same repo, I should have clarified 😅. Will give it a shot. Renaming the tsconfig files is something I'm doing locally with a scripted process, but to do it for the whole of Kibana, our operations team probably should have a look at it. Will take it up with them. |
Code review is definitely a good idea, but it should just be a single file rename, plus updates to a dozen or so |
Yeah there's a bunch of things related to type checking, publishing types etc that I'm not familiar with. Plus this piece is owned by the operations team. But I'll get back to it :) Thanks for your help so far. |
@dgieselaar Any luck with renaming that root tsconfig file? |
Please file a new issue if you're still seeing this. |
Issue Type: Performance Issue
For Kibana, we have a TypeScript setup with nested
tsconfig.json
files. Over the course of the last few months, I and others have started seeing serious latency (10s+) when resolving type information (either via suggestions or code navigation). We've also tried the same setup in Webstorm, and after some initial delay due to indexing, feedback from TypeScript is almost instant in WS.Our setup (where
./
is the root directory of the Kibana repo):./tsconfig.json
: type checks./src/**/*
./x-pack/tsconfig.json
: extends the roottsconfig.json
and type checks./x-pack/**/*
./node_modules
and./x-pack/node_modules
The latency issues I have been experiencing are mostly when I'm working on a file that belongs to the
x-pack
project, and I want to resolve type information for an npm module. "Local" files are pretty fast to respond with type information (sub-second), but for npm modules, feedback consistently takes around 10 seconds. I've inspected the logs, and seemingly the delay happens because every time type information for an npm module is requested, the TypeScript service starts the root project, and closes it again after the tab is closed. I've taken the following steps to reproduce the issue:yarn kbn:bootstrap
in the root of the directoryx-pack/legacy/plugins/apm/public/components/shared/ApmHeader/index.tsx
x-pack/legacy/plugins/apm/public/components/shared/ApmHeader/DatePicker/index.tsx
via the import statement.react
fromDatePicker/index.tsx
, again via the import statementnode_modules/@types/react/index.d.ts
) to openIt's important to note that this doesn't seem to happen once, but every time type information from the inactive project is needed. That means that initially, type info for
DatePicker
is instant, but is delayed forreact
. After hovering overreact
, type information forDatePicker
is suddenly delayed.I've experimented with splitting up the two projects into smaller ones which seems to resolve the issue (PR here), but maybe it's possible that it could be fixed in VS Code as well. I'm optimistic that this is possible given the fact that Webstorm can display instant feedback.
Logs:
ts-logs.txt
VS Code version: Code 1.39.2 (6ab598523be7a800d7f3eb4d92d7ab9a66069390, 2019-10-15T15:33:00.827Z)
OS version: Darwin x64 18.7.0
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Process Info
Workspace Info
The text was updated successfully, but these errors were encountered: