vzcode 2.6.0 → 2.8.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-Bfp1zhR4.js → index-CCjGlbxJ.js} +175 -176
- package/dist/cli.js +0 -2
- package/dist/index.html +1 -1
- package/dist/server/aiChatHandler/chatOperations.js +1 -1
- package/dist/server/computeInitialDocument.js +1 -1
- package/dist/server/index.js +2 -2
- package/package.json +10 -3
- package/src/cli.ts +0 -3
- package/src/client/AIAssist/AIAssistCodeMirrorKeyMap.ts +4 -4
- package/src/client/AIAssist/startAIAssist.ts +1 -7
- package/src/client/App/useShareDB.ts +1 -1
- package/src/client/CodeEditor/InteractiveWidgets/rotateWidget.ts +1 -1
- package/src/client/CodeEditor/getOrCreateEditor.tsx +5 -15
- package/src/client/CodeEditor/index.tsx +4 -3
- package/src/client/CodeEditor/rainbowBrackets.ts +0 -1
- package/src/client/CodeErrorOverlay/index.tsx +1 -1
- package/src/client/RunCodeWidget/index.tsx +1 -1
- package/src/client/SplitPaneResizeContext.tsx +0 -1
- package/src/client/VZCodeContext/types.ts +8 -4
- package/src/client/VZCodeContext/useVZCodeState.ts +6 -6
- package/src/client/VZKeyboardShortcutsDoc.tsx +3 -18
- package/src/client/VZMiddle.tsx +0 -6
- package/src/client/VZSidebar/AIChat/DiffView.tsx +6 -28
- package/src/client/VZSidebar/AIChat/Message.tsx +2 -7
- package/src/client/VZSidebar/AIChat/MessageList.tsx +1 -3
- package/src/client/VZSidebar/AIChat/useSpeechRecognition.ts +1 -2
- package/src/client/VZSidebar/DirectoryListing.tsx +0 -1
- package/src/client/VZSidebar/VisualEditor.tsx +3 -3
- package/src/client/VZSidebar/VoiceChatModal.tsx +0 -1
- package/src/client/VZSidebar/aiCopyPaste.ts +0 -2
- package/src/client/useFileCRUD.ts +0 -1
- package/src/client/useKeyboardShortcuts.ts +6 -2
- package/src/client/vzReducer/closeTabsReducer.ts +1 -1
- package/src/client/vzReducer/createInitialState.test.ts +25 -0
- package/src/client/vzReducer/createInitialState.ts +1 -1
- package/src/client/vzReducer/searchReducer.test.ts +16 -16
- package/src/client/vzReducer/searchReducer.ts +2 -2
- package/src/server/aiChatHandler/chatOperations.ts +1 -4
- package/src/server/computeInitialDocument.ts +1 -1
- package/src/server/index.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
2
|
import { shouldTriggerRun } from './shouldTriggerRun';
|
|
3
3
|
import { syntaxTree } from '@codemirror/language';
|
|
4
4
|
import { SyntaxNode, SyntaxNodeRef } from '@lezer/common';
|
|
@@ -381,8 +381,12 @@ export const useKeyboardShortcuts = ({
|
|
|
381
381
|
let position: number;
|
|
382
382
|
try {
|
|
383
383
|
position = editor.posAtDOM(element);
|
|
384
|
-
} catch (
|
|
384
|
+
} catch (_error) {
|
|
385
385
|
// Element is not within the current editor's document
|
|
386
|
+
console.log(
|
|
387
|
+
'Error finding element position:',
|
|
388
|
+
_error,
|
|
389
|
+
);
|
|
386
390
|
return;
|
|
387
391
|
}
|
|
388
392
|
const identifier: SyntaxNode = tree.resolveInner(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VZAction, VZState } from '.';
|
|
2
|
-
import { Pane,
|
|
2
|
+
import { Pane, TabState } from '../../types';
|
|
3
3
|
import { VizFileId } from '@vizhub/viz-types';
|
|
4
4
|
import { findPane } from './findPane';
|
|
5
5
|
import { updatePane } from './updatePane';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { createInitialState } from './createInitialState';
|
|
3
|
+
import { defaultTheme } from '../themes';
|
|
4
|
+
|
|
5
|
+
describe('createInitialState', () => {
|
|
6
|
+
it('should create initial state with auto-follow disabled by default', () => {
|
|
7
|
+
const initialState = createInitialState({
|
|
8
|
+
defaultTheme,
|
|
9
|
+
initialUsername: 'TestUser',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
expect(initialState.enableAutoFollow).toBe(false);
|
|
13
|
+
expect(initialState.username).toBe('TestUser');
|
|
14
|
+
expect(initialState.theme).toBe(defaultTheme);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should create initial state with default username when none provided', () => {
|
|
18
|
+
const initialState = createInitialState({
|
|
19
|
+
defaultTheme,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
expect(initialState.enableAutoFollow).toBe(false);
|
|
23
|
+
expect(initialState.username).toBe('Anonymous');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -10,43 +10,43 @@ const createMockShareDBDoc = (
|
|
|
10
10
|
files: any,
|
|
11
11
|
): ShareDBDoc<VizContent> => ({
|
|
12
12
|
data: { files, id: 'mock-id' },
|
|
13
|
-
ingestSnapshot: (snapshot: any,
|
|
13
|
+
ingestSnapshot: (snapshot: any, _callback: any) => {
|
|
14
14
|
// No-op for testing
|
|
15
|
-
if (
|
|
15
|
+
if (_callback) _callback();
|
|
16
16
|
},
|
|
17
|
-
subscribe: (
|
|
17
|
+
subscribe: (_callback: any) => {
|
|
18
18
|
// No-op for testing
|
|
19
|
-
if (
|
|
19
|
+
if (_callback) _callback();
|
|
20
20
|
},
|
|
21
21
|
on: (
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
_event: string,
|
|
23
|
+
_callback: (op: any, source: boolean) => void,
|
|
24
24
|
) => {
|
|
25
25
|
// No-op for testing
|
|
26
26
|
},
|
|
27
27
|
off: (
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
_event: string,
|
|
29
|
+
_callback: (op: any, source: boolean) => void,
|
|
30
30
|
) => {
|
|
31
31
|
// No-op for testing
|
|
32
32
|
},
|
|
33
33
|
removeListener: (
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
_event: string,
|
|
35
|
+
_callback: (op: any, source: boolean) => void,
|
|
36
36
|
) => {
|
|
37
37
|
// No-op for testing
|
|
38
38
|
},
|
|
39
39
|
submitOp: (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
_op: any,
|
|
41
|
+
_options?: any,
|
|
42
|
+
_callback?: () => void,
|
|
43
43
|
) => {
|
|
44
44
|
// No-op for testing
|
|
45
|
-
if (
|
|
45
|
+
if (_callback) _callback();
|
|
46
46
|
},
|
|
47
|
-
whenNothingPending: (
|
|
47
|
+
whenNothingPending: (_callback: () => void) => {
|
|
48
48
|
// No-op for testing
|
|
49
|
-
if (
|
|
49
|
+
if (_callback) _callback();
|
|
50
50
|
},
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -13,7 +13,7 @@ function searchPattern(
|
|
|
13
13
|
): SearchResult {
|
|
14
14
|
const files = shareDBDoc.data.files;
|
|
15
15
|
const fileIds = Object.keys(shareDBDoc.data.files);
|
|
16
|
-
|
|
16
|
+
const results: { [id: string]: SearchFile } = {};
|
|
17
17
|
|
|
18
18
|
for (let i = 0; i < fileIds.length; i++) {
|
|
19
19
|
const file = files[fileIds[i]];
|
|
@@ -142,7 +142,7 @@ export const setSearchLineVisibilityReducer = (
|
|
|
142
142
|
matches: state.search.results[
|
|
143
143
|
action.id
|
|
144
144
|
].matches.filter(
|
|
145
|
-
(match,
|
|
145
|
+
(match, _index) =>
|
|
146
146
|
match.line !== action.line,
|
|
147
147
|
),
|
|
148
148
|
},
|
|
@@ -103,7 +103,7 @@ export const computeInitialDocument = ({ fullPath }) => {
|
|
|
103
103
|
* Stack for recursively traversing directories.
|
|
104
104
|
* @type {string[]}
|
|
105
105
|
*/
|
|
106
|
-
|
|
106
|
+
const files = [];
|
|
107
107
|
|
|
108
108
|
const ignoreFileMatcher = createIgnore().add(
|
|
109
109
|
ignoreFilePattern,
|
package/src/server/index.ts
CHANGED
|
@@ -252,7 +252,7 @@ const save = () => {
|
|
|
252
252
|
|
|
253
253
|
// handle deleting files and directories.
|
|
254
254
|
if (previous && !current) {
|
|
255
|
-
|
|
255
|
+
const stats = fs.statSync(previous.name);
|
|
256
256
|
//Check if the file path we are trying to delete is a directory
|
|
257
257
|
if (!stats.isDirectory()) {
|
|
258
258
|
fs.unlinkSync(previous.name);
|
|
@@ -370,7 +370,7 @@ server.listen(port, async () => {
|
|
|
370
370
|
// Note: ngrok support can be added when the package is properly installed
|
|
371
371
|
// Sets the port to the one specified in the environment
|
|
372
372
|
// variable (for development) or the default port.
|
|
373
|
-
|
|
373
|
+
const livePort = process.env.EDITOR_PORT || port;
|
|
374
374
|
console.log(`EDITOR_PORT: ${process.env.EDITOR_PORT}`);
|
|
375
375
|
console.log(
|
|
376
376
|
`Editor is live at http://localhost:${livePort}`,
|