@lvce-editor/quick-pick-worker 4.22.2 → 4.23.0
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 +63 -39
- package/package.json +1 -1
|
@@ -3419,6 +3419,10 @@ const decodePath = path => {
|
|
|
3419
3419
|
const getRemoteSshPathStart = uri => {
|
|
3420
3420
|
return uri.indexOf('/', remoteSshScheme.length);
|
|
3421
3421
|
};
|
|
3422
|
+
const getRemoteSshAuthority = uri => {
|
|
3423
|
+
const pathStart = getRemoteSshPathStart(uri);
|
|
3424
|
+
return uri.slice(remoteSshScheme.length, pathStart === -1 ? uri.length : pathStart);
|
|
3425
|
+
};
|
|
3422
3426
|
const getPath = uri => {
|
|
3423
3427
|
if (uri.startsWith(fileScheme)) {
|
|
3424
3428
|
return decodePath(uri.slice(fileScheme.length));
|
|
@@ -3437,38 +3441,34 @@ const getPath = uri => {
|
|
|
3437
3441
|
}
|
|
3438
3442
|
return uri;
|
|
3439
3443
|
};
|
|
3440
|
-
const
|
|
3444
|
+
const toProtoVisibleItem = uri => {
|
|
3441
3445
|
const path = getPath(uri);
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
}
|
|
3446
|
+
const isRemoteSsh = uri.startsWith(remoteSshScheme);
|
|
3447
|
+
const authority = isRemoteSsh ? getRemoteSshAuthority(uri) : '';
|
|
3448
|
+
let folderName = path;
|
|
3446
3449
|
if (path.startsWith('/')) {
|
|
3447
|
-
|
|
3450
|
+
folderName = pathBaseName(path);
|
|
3448
3451
|
}
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3452
|
+
if (path === '/' && isRemoteSsh) {
|
|
3453
|
+
folderName = authority;
|
|
3454
|
+
}
|
|
3455
|
+
let description = '';
|
|
3453
3456
|
if (path.startsWith('/')) {
|
|
3454
|
-
|
|
3455
|
-
if (uri.startsWith(remoteSshScheme)) {
|
|
3456
|
-
const pathStart = getRemoteSshPathStart(uri);
|
|
3457
|
-
const authority = pathStart === -1 ? uri : uri.slice(0, pathStart);
|
|
3458
|
-
return `${authority}${path === '/' ? '/' : directory}`;
|
|
3459
|
-
}
|
|
3460
|
-
return directory;
|
|
3457
|
+
description = pathDirName(path);
|
|
3461
3458
|
}
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3459
|
+
if (path === '/' && isRemoteSsh) {
|
|
3460
|
+
description = '/';
|
|
3461
|
+
}
|
|
3462
|
+
const label = isRemoteSsh ? `${folderName} [SSH: ${authority}]` : folderName;
|
|
3465
3463
|
return {
|
|
3466
|
-
description
|
|
3464
|
+
description,
|
|
3467
3465
|
direntType: Directory,
|
|
3468
3466
|
fileIcon: '',
|
|
3469
3467
|
icon: '',
|
|
3470
|
-
|
|
3468
|
+
iconName: isRemoteSsh ? folderName : undefined,
|
|
3469
|
+
label,
|
|
3471
3470
|
matches: [],
|
|
3471
|
+
removeButton: true,
|
|
3472
3472
|
uri
|
|
3473
3473
|
};
|
|
3474
3474
|
};
|
|
@@ -3970,20 +3970,6 @@ const getIndex = (top, headerHeight, itemHeight, y) => {
|
|
|
3970
3970
|
return index;
|
|
3971
3971
|
};
|
|
3972
3972
|
|
|
3973
|
-
const getPick = (items, index) => {
|
|
3974
|
-
array(items);
|
|
3975
|
-
number(index);
|
|
3976
|
-
// if (index < state.recentPicks.length) {
|
|
3977
|
-
// return state.recentPicks[index]
|
|
3978
|
-
// }
|
|
3979
|
-
// index -= state.recentPicks.length
|
|
3980
|
-
if (index < items.length) {
|
|
3981
|
-
return items[index];
|
|
3982
|
-
}
|
|
3983
|
-
console.warn('no pick matching index', index);
|
|
3984
|
-
return undefined;
|
|
3985
|
-
};
|
|
3986
|
-
|
|
3987
3973
|
const Commands = 'quickPick://commands';
|
|
3988
3974
|
const EveryThing = 'quickPick://everything';
|
|
3989
3975
|
const Recent = 'quickPick://recent';
|
|
@@ -4172,6 +4158,20 @@ const loadContentWithContext = async context => {
|
|
|
4172
4158
|
notifyVisible();
|
|
4173
4159
|
};
|
|
4174
4160
|
|
|
4161
|
+
const getPick = (items, index) => {
|
|
4162
|
+
array(items);
|
|
4163
|
+
number(index);
|
|
4164
|
+
// if (index < state.recentPicks.length) {
|
|
4165
|
+
// return state.recentPicks[index]
|
|
4166
|
+
// }
|
|
4167
|
+
// index -= state.recentPicks.length
|
|
4168
|
+
if (index < items.length) {
|
|
4169
|
+
return items[index];
|
|
4170
|
+
}
|
|
4171
|
+
console.warn('no pick matching index', index);
|
|
4172
|
+
return undefined;
|
|
4173
|
+
};
|
|
4174
|
+
|
|
4175
4175
|
const createCustomPick = value => {
|
|
4176
4176
|
return {
|
|
4177
4177
|
description: '',
|
|
@@ -4257,7 +4257,18 @@ const selectIndex = async (state, index, button = /* left */0) => {
|
|
|
4257
4257
|
// }
|
|
4258
4258
|
};
|
|
4259
4259
|
|
|
4260
|
-
const handleClickAt = (state, x, y) => {
|
|
4260
|
+
const handleClickAt = async (state, x, y, uri) => {
|
|
4261
|
+
if (uri) {
|
|
4262
|
+
if (state.providerId !== Recent$1 || state.items.every(item => item.uri !== uri)) {
|
|
4263
|
+
return state;
|
|
4264
|
+
}
|
|
4265
|
+
await invoke$3('RecentlyOpened.removeRecentlyOpened', uri);
|
|
4266
|
+
const next = await loadContent({
|
|
4267
|
+
...state,
|
|
4268
|
+
value: ''
|
|
4269
|
+
});
|
|
4270
|
+
return state.value ? setValue(next, state.value) : next;
|
|
4271
|
+
}
|
|
4261
4272
|
const {
|
|
4262
4273
|
headerHeight,
|
|
4263
4274
|
itemHeight,
|
|
@@ -4929,7 +4940,9 @@ const getQuickPickItemVirtualDom = visibleItem => {
|
|
|
4929
4940
|
isActive,
|
|
4930
4941
|
label,
|
|
4931
4942
|
posInSet,
|
|
4932
|
-
|
|
4943
|
+
removeButton,
|
|
4944
|
+
setSize,
|
|
4945
|
+
uri
|
|
4933
4946
|
} = visibleItem;
|
|
4934
4947
|
const dom = [{
|
|
4935
4948
|
ariaPosInSet: posInSet,
|
|
@@ -4965,6 +4978,17 @@ const getQuickPickItemVirtualDom = visibleItem => {
|
|
|
4965
4978
|
type: Div
|
|
4966
4979
|
}, text(description));
|
|
4967
4980
|
}
|
|
4981
|
+
if (removeButton) {
|
|
4982
|
+
parent.childCount++;
|
|
4983
|
+
dom.push({
|
|
4984
|
+
ariaLabel: 'Remove from Recently Opened',
|
|
4985
|
+
childCount: 1,
|
|
4986
|
+
className: 'QuickPickItemRemove',
|
|
4987
|
+
'data-uri': uri,
|
|
4988
|
+
title: 'Remove from Recently Opened',
|
|
4989
|
+
type: Button
|
|
4990
|
+
}, text('×'));
|
|
4991
|
+
}
|
|
4968
4992
|
return dom;
|
|
4969
4993
|
};
|
|
4970
4994
|
|
|
@@ -5155,7 +5179,7 @@ const render2 = (uid, diffResult) => {
|
|
|
5155
5179
|
const renderEventListeners = () => {
|
|
5156
5180
|
return [{
|
|
5157
5181
|
name: HandlePointerDown,
|
|
5158
|
-
params: ['handleClickAt', 'event.clientX', 'event.clientY'],
|
|
5182
|
+
params: ['handleClickAt', 'event.clientX', 'event.clientY', 'event.target.dataset.uri'],
|
|
5159
5183
|
preventDefault: true
|
|
5160
5184
|
}, {
|
|
5161
5185
|
name: HandleWheel,
|