diff --git a/package-lock.json b/package-lock.json index b6133384..70f4138a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,6 +68,7 @@ "@types/node": "20.x", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", + "@types/react-syntax-highlighter": "^15.5.13", "@types/sinon": "^10.0.2", "@types/sinon-test": "^2.4.2", "@types/trusted-types": "^1.0.6", @@ -3098,6 +3099,16 @@ "@types/react": "*" } }, + "node_modules/@types/react-syntax-highlighter": { + "version": "15.5.13", + "resolved": "https://registry.npmjs.org/@types/react-syntax-highlighter/-/react-syntax-highlighter-15.5.13.tgz", + "integrity": "sha512-uLGJ87j6Sz8UaBAooU0T6lWJ0dBmjZgN1PZTrj05TNql2/XpC6+4HhMT5syIdFUUt+FASfCeLLv4kBygNU+8qA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/react": "*" + } + }, "node_modules/@types/responselike": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", diff --git a/package.json b/package.json index 57f850dc..0a5189a7 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ "@types/node": "20.x", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", + "@types/react-syntax-highlighter": "^15.5.13", "@types/sinon": "^10.0.2", "@types/sinon-test": "^2.4.2", "@types/trusted-types": "^1.0.6", diff --git a/src/vs/workbench/contrib/void/browser/prompt/stringifyFiles.ts b/src/vs/workbench/contrib/void/browser/prompt/stringifyFiles.ts index 98d566e7..11056b43 100644 --- a/src/vs/workbench/contrib/void/browser/prompt/stringifyFiles.ts +++ b/src/vs/workbench/contrib/void/browser/prompt/stringifyFiles.ts @@ -14,9 +14,9 @@ Selection: ${selectionStr}`} } -export const userInstructionsStr = (instructions: string, selections: CodeSelection[]) => { +export const userInstructionsStr = (instructions: string, selections: CodeSelection[] | null) => { let str = ''; - if (selections.length > 0) { + if (selections && selections.length > 0) { str += filesStr(selections); str += `Please edit the selected code following these instructions:\n` } diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index 8137a1e0..589ce59c 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -39,26 +39,30 @@ const getBasename = (pathStr: string) => { return parts[parts.length - 1] } -export const SelectedFiles = ({ type, selections, setStagingSelns, }: - | { type: 'past', selections: CodeSelection[]; setStagingSelns?: undefined } - | { type: 'staging', selections: CodeStagingSelection[]; setStagingSelns: ((files: CodeStagingSelection[]) => void) } +export const SelectedFiles = ( + { type, selections, setStaging }: + | { type: 'past', selections: CodeSelection[] | null; setStaging?: undefined } + | { type: 'staging', selections: CodeStagingSelection[] | null; setStaging: ((files: CodeStagingSelection[]) => void) } ) => { return ( - selections.length !== 0 && ( + !!selections && selections.length !== 0 && (