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.
Files changed (40) hide show
  1. package/dist/assets/{index-Bfp1zhR4.js → index-CCjGlbxJ.js} +175 -176
  2. package/dist/cli.js +0 -2
  3. package/dist/index.html +1 -1
  4. package/dist/server/aiChatHandler/chatOperations.js +1 -1
  5. package/dist/server/computeInitialDocument.js +1 -1
  6. package/dist/server/index.js +2 -2
  7. package/package.json +10 -3
  8. package/src/cli.ts +0 -3
  9. package/src/client/AIAssist/AIAssistCodeMirrorKeyMap.ts +4 -4
  10. package/src/client/AIAssist/startAIAssist.ts +1 -7
  11. package/src/client/App/useShareDB.ts +1 -1
  12. package/src/client/CodeEditor/InteractiveWidgets/rotateWidget.ts +1 -1
  13. package/src/client/CodeEditor/getOrCreateEditor.tsx +5 -15
  14. package/src/client/CodeEditor/index.tsx +4 -3
  15. package/src/client/CodeEditor/rainbowBrackets.ts +0 -1
  16. package/src/client/CodeErrorOverlay/index.tsx +1 -1
  17. package/src/client/RunCodeWidget/index.tsx +1 -1
  18. package/src/client/SplitPaneResizeContext.tsx +0 -1
  19. package/src/client/VZCodeContext/types.ts +8 -4
  20. package/src/client/VZCodeContext/useVZCodeState.ts +6 -6
  21. package/src/client/VZKeyboardShortcutsDoc.tsx +3 -18
  22. package/src/client/VZMiddle.tsx +0 -6
  23. package/src/client/VZSidebar/AIChat/DiffView.tsx +6 -28
  24. package/src/client/VZSidebar/AIChat/Message.tsx +2 -7
  25. package/src/client/VZSidebar/AIChat/MessageList.tsx +1 -3
  26. package/src/client/VZSidebar/AIChat/useSpeechRecognition.ts +1 -2
  27. package/src/client/VZSidebar/DirectoryListing.tsx +0 -1
  28. package/src/client/VZSidebar/VisualEditor.tsx +3 -3
  29. package/src/client/VZSidebar/VoiceChatModal.tsx +0 -1
  30. package/src/client/VZSidebar/aiCopyPaste.ts +0 -2
  31. package/src/client/useFileCRUD.ts +0 -1
  32. package/src/client/useKeyboardShortcuts.ts +6 -2
  33. package/src/client/vzReducer/closeTabsReducer.ts +1 -1
  34. package/src/client/vzReducer/createInitialState.test.ts +25 -0
  35. package/src/client/vzReducer/createInitialState.ts +1 -1
  36. package/src/client/vzReducer/searchReducer.test.ts +16 -16
  37. package/src/client/vzReducer/searchReducer.ts +2 -2
  38. package/src/server/aiChatHandler/chatOperations.ts +1 -4
  39. package/src/server/computeInitialDocument.ts +1 -1
  40. package/src/server/index.ts +2 -2
@@ -1,4 +1,4 @@
1
- import { useContext, useEffect } from 'react';
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 (error) {
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, PaneId, TabState } from '../../types';
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
+ });
@@ -33,6 +33,6 @@ export const createInitialState = ({
33
33
  isDocOpen: false,
34
34
  editorWantsFocus: false,
35
35
  username: initialUsername,
36
- enableAutoFollow: true,
36
+ enableAutoFollow: false,
37
37
  sidebarPresenceIndicators: [],
38
38
  });
@@ -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, callback: any) => {
13
+ ingestSnapshot: (snapshot: any, _callback: any) => {
14
14
  // No-op for testing
15
- if (callback) callback();
15
+ if (_callback) _callback();
16
16
  },
17
- subscribe: (callback: any) => {
17
+ subscribe: (_callback: any) => {
18
18
  // No-op for testing
19
- if (callback) callback();
19
+ if (_callback) _callback();
20
20
  },
21
21
  on: (
22
- event: string,
23
- callback: (op: any, source: boolean) => void,
22
+ _event: string,
23
+ _callback: (op: any, source: boolean) => void,
24
24
  ) => {
25
25
  // No-op for testing
26
26
  },
27
27
  off: (
28
- event: string,
29
- callback: (op: any, source: boolean) => void,
28
+ _event: string,
29
+ _callback: (op: any, source: boolean) => void,
30
30
  ) => {
31
31
  // No-op for testing
32
32
  },
33
33
  removeListener: (
34
- event: string,
35
- callback: (op: any, source: boolean) => void,
34
+ _event: string,
35
+ _callback: (op: any, source: boolean) => void,
36
36
  ) => {
37
37
  // No-op for testing
38
38
  },
39
39
  submitOp: (
40
- op: any,
41
- options?: any,
42
- callback?: () => void,
40
+ _op: any,
41
+ _options?: any,
42
+ _callback?: () => void,
43
43
  ) => {
44
44
  // No-op for testing
45
- if (callback) callback();
45
+ if (_callback) _callback();
46
46
  },
47
- whenNothingPending: (callback: () => void) => {
47
+ whenNothingPending: (_callback: () => void) => {
48
48
  // No-op for testing
49
- if (callback) callback();
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
- let results: { [id: string]: SearchFile } = {};
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, index) =>
145
+ (match, _index) =>
146
146
  match.line !== action.line,
147
147
  ),
148
148
  },
@@ -1,7 +1,4 @@
1
- import {
2
- dateToTimestamp,
3
- generateRunId,
4
- } from '@vizhub/viz-utils';
1
+ import { dateToTimestamp } from '@vizhub/viz-utils';
5
2
  import { randomId } from '../../randomId.js';
6
3
  import { ShareDBDoc } from '../../types.js';
7
4
  import { diff } from '../../ot.js';
@@ -103,7 +103,7 @@ export const computeInitialDocument = ({ fullPath }) => {
103
103
  * Stack for recursively traversing directories.
104
104
  * @type {string[]}
105
105
  */
106
- let files = [];
106
+ const files = [];
107
107
 
108
108
  const ignoreFileMatcher = createIgnore().add(
109
109
  ignoreFilePattern,
@@ -252,7 +252,7 @@ const save = () => {
252
252
 
253
253
  // handle deleting files and directories.
254
254
  if (previous && !current) {
255
- let stats = fs.statSync(previous.name);
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
- let livePort = process.env.EDITOR_PORT || port;
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}`,