From 99901d1e203475568991463be732e3c08e4dff54 Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Wed, 9 Apr 2025 04:31:06 -0700 Subject: [PATCH 1/4] prepare to add linterror ui (incomplete) --- extensions/razor/package.json | 8 +++--- .../contrib/void/browser/chatThreadService.ts | 2 +- .../react/src/sidebar-tsx/SidebarChat.tsx | 8 ++++-- .../contrib/void/browser/toolsService.ts | 27 ++++++++++++------- .../void/common/chatThreadServiceTypes.ts | 2 +- .../contrib/void/common/toolsServiceTypes.ts | 4 ++- 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/extensions/razor/package.json b/extensions/razor/package.json index 06551edc..8451c125 100644 --- a/extensions/razor/package.json +++ b/extensions/razor/package.json @@ -2,14 +2,16 @@ "name": "razor", "displayName": "%displayName%", "description": "%description%", - "version": "1.0.0", + "version": "1.0.1", "publisher": "vscode", "license": "MIT", + "keywords": ["razor", "cshtml", "aspnet", "blazor"], "engines": { - "vscode": "0.10.x" + "vscode": "^1.50.0" }, "scripts": { - "update-grammar": "node ./build/update-grammar.mjs" + "update-grammar": "node ./build/update-grammar.mjs", + "test": "echo \"Error: no test specified\" && exit 1" }, "categories": ["Programming Languages"], "contributes": { diff --git a/src/vs/workbench/contrib/void/browser/chatThreadService.ts b/src/vs/workbench/contrib/void/browser/chatThreadService.ts index 4a2257a3..21dad5d2 100644 --- a/src/vs/workbench/contrib/void/browser/chatThreadService.ts +++ b/src/vs/workbench/contrib/void/browser/chatThreadService.ts @@ -634,7 +634,7 @@ class ChatThreadService extends Disposable implements IChatThreadService { // compute these below let toolParams: ToolCallParams[ToolName] - let toolResult: ToolResultType[typeof toolName] + let toolResult: Awaited let toolResultStr: string if (!opts?.preapproved) { // skip this if pre-approved 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 2360ce4a..b717837a 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 @@ -22,7 +22,7 @@ import { WarningBox } from '../void-settings-tsx/WarningBox.js'; import { getModelCapabilities, getIsReasoningEnabledState } from '../../../../common/modelCapabilities.js'; import { AlertTriangle, Ban, Check, ChevronRight, Dot, FileIcon, Pencil, Undo, Undo2, X } from 'lucide-react'; import { ChatMessage, CheckpointEntry, StagingSelectionItem, ToolMessage } from '../../../../common/chatThreadServiceTypes.js'; -import { ToolCallParams, ToolName, toolNames, ToolNameWithApproval } from '../../../../common/toolsServiceTypes.js'; +import { LintErrorItem, ToolCallParams, ToolName, toolNames, ToolNameWithApproval } from '../../../../common/toolsServiceTypes.js'; import { ApplyButtonsHTML, CopyButton, IconShell1, JumpToFileButton, JumpToTerminalButton, StatusIndicator, StatusIndicatorForApplyButton, useApplyButtonState } from '../markdown/ApplyBlockHoverButtons.js'; import { IsRunningType } from '../../../chatThreadService.js'; import { acceptAllBg, acceptBorder, buttonFontSize, buttonTextColor, rejectAllBg, rejectBg, rejectBorder } from '../../../../common/helpers/colors.js'; @@ -657,6 +657,7 @@ type ToolHeaderParams = { numResults?: number; hasNextPage?: boolean; children?: React.ReactNode; + bottomChildren?: React.ReactNode; onClick?: () => void; isOpen?: boolean, } @@ -1716,7 +1717,10 @@ const toolNameToComponent: { [T in ToolName]: { resultWrapper: ResultWrapper, // add children if (toolMessage.type !== 'tool_error') { - const { params } = toolMessage + const { params, result } = toolMessage + + // componentParams.bottomChildren = + componentParams.children = { await timeout(500) - const lintErrorsStr = this.markerService - .read({ resource: uri }) - .map(l => l.message) - .join('\n') - if (!lintErrorsStr) return { lintErrorsStr: null } - return { lintErrorsStr } + const lintErrors = this.markerService + .read({ resource: uri }) + .map(l => ({ + code: typeof l.code === 'string' ? l.code : l.code?.value || '', + message: l.message, + startLineNumber: l.startLineNumber, + endLineNumber: l.endLineNumber, + } satisfies LintErrorItem)) + + if (!lintErrors.length) return { lintErrors: null } + return { lintErrors, } }) return { result: lintErrorsPromise, interruptTool } @@ -407,6 +412,8 @@ export class ToolsService implements IToolsService { const nextPageStr = (hasNextPage: boolean) => hasNextPage ? '\n\n(more on next page...)' : '' + const lintErrorsStr = (lintErrors: LintErrorItem[]) => lintErrors.map((e, i) => `Error ${i + 1}:\nLines Affected: ${e.startLineNumber}-${e.endLineNumber}\nError message:${e.message}`).join('\n\n') + // given to the LLM after the call this.stringOfResult = { read_file: (params, result) => { @@ -433,8 +440,10 @@ export class ToolsService implements IToolsService { return `URI ${params.uri.fsPath} successfully deleted.` }, edit_file: (params, result) => { - const additionalStr = result.lintErrorsStr ? `Lint errors found after change:\n${result.lintErrorsStr}.\nIf this is related to a change made while calling this tool, you might want to fix the error.` : `No lint errors found.` - return `Change successfully made to ${params.uri.fsPath}. ${additionalStr}` + + const additionalStr = result.lintErrors ? `Lint errors found after change:\n${lintErrorsStr(result.lintErrors)}.\nIf this is related to a change made while calling this tool, you might want to fix the error.` : `No lint errors found.` + + return `Change successfully made to ${params.uri.fsPath}.${additionalStr}` }, run_terminal_command: (params, result) => { const { diff --git a/src/vs/workbench/contrib/void/common/chatThreadServiceTypes.ts b/src/vs/workbench/contrib/void/common/chatThreadServiceTypes.ts index 915a3e7d..31ec94fb 100644 --- a/src/vs/workbench/contrib/void/common/chatThreadServiceTypes.ts +++ b/src/vs/workbench/contrib/void/common/chatThreadServiceTypes.ts @@ -22,7 +22,7 @@ export type ToolMessage = { | { type: 'running_now', result: null, name: T, params: ToolCallParams[T], } | { type: 'tool_error', result: string, name: T, params: ToolCallParams[T], } // error when tool was running - | { type: 'success', result: ToolResultType[T], name: T, params: ToolCallParams[T], } + | { type: 'success', result: Awaited, name: T, params: ToolCallParams[T], } | { type: 'rejected', result: null, name: T, params: ToolCallParams[T], } ) // user rejected diff --git a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts index 980ea587..a5cda862 100644 --- a/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts +++ b/src/vs/workbench/contrib/void/common/toolsServiceTypes.ts @@ -6,6 +6,8 @@ import { voidTools } from './prompt/prompts.js'; export type TerminalResolveReason = { type: 'toofull' | 'timeout' | 'bgtask' } | { type: 'done', exitCode: number } +export type LintErrorItem = { code: string, message: string, startLineNumber: number, endLineNumber: number } + // Partial of IFileStat export type ShallowDirectoryItem = { uri: URI; @@ -63,7 +65,7 @@ export type ToolResultType = { 'search_pathnames_only': { uris: URI[], hasNextPage: boolean }, 'search_files': { uris: URI[], hasNextPage: boolean }, // --- - 'edit_file': Promise<{ lintErrorsStr: string | null }>, + 'edit_file': Promise<{ lintErrors: LintErrorItem[] | null }>, 'create_file_or_folder': {}, 'delete_file_or_folder': {}, 'run_terminal_command': { terminalId: string, didCreateTerminal: boolean, result: string; resolveReason: TerminalResolveReason; }, From 3128000cf7f6355b2e8f8e0c2bb0736cbdc78516 Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Wed, 9 Apr 2025 04:39:32 -0700 Subject: [PATCH 2/4] fix ux --- .../contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b717837a..8eab2d81 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 @@ -2146,7 +2146,7 @@ const CommandBarInChat = () => { const acceptRejectButtons =
Date: Wed, 9 Apr 2025 06:22:41 -0700 Subject: [PATCH 3/4] revert package.json bug --- extensions/razor/package.json | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/extensions/razor/package.json b/extensions/razor/package.json index 8451c125..06551edc 100644 --- a/extensions/razor/package.json +++ b/extensions/razor/package.json @@ -2,16 +2,14 @@ "name": "razor", "displayName": "%displayName%", "description": "%description%", - "version": "1.0.1", + "version": "1.0.0", "publisher": "vscode", "license": "MIT", - "keywords": ["razor", "cshtml", "aspnet", "blazor"], "engines": { - "vscode": "^1.50.0" + "vscode": "0.10.x" }, "scripts": { - "update-grammar": "node ./build/update-grammar.mjs", - "test": "echo \"Error: no test specified\" && exit 1" + "update-grammar": "node ./build/update-grammar.mjs" }, "categories": ["Programming Languages"], "contributes": { From 89b29ac97bcbe7ca7a37587fa63894af16fcd536 Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Wed, 9 Apr 2025 07:56:17 -0700 Subject: [PATCH 4/4] settings page is decent for update --- .../void/browser/react/src/util/inputs.tsx | 4 +- .../react/src/void-settings-tsx/Settings.tsx | 44 ++++++++++--------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx index 1ae9719d..a4df3066 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx @@ -959,9 +959,9 @@ export const BlockCode = ({ initValue, language, maxHeight, showScrollbars }: Bl } -export const VoidButtonBgDarken = ({ children, disabled, onClick }: { children: React.ReactNode; disabled?: boolean; onClick: () => void }) => { +export const VoidButtonBgDarken = ({ children, disabled, onClick, className }: { children: React.ReactNode; disabled?: boolean; onClick: () => void; className?: string }) => { return } diff --git a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx index 860ee06b..29bc9106 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/void-settings-tsx/Settings.tsx @@ -19,6 +19,7 @@ import { WarningBox } from './WarningBox.js' import { os } from '../../../../common/helpers/systemInfo.js' import { IconLoading, IconX } from '../sidebar-tsx/SidebarChat.js' import { getModelCapabilities, getProviderCapabilities, ollamaRecommendedModels, VoidStaticModelInfo } from '../../../../common/modelCapabilities.js' +import VoidImage from './VoidImage.js' const ButtonLeftTextRightOption = ({ text, leftButton }: { text: string, leftButton?: React.ReactNode }) => { @@ -544,7 +545,10 @@ export const FeaturesTab = () => { {/*

{`Instructions:`}

*/} {/*

{`Void can access any model that you host locally. We automatically detect your local models by default.`}

*/}

{`Void can access any model that you host locally. We automatically detect your local models by default.`}

- {ollamaSetupInstructions} + +
+ {ollamaSetupInstructions} +
@@ -805,7 +809,7 @@ const transferTheseFilesOfOS = (os: 'mac' | 'windows' | 'linux' | null, fromEdit } -const OneClickSwitchButton = ({ fromEditor = 'VS Code' }: { fromEditor?: TransferEditorType }) => { +const OneClickSwitchButton = ({ fromEditor = 'VS Code', className = '' }: { fromEditor?: TransferEditorType, className?: string }) => { const accessor = useAccessor() const fileService = accessor.get('IFileService') @@ -866,7 +870,7 @@ const OneClickSwitchButton = ({ fromEditor = 'VS Code' }: { fromEditor?: Transfe } return <> - + {transferState.type === 'done' ? `Transfer from ${fromEditor}` : transferState.type === 'loading' ? Transferring : transferState.type === 'justfinished' ? @@ -889,10 +893,10 @@ const GeneralTab = () => {

One-Click Switch

{`Transfer your settings from another editor to Void in one click.`}

-
- - - +
+ + +
@@ -903,29 +907,29 @@ const GeneralTab = () => {

{`IDE settings, keyboard settings, and theme customization.`}

- { commandService.executeCommand('workbench.action.openSettings') }}> + { commandService.executeCommand('workbench.action.openSettings') }}> General Settings
- { commandService.executeCommand('workbench.action.openGlobalKeybindings') }}> + { commandService.executeCommand('workbench.action.openGlobalKeybindings') }}> Keyboard Settings
- { commandService.executeCommand('workbench.action.selectTheme') }}> + { commandService.executeCommand('workbench.action.selectTheme') }}> Theme Settings
- { nativeHostService.showItemInFolder(environmentService.logsHome.fsPath) }}> + { nativeHostService.showItemInFolder(environmentService.logsHome.fsPath) }}> Open Logs
-
+

AI Instructions

{`Instructions to include on all AI requests.`}

@@ -943,7 +947,7 @@ export const Settings = () => { const [tab, setTab] = useState('models') - const deleteme = true + const deleteme = false if (deleteme) { return
@@ -964,10 +968,10 @@ export const Settings = () => { {/* tabs */}
- -
@@ -1100,7 +1104,7 @@ const PreviousButton = ({ onClick, ...props }: { onClick: () => void } & React.B } -const ollamaSetupInstructions =
+const ollamaSetupInstructions =
@@ -1420,12 +1424,12 @@ const VoidOnboarding = () => { // TODO add a description next to the skip button saying (you can always restart the onboarding in Settings) const contentOfIdx: { [pageIndex: number]: React.ReactNode } = { 0:
- - Welcome to Void + +
Welcome to Void
+ - Image
- Void Logo +