@lvce-editor/api 8.81.0 → 8.82.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.
@@ -9,6 +9,7 @@ export declare const executeFileSystemProviderRename: (id: string, oldUri: strin
9
9
  export declare const executeFileSystemProviderWriteFile: (id: string, uri: string, content: string) => Promise<void>;
10
10
  export declare const executeFileSystemProviderReadDirWithFileTypes: (id: string, uri: string) => Promise<readonly FileSystemDirent[]>;
11
11
  export declare const executeFileSystemProviderGetPathSeparator: (id: string) => string;
12
+ export declare const getFileSystemProviderPathSeparator: (id: string) => string | undefined;
12
13
  export declare const executeFileSystemProviderIsReadonly: (id: string) => Promise<boolean>;
13
14
  export declare const getFileSystemProviderRegistrySnapshot: () => FileSystemProviderRegistrySnapshot;
14
15
  export declare const registerFileSystemProvider: (provider: FileSystemProvider) => Disposable;
@@ -77,6 +77,13 @@ export const executeFileSystemProviderReadDirWithFileTypes = async (id, uri) =>
77
77
  export const executeFileSystemProviderGetPathSeparator = (id) => {
78
78
  return getProvider(id).pathSeparator || '/';
79
79
  };
80
+ export const getFileSystemProviderPathSeparator = (id) => {
81
+ const provider = providers[id];
82
+ if (!provider) {
83
+ return undefined;
84
+ }
85
+ return provider.pathSeparator || '/';
86
+ };
80
87
  export const executeFileSystemProviderIsReadonly = async (id) => {
81
88
  const provider = getProvider(id);
82
89
  return provider.isReadonly ? provider.isReadonly() : false;
@@ -1,4 +1,5 @@
1
1
  import { executeCommand } from "../ExecuteCommand/ExecuteCommand.js";
2
+ import { getFileSystemProviderPathSeparator } from "../FileSystemProviderRegistry/FileSystemProviderRegistry.js";
2
3
  export const confirm = async (message) => {
3
4
  return Boolean(await executeCommand('ConfirmPrompt.prompt', message));
4
5
  };
@@ -18,5 +19,12 @@ export const showNotification = async (type, message) => {
18
19
  await executeCommand('Notification.create', type, message);
19
20
  };
20
21
  export const setWorkspaceUri = async (uri) => {
21
- await executeCommand('Workspace.setUri', uri);
22
+ const protocolEnd = uri.indexOf(':');
23
+ const protocol = protocolEnd === -1 ? '' : uri.slice(0, protocolEnd);
24
+ const pathSeparator = getFileSystemProviderPathSeparator(protocol);
25
+ if (pathSeparator === undefined) {
26
+ await executeCommand('Workspace.setUri', uri);
27
+ return;
28
+ }
29
+ await executeCommand('Workspace.setUri', uri, pathSeparator);
22
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/api",
3
- "version": "8.81.0",
3
+ "version": "8.82.0",
4
4
  "description": "Tree-shakeable extension API for Lvce Editor extensions.",
5
5
  "keywords": [
6
6
  "lvce-editor",