Commit 4298dde
committed
perf(context): lazy initialization for ExtensionsContext and LSPContext
Optimize startup performance by deferring expensive initialization work
in both context providers until it is actually needed.
ExtensionsContext.tsx:
- Move get_extensions_directory invoke into the existing requestIdleCallback
deferred block instead of eagerly calling it in a separate onMount
- Batch setExtensions/setEnabledExtensions updates with SolidJS batch()
to prevent double renders during extension loading
- Add initialized signal to track when deferred loading completes
- Expose initialized accessor on ExtensionsContextValue interface
LSPContext.tsx:
- Extract diagnostics event listener setup from onMount into an idempotent
lazyInit() function guarded by a listenersInitialized flag
- Call lazyInit() from startServer() so listeners are registered on first
file open (triggered via useLSPEditor hook)
- Keep requestIdleCallback fallback in onMount so listeners eventually
register even without file opens
- Add initialized field to LSPState store
- Expose lazyInit method on LSPContextValue interface
- Normalize line endings from CRLF to LF1 parent 345f42c commit 4298dde
2 files changed
+48
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
247 | 248 | | |
248 | 249 | | |
249 | 250 | | |
| |||
418 | 419 | | |
419 | 420 | | |
420 | 421 | | |
| 422 | + | |
421 | 423 | | |
422 | 424 | | |
423 | 425 | | |
| |||
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | 493 | | |
502 | 494 | | |
503 | 495 | | |
504 | 496 | | |
505 | 497 | | |
506 | 498 | | |
507 | | - | |
508 | | - | |
509 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
510 | 504 | | |
511 | 505 | | |
512 | 506 | | |
| |||
1502 | 1496 | | |
1503 | 1497 | | |
1504 | 1498 | | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
1505 | 1507 | | |
| 1508 | + | |
1506 | 1509 | | |
1507 | 1510 | | |
1508 | 1511 | | |
| |||
1566 | 1569 | | |
1567 | 1570 | | |
1568 | 1571 | | |
| 1572 | + | |
1569 | 1573 | | |
1570 | 1574 | | |
1571 | 1575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
565 | 565 | | |
566 | 566 | | |
567 | 567 | | |
| 568 | + | |
568 | 569 | | |
569 | 570 | | |
570 | 571 | | |
571 | 572 | | |
| 573 | + | |
| 574 | + | |
572 | 575 | | |
573 | 576 | | |
574 | 577 | | |
| |||
699 | 702 | | |
700 | 703 | | |
701 | 704 | | |
| 705 | + | |
702 | 706 | | |
703 | 707 | | |
704 | 708 | | |
| 709 | + | |
705 | 710 | | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
712 | 716 | | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
| 717 | + | |
717 | 718 | | |
718 | 719 | | |
719 | 720 | | |
| |||
731 | 732 | | |
732 | 733 | | |
733 | 734 | | |
734 | | - | |
| 735 | + | |
735 | 736 | | |
736 | 737 | | |
737 | 738 | | |
| |||
746 | 747 | | |
747 | 748 | | |
748 | 749 | | |
| 750 | + | |
| 751 | + | |
749 | 752 | | |
750 | 753 | | |
751 | | - | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
752 | 766 | | |
753 | | - | |
| 767 | + | |
754 | 768 | | |
755 | | - | |
| 769 | + | |
756 | 770 | | |
757 | 771 | | |
758 | 772 | | |
| |||
767 | 781 | | |
768 | 782 | | |
769 | 783 | | |
| 784 | + | |
| 785 | + | |
770 | 786 | | |
771 | 787 | | |
772 | 788 | | |
| |||
1829 | 1845 | | |
1830 | 1846 | | |
1831 | 1847 | | |
| 1848 | + | |
1832 | 1849 | | |
1833 | 1850 | | |
1834 | 1851 | | |
| |||
0 commit comments