Commit 2bda9da
committed
fix(Sky): Support named-key payloads and register resolver for custom editors
The previous implementation in InstallWebview incorrectly assumed positional arguments for custom editor payloads. After the Cocoon extension host switched to named-key payloads (containing `viewType`, `options`, and `selector`), the editor failed to register custom editor capabilities because `Args[1]` was empty.
Update the payload parsing logic to defensively handle both the new named-key format and the legacy positional format. Extract `viewType`, `options`, and `selector` from the primary payload fields, falling back to the `args` array only if necessary.
Additionally, register the custom editor with `IEditorResolverService` using a `priority.option` fallback. This ensures the VS Code activation event (`onCustomEditor:*`) fires correctly when manifest-based registration is delayed due to lazy extension activation. The resolver includes a safe `createEditorInput` implementation that defers to the builtin factory to prevent crashes if the resolver is invoked before the extension is fully ready.
These changes restore full functionality for custom editors (e.g., Markdown preview, image viewers) and ensure proper lifecycle management during extension activation.1 parent f8b6900 commit 2bda9da
1 file changed
Lines changed: 92 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
754 | 754 | | |
755 | 755 | | |
756 | 756 | | |
757 | | - | |
758 | | - | |
759 | | - | |
760 | | - | |
761 | | - | |
762 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
763 | 788 | | |
764 | 789 | | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
765 | 793 | | |
766 | 794 | | |
767 | 795 | | |
| |||
771 | 799 | | |
772 | 800 | | |
773 | 801 | | |
774 | | - | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
775 | 860 | | |
776 | 861 | | |
777 | 862 | | |
| |||
0 commit comments