@lvce-editor/quick-pick-worker 4.22.2 → 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.
@@ -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,37 +3441,32 @@ const getPath = uri => {
3437
3441
  }
3438
3442
  return uri;
3439
3443
  };
3440
- const getLabel = uri => {
3444
+ const toProtoVisibleItem = uri => {
3441
3445
  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
- }
3446
+ const isRemoteSsh = uri.startsWith(remoteSshScheme);
3447
+ const authority = isRemoteSsh ? getRemoteSshAuthority(uri) : '';
3448
+ let folderName = path;
3446
3449
  if (path.startsWith('/')) {
3447
- return pathBaseName(path);
3450
+ folderName = pathBaseName(path);
3448
3451
  }
3449
- return path;
3450
- };
3451
- const getDescription = uri => {
3452
- const path = getPath(uri);
3452
+ if (path === '/' && isRemoteSsh) {
3453
+ folderName = authority;
3454
+ }
3455
+ let description = '';
3453
3456
  if (path.startsWith('/')) {
3454
- const directory = pathDirName(path);
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
- return '';
3463
- };
3464
- const toProtoVisibleItem = uri => {
3459
+ if (path === '/' && isRemoteSsh) {
3460
+ description = '/';
3461
+ }
3462
+ const label = isRemoteSsh ? `${folderName} [SSH: ${authority}]` : folderName;
3465
3463
  return {
3466
- description: getDescription(uri),
3464
+ description,
3467
3465
  direntType: Directory,
3468
3466
  fileIcon: '',
3469
3467
  icon: '',
3470
- label: getLabel(uri),
3468
+ iconName: isRemoteSsh ? folderName : undefined,
3469
+ label,
3471
3470
  matches: [],
3472
3471
  uri
3473
3472
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.22.2",
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"