@lvce-editor/quick-pick-worker 4.22.1 → 4.22.3

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,
@@ -3188,7 +3189,7 @@ const getPicksGoToColumn = async value => {
3188
3189
  direntType: 0,
3189
3190
  fileIcon: '',
3190
3191
  icon: '',
3191
- label: pressEnterToGoToLine(position.row, position.column),
3192
+ label: pressEnterToGoToLine(position.row + 1, position.column + 1),
3192
3193
  matches: [],
3193
3194
  uri: ''
3194
3195
  }];
@@ -3245,7 +3246,7 @@ const getPicks$a = async value => {
3245
3246
  direntType: 0,
3246
3247
  fileIcon: '',
3247
3248
  icon: '',
3248
- label: pressEnterToGoToLine(position.rowIndex, position.columnIndex),
3249
+ label: pressEnterToGoToLine(position.rowIndex + 1, position.columnIndex + 1),
3249
3250
  matches: [],
3250
3251
  uri: ''
3251
3252
  }];
@@ -3418,6 +3419,10 @@ const decodePath = path => {
3418
3419
  const getRemoteSshPathStart = uri => {
3419
3420
  return uri.indexOf('/', remoteSshScheme.length);
3420
3421
  };
3422
+ const getRemoteSshAuthority = uri => {
3423
+ const pathStart = getRemoteSshPathStart(uri);
3424
+ return uri.slice(remoteSshScheme.length, pathStart === -1 ? uri.length : pathStart);
3425
+ };
3421
3426
  const getPath = uri => {
3422
3427
  if (uri.startsWith(fileScheme)) {
3423
3428
  return decodePath(uri.slice(fileScheme.length));
@@ -3436,37 +3441,32 @@ const getPath = uri => {
3436
3441
  }
3437
3442
  return uri;
3438
3443
  };
3439
- const getLabel = uri => {
3444
+ const toProtoVisibleItem = uri => {
3440
3445
  const path = getPath(uri);
3441
- if (path === '/' && uri.startsWith(remoteSshScheme)) {
3442
- const pathStart = getRemoteSshPathStart(uri);
3443
- return uri.slice(remoteSshScheme.length, pathStart === -1 ? uri.length : pathStart);
3444
- }
3446
+ const isRemoteSsh = uri.startsWith(remoteSshScheme);
3447
+ const authority = isRemoteSsh ? getRemoteSshAuthority(uri) : '';
3448
+ let folderName = path;
3445
3449
  if (path.startsWith('/')) {
3446
- return pathBaseName(path);
3450
+ folderName = pathBaseName(path);
3447
3451
  }
3448
- return path;
3449
- };
3450
- const getDescription = uri => {
3451
- const path = getPath(uri);
3452
+ if (path === '/' && isRemoteSsh) {
3453
+ folderName = authority;
3454
+ }
3455
+ let description = '';
3452
3456
  if (path.startsWith('/')) {
3453
- const directory = pathDirName(path);
3454
- if (uri.startsWith(remoteSshScheme)) {
3455
- const pathStart = getRemoteSshPathStart(uri);
3456
- const authority = pathStart === -1 ? uri : uri.slice(0, pathStart);
3457
- return `${authority}${path === '/' ? '/' : directory}`;
3458
- }
3459
- return directory;
3457
+ description = pathDirName(path);
3460
3458
  }
3461
- return '';
3462
- };
3463
- const toProtoVisibleItem = uri => {
3459
+ if (path === '/' && isRemoteSsh) {
3460
+ description = '/';
3461
+ }
3462
+ const label = isRemoteSsh ? `${folderName} [SSH: ${authority}]` : folderName;
3464
3463
  return {
3465
- description: getDescription(uri),
3464
+ description,
3466
3465
  direntType: Directory,
3467
3466
  fileIcon: '',
3468
3467
  icon: '',
3469
- label: getLabel(uri),
3468
+ iconName: isRemoteSsh ? folderName : undefined,
3469
+ label,
3470
3470
  matches: [],
3471
3471
  uri
3472
3472
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.22.1",
3
+ "version": "4.22.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"