@lvce-editor/quick-pick-worker 4.22.0 → 4.22.2

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.
@@ -1959,7 +1959,7 @@ const getScrollBarTop = (state, scrollBarHeight) => {
1959
1959
  const getRelativePointerY = (state, clientY) => {
1960
1960
  return clientY - state.top - state.headerHeight;
1961
1961
  };
1962
- const setDeltaY = async (state, deltaY) => {
1962
+ const setDeltaY = async (state, deltaY, force = false) => {
1963
1963
  object(state);
1964
1964
  number(deltaY);
1965
1965
  const {
@@ -1976,17 +1976,18 @@ const setDeltaY = async (state, deltaY) => {
1976
1976
  } else if (deltaY > finalDeltaY) {
1977
1977
  deltaY = Math.max(finalDeltaY, 0);
1978
1978
  }
1979
- if (state.deltaY === deltaY) {
1979
+ if (state.deltaY === deltaY && !force) {
1980
1980
  return state;
1981
1981
  }
1982
1982
  const minLineY = Math.round(deltaY / itemHeight);
1983
1983
  const maxLineY = minLineY + Math.round(listHeight / itemHeight);
1984
1984
  number(minLineY);
1985
1985
  number(maxLineY);
1986
+ const fileIconCache = force ? {} : state.fileIconCache;
1986
1987
  const {
1987
1988
  icons,
1988
1989
  newFileIconCache
1989
- } = await getQuickPickFileIcons(items.slice(minLineY, maxLineY), state.fileIconCache);
1990
+ } = await getQuickPickFileIcons(items.slice(minLineY, maxLineY), fileIconCache);
1990
1991
  return {
1991
1992
  ...state,
1992
1993
  deltaY,
@@ -2475,6 +2476,7 @@ const Dash = '-';
2475
2476
  const Dot = '.';
2476
2477
  const EmptyString = '';
2477
2478
  const Space = ' ';
2479
+ const Slash = '/';
2478
2480
  const Underline = '_';
2479
2481
  const T = 't';
2480
2482
  const isLowerCase = char => {
@@ -2490,6 +2492,7 @@ const isGap = (columnCharBefore, columnChar) => {
2490
2492
  case Dash:
2491
2493
  case Dot:
2492
2494
  case EmptyString:
2495
+ case Slash:
2493
2496
  case Space:
2494
2497
  case T:
2495
2498
  case Underline:
@@ -3186,7 +3189,7 @@ const getPicksGoToColumn = async value => {
3186
3189
  direntType: 0,
3187
3190
  fileIcon: '',
3188
3191
  icon: '',
3189
- label: pressEnterToGoToLine(position.row, position.column),
3192
+ label: pressEnterToGoToLine(position.row + 1, position.column + 1),
3190
3193
  matches: [],
3191
3194
  uri: ''
3192
3195
  }];
@@ -3243,7 +3246,7 @@ const getPicks$a = async value => {
3243
3246
  direntType: 0,
3244
3247
  fileIcon: '',
3245
3248
  icon: '',
3246
- label: pressEnterToGoToLine(position.rowIndex, position.columnIndex),
3249
+ label: pressEnterToGoToLine(position.rowIndex + 1, position.columnIndex + 1),
3247
3250
  matches: [],
3248
3251
  uri: ''
3249
3252
  }];
@@ -3423,13 +3426,23 @@ const getPath = uri => {
3423
3426
  if (uri.startsWith(remoteSshScheme)) {
3424
3427
  const pathStart = getRemoteSshPathStart(uri);
3425
3428
  if (pathStart !== -1) {
3426
- return decodePath(uri.slice(pathStart));
3429
+ const path = decodePath(uri.slice(pathStart));
3430
+ let end = path.length;
3431
+ while (end > 1 && path[end - 1] === '/') {
3432
+ end--;
3433
+ }
3434
+ return path.slice(0, end);
3427
3435
  }
3436
+ return '/';
3428
3437
  }
3429
3438
  return uri;
3430
3439
  };
3431
3440
  const getLabel = uri => {
3432
3441
  const path = getPath(uri);
3442
+ if (path === '/' && uri.startsWith(remoteSshScheme)) {
3443
+ const pathStart = getRemoteSshPathStart(uri);
3444
+ return uri.slice(remoteSshScheme.length, pathStart === -1 ? uri.length : pathStart);
3445
+ }
3433
3446
  if (path.startsWith('/')) {
3434
3447
  return pathBaseName(path);
3435
3448
  }
@@ -3441,7 +3454,8 @@ const getDescription = uri => {
3441
3454
  const directory = pathDirName(path);
3442
3455
  if (uri.startsWith(remoteSshScheme)) {
3443
3456
  const pathStart = getRemoteSshPathStart(uri);
3444
- return `${uri.slice(0, pathStart)}${directory}`;
3457
+ const authority = pathStart === -1 ? uri : uri.slice(0, pathStart);
3458
+ return `${authority}${path === '/' ? '/' : directory}`;
3445
3459
  }
3446
3460
  return directory;
3447
3461
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.22.0",
3
+ "version": "4.22.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"