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; },