vzcode 0.64.0 → 0.66.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/assets/{index-ozxHHf72.js → index-J9vPrCBY.js} +46 -46
- package/dist/assets/worker-ajCMsicA.js +282 -0
- package/dist/assets/{worker-pDIx6AF9.js → worker-lwRU8zh4.js} +45 -45
- package/dist/index.html +1 -1
- package/package.json +8 -8
- package/src/client/VZCodeContext.tsx +51 -1
- package/src/client/VZLeft.tsx +4 -42
- package/src/client/VZSettings.tsx +16 -55
- package/src/client/VZSidebar/CreateFileModal.tsx +19 -14
- package/src/client/VZSidebar/index.tsx +16 -86
- package/src/client/useActions.ts +10 -0
- package/src/client/useKeyboardShortcuts.ts +47 -0
- package/src/client/usePrettier/worker.ts +15 -10
- package/src/client/useTypeScript/worker.ts +14 -6
- package/src/client/vzReducer/index.ts +12 -0
- package/src/client/vzReducer/setActiveFileLeftRightReducer.ts +47 -0
- package/dist/assets/worker-DzDiglXJ.js +0 -233
|
@@ -94,17 +94,25 @@ const convertToCodeMirrorDiagnostic = (
|
|
|
94
94
|
}));
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
+
// This is a promise that resolves when the file system is initialized.
|
|
98
|
+
let fileSystemInitializationPromise = null;
|
|
99
|
+
async function ensureFileSystemInitialized() {
|
|
100
|
+
if (!fileSystemInitializationPromise) {
|
|
101
|
+
fileSystemInitializationPromise =
|
|
102
|
+
initializeFileSystem();
|
|
103
|
+
}
|
|
104
|
+
await fileSystemInitializationPromise;
|
|
105
|
+
}
|
|
106
|
+
|
|
97
107
|
onmessage = async ({ data }) => {
|
|
98
108
|
if (debug) {
|
|
99
109
|
console.log('message received');
|
|
100
110
|
}
|
|
101
|
-
// Initialize the file system.
|
|
102
|
-
if (!isFileSystemInitialized) {
|
|
103
|
-
isFileSystemInitialized = true;
|
|
104
|
-
await initializeFileSystem();
|
|
105
|
-
}
|
|
106
111
|
|
|
107
|
-
//
|
|
112
|
+
// Ensure the file system is initialized.
|
|
113
|
+
await ensureFileSystemInitialized();
|
|
114
|
+
|
|
115
|
+
// Sanity check - should never happen.
|
|
108
116
|
if (env === null) {
|
|
109
117
|
throw new Error('File system not initialized');
|
|
110
118
|
}
|
|
@@ -3,6 +3,10 @@ import { ThemeLabel } from '../themes';
|
|
|
3
3
|
import { closeTabsReducer } from './closeTabsReducer';
|
|
4
4
|
import { openTabReducer } from './openTabReducer';
|
|
5
5
|
import { setActiveFileIdReducer } from './setActiveFileIdReducer';
|
|
6
|
+
import {
|
|
7
|
+
setActiveFileLeftReducer,
|
|
8
|
+
setActiveFileRightReducer,
|
|
9
|
+
} from './setActiveFileLeftRightReducer';
|
|
6
10
|
import { setIsSettingsOpenReducer } from './setIsSettingsOpenReducer';
|
|
7
11
|
import { setThemeReducer } from './setThemeReducer';
|
|
8
12
|
import { editorNoLongerWantsFocusReducer } from './editorNoLongerWantsFocusReducer';
|
|
@@ -38,6 +42,12 @@ export type VZAction =
|
|
|
38
42
|
// * Sets the active file ID.
|
|
39
43
|
| { type: 'set_active_file_id'; activeFileId: FileId }
|
|
40
44
|
|
|
45
|
+
// `set_active_file_left' 'set_active_file_right`
|
|
46
|
+
// * Sets the active file ID to be the tab directly to the left or right
|
|
47
|
+
// * of the currently active tab.
|
|
48
|
+
| { type: 'set_active_file_left' }
|
|
49
|
+
| { type: 'set_active_file_right' }
|
|
50
|
+
|
|
41
51
|
// `open_tab`
|
|
42
52
|
// * Opens a tab.
|
|
43
53
|
// * Also serves to change an already open transient tab to persistent.
|
|
@@ -88,6 +98,8 @@ export type TabState = {
|
|
|
88
98
|
|
|
89
99
|
const reducers = [
|
|
90
100
|
setActiveFileIdReducer,
|
|
101
|
+
setActiveFileLeftReducer,
|
|
102
|
+
setActiveFileRightReducer,
|
|
91
103
|
openTabReducer,
|
|
92
104
|
closeTabsReducer,
|
|
93
105
|
setThemeReducer,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { VZAction, VZState } from '.';
|
|
2
|
+
|
|
3
|
+
export const setActiveFileLeftReducer = (
|
|
4
|
+
state: VZState,
|
|
5
|
+
action: VZAction,
|
|
6
|
+
): VZState => {
|
|
7
|
+
if (action.type !== 'set_active_file_left') {
|
|
8
|
+
return state;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let index = state.tabList.findIndex(
|
|
12
|
+
(tab) => tab.fileId === state.activeFileId,
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
index -= 1;
|
|
16
|
+
if (index < 0) {
|
|
17
|
+
index = state.tabList.length - 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
activeFileId: state.tabList[index].fileId,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const setActiveFileRightReducer = (
|
|
27
|
+
state: VZState,
|
|
28
|
+
action: VZAction,
|
|
29
|
+
): VZState => {
|
|
30
|
+
if (action.type !== 'set_active_file_right') {
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let index = state.tabList.findIndex(
|
|
35
|
+
(tab) => tab.fileId === state.activeFileId,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
index += 1;
|
|
39
|
+
if (index > state.tabList.length - 1) {
|
|
40
|
+
index = 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
...state,
|
|
45
|
+
activeFileId: state.tabList[index].fileId,
|
|
46
|
+
};
|
|
47
|
+
};
|