@lvce-editor/quick-pick-worker 4.4.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/quickPickWorkerMain.js +97 -53
- package/package.json +1 -1
|
@@ -598,7 +598,10 @@ const constructError = (message, type, name) => {
|
|
|
598
598
|
if (ErrorConstructor === Error) {
|
|
599
599
|
const error = new Error(message);
|
|
600
600
|
if (name && name !== 'VError') {
|
|
601
|
-
error
|
|
601
|
+
Object.defineProperty(error, 'name', {
|
|
602
|
+
configurable: true,
|
|
603
|
+
value: name
|
|
604
|
+
});
|
|
602
605
|
}
|
|
603
606
|
return error;
|
|
604
607
|
}
|
|
@@ -615,8 +618,10 @@ const getCurrentStack = () => {
|
|
|
615
618
|
const currentStack = joinLines(splitLines$1(new Error().stack || '').slice(stackLinesToSkip));
|
|
616
619
|
return currentStack;
|
|
617
620
|
};
|
|
618
|
-
const getNewLineIndex = (string, startIndex
|
|
619
|
-
|
|
621
|
+
const getNewLineIndex = (string, startIndex) => {
|
|
622
|
+
{
|
|
623
|
+
return string.indexOf(NewLine);
|
|
624
|
+
}
|
|
620
625
|
};
|
|
621
626
|
const getParentStack = error => {
|
|
622
627
|
let parentStack = error.stack || error.data || error.message || '';
|
|
@@ -627,55 +632,91 @@ const getParentStack = error => {
|
|
|
627
632
|
};
|
|
628
633
|
const MethodNotFound = -32601;
|
|
629
634
|
const Custom$2 = -32001;
|
|
635
|
+
const setStack = (error, stack) => {
|
|
636
|
+
const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
|
|
637
|
+
if (descriptor) {
|
|
638
|
+
if (!descriptor.configurable && !descriptor.writable) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (!descriptor.configurable && descriptor.writable) {
|
|
642
|
+
error.stack = stack;
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
Object.defineProperty(error, 'stack', {
|
|
647
|
+
configurable: true,
|
|
648
|
+
value: stack,
|
|
649
|
+
writable: true
|
|
650
|
+
});
|
|
651
|
+
};
|
|
652
|
+
const restoreExistingError = (error, currentStack) => {
|
|
653
|
+
if (typeof error.stack === 'string') {
|
|
654
|
+
setStack(error, `${error.stack}${NewLine}${currentStack}`);
|
|
655
|
+
}
|
|
656
|
+
return error;
|
|
657
|
+
};
|
|
658
|
+
const restoreMethodNotFoundError = (error, currentStack) => {
|
|
659
|
+
const restoredError = new JsonRpcError(error.message);
|
|
660
|
+
const parentStack = getParentStack(error);
|
|
661
|
+
setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
|
|
662
|
+
return restoredError;
|
|
663
|
+
};
|
|
664
|
+
const restoreStackFromData = (restoredError, error, currentStack) => {
|
|
665
|
+
if (error.data.stack && error.data.type && error.message) {
|
|
666
|
+
setStack(restoredError, `${error.data.type}: ${error.message}${NewLine}${error.data.stack}${NewLine}${currentStack}`);
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
if (error.data.stack) {
|
|
670
|
+
setStack(restoredError, error.data.stack);
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
const applyDataProperties = (restoredError, error) => {
|
|
674
|
+
restoreStackFromData(restoredError, error, getCurrentStack());
|
|
675
|
+
if (error.data.codeFrame) {
|
|
676
|
+
// @ts-ignore
|
|
677
|
+
restoredError.codeFrame = error.data.codeFrame;
|
|
678
|
+
}
|
|
679
|
+
if (error.data.code) {
|
|
680
|
+
// @ts-ignore
|
|
681
|
+
restoredError.code = error.data.code;
|
|
682
|
+
}
|
|
683
|
+
if (error.data.type) {
|
|
684
|
+
// @ts-ignore
|
|
685
|
+
restoredError.name = error.data.type;
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
const applyDirectProperties = (restoredError, error) => {
|
|
689
|
+
if (error.stack) {
|
|
690
|
+
const lowerStack = restoredError.stack || '';
|
|
691
|
+
const indexNewLine = getNewLineIndex(lowerStack);
|
|
692
|
+
const parentStack = getParentStack(error);
|
|
693
|
+
// @ts-ignore
|
|
694
|
+
setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
|
|
695
|
+
}
|
|
696
|
+
if (error.codeFrame) {
|
|
697
|
+
// @ts-ignore
|
|
698
|
+
restoredError.codeFrame = error.codeFrame;
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
const restoreMessageError = (error, _currentStack) => {
|
|
702
|
+
const restoredError = constructError(error.message, error.type, error.name);
|
|
703
|
+
if (error.data) {
|
|
704
|
+
applyDataProperties(restoredError, error);
|
|
705
|
+
} else {
|
|
706
|
+
applyDirectProperties(restoredError, error);
|
|
707
|
+
}
|
|
708
|
+
return restoredError;
|
|
709
|
+
};
|
|
630
710
|
const restoreJsonRpcError = error => {
|
|
631
711
|
const currentStack = getCurrentStack();
|
|
632
712
|
if (error && error instanceof Error) {
|
|
633
|
-
|
|
634
|
-
error.stack = error.stack + NewLine + currentStack;
|
|
635
|
-
}
|
|
636
|
-
return error;
|
|
713
|
+
return restoreExistingError(error, currentStack);
|
|
637
714
|
}
|
|
638
715
|
if (error && error.code && error.code === MethodNotFound) {
|
|
639
|
-
|
|
640
|
-
const parentStack = getParentStack(error);
|
|
641
|
-
restoredError.stack = parentStack + NewLine + currentStack;
|
|
642
|
-
return restoredError;
|
|
716
|
+
return restoreMethodNotFoundError(error, currentStack);
|
|
643
717
|
}
|
|
644
718
|
if (error && error.message) {
|
|
645
|
-
|
|
646
|
-
if (error.data) {
|
|
647
|
-
if (error.data.stack && error.data.type && error.message) {
|
|
648
|
-
restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
|
|
649
|
-
} else if (error.data.stack) {
|
|
650
|
-
restoredError.stack = error.data.stack;
|
|
651
|
-
}
|
|
652
|
-
if (error.data.codeFrame) {
|
|
653
|
-
// @ts-ignore
|
|
654
|
-
restoredError.codeFrame = error.data.codeFrame;
|
|
655
|
-
}
|
|
656
|
-
if (error.data.code) {
|
|
657
|
-
// @ts-ignore
|
|
658
|
-
restoredError.code = error.data.code;
|
|
659
|
-
}
|
|
660
|
-
if (error.data.type) {
|
|
661
|
-
// @ts-ignore
|
|
662
|
-
restoredError.name = error.data.type;
|
|
663
|
-
}
|
|
664
|
-
} else {
|
|
665
|
-
if (error.stack) {
|
|
666
|
-
const lowerStack = restoredError.stack || '';
|
|
667
|
-
// @ts-ignore
|
|
668
|
-
const indexNewLine = getNewLineIndex(lowerStack);
|
|
669
|
-
const parentStack = getParentStack(error);
|
|
670
|
-
// @ts-ignore
|
|
671
|
-
restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
|
|
672
|
-
}
|
|
673
|
-
if (error.codeFrame) {
|
|
674
|
-
// @ts-ignore
|
|
675
|
-
restoredError.codeFrame = error.codeFrame;
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
return restoredError;
|
|
719
|
+
return restoreMessageError(error);
|
|
679
720
|
}
|
|
680
721
|
if (typeof error === 'string') {
|
|
681
722
|
return new Error(`JsonRpc Error: ${error}`);
|
|
@@ -1135,13 +1176,6 @@ const create$4 = rpcId => {
|
|
|
1135
1176
|
};
|
|
1136
1177
|
};
|
|
1137
1178
|
|
|
1138
|
-
const Div = 4;
|
|
1139
|
-
const Input = 6;
|
|
1140
|
-
const Span = 8;
|
|
1141
|
-
const Text = 12;
|
|
1142
|
-
const Img = 17;
|
|
1143
|
-
const Reference = 100;
|
|
1144
|
-
|
|
1145
1179
|
const EditorWorker = 99;
|
|
1146
1180
|
const ExtensionManagementWorker = 9006;
|
|
1147
1181
|
const RendererWorker = 1;
|
|
@@ -3232,6 +3266,9 @@ const requestVersions = new Map();
|
|
|
3232
3266
|
const requestVersionGenerator = {
|
|
3233
3267
|
value: 0
|
|
3234
3268
|
};
|
|
3269
|
+
const isSamePicker = (state, latestState) => {
|
|
3270
|
+
return latestState.uri === state.uri && latestState.args === state.args;
|
|
3271
|
+
};
|
|
3235
3272
|
const isQuickInput = args => {
|
|
3236
3273
|
const options = args.at(-1);
|
|
3237
3274
|
return options?.mode === 'quickInput';
|
|
@@ -3291,7 +3328,7 @@ const setValueWithContext = async (context, newValue) => {
|
|
|
3291
3328
|
requestVersions.set(state.uid, requestVersion);
|
|
3292
3329
|
const result = await setValue(state, newValue);
|
|
3293
3330
|
await context.updateState(latestState => {
|
|
3294
|
-
if (requestVersions.get(latestState.uid) !== requestVersion) {
|
|
3331
|
+
if (requestVersions.get(latestState.uid) !== requestVersion || !isSamePicker(state, latestState)) {
|
|
3295
3332
|
return latestState;
|
|
3296
3333
|
}
|
|
3297
3334
|
return {
|
|
@@ -3697,6 +3734,13 @@ const renderHeight = (_oldState, newState) => {
|
|
|
3697
3734
|
return ['Viewlet.send', uid, /* method */SetItemsHeight, /* height */height];
|
|
3698
3735
|
};
|
|
3699
3736
|
|
|
3737
|
+
const Div = 4;
|
|
3738
|
+
const Input = 6;
|
|
3739
|
+
const Span = 8;
|
|
3740
|
+
const Text = 12;
|
|
3741
|
+
const Img = 17;
|
|
3742
|
+
const Reference = 100;
|
|
3743
|
+
|
|
3700
3744
|
const mergeClassNames = (...classNames) => {
|
|
3701
3745
|
return classNames.filter(Boolean).join(' ');
|
|
3702
3746
|
};
|