(input: Partial<Input>, {
verbose
}: {
verbose: boolean;
})
| 161 | return 'LSP'; |
| 162 | } |
| 163 | export function renderToolUseMessage(input: Partial<Input>, { |
| 164 | verbose |
| 165 | }: { |
| 166 | verbose: boolean; |
| 167 | }): React.ReactNode { |
| 168 | if (!input.operation) { |
| 169 | return null; |
| 170 | } |
| 171 | const parts: string[] = []; |
| 172 | |
| 173 | // For position-based operations (goToDefinition, findReferences, hover, goToImplementation), |
| 174 | // show the symbol at the position for better context |
| 175 | if ((input.operation === 'goToDefinition' || input.operation === 'findReferences' || input.operation === 'hover' || input.operation === 'goToImplementation') && input.filePath && input.line !== undefined && input.character !== undefined) { |
| 176 | // Convert from 1-based (user input) to 0-based (internal file reading) |
| 177 | const symbol = getSymbolAtPosition(input.filePath, input.line - 1, input.character - 1); |
| 178 | const displayPath = verbose ? input.filePath : getDisplayPath(input.filePath); |
| 179 | if (symbol) { |
| 180 | parts.push(`operation: "${input.operation}"`); |
| 181 | parts.push(`symbol: "${symbol}"`); |
| 182 | parts.push(`in: "${displayPath}"`); |
| 183 | } else { |
| 184 | parts.push(`operation: "${input.operation}"`); |
| 185 | parts.push(`file: "${displayPath}"`); |
| 186 | parts.push(`position: ${input.line}:${input.character}`); |
| 187 | } |
| 188 | return parts.join(', '); |
| 189 | } |
| 190 | |
| 191 | // For other operations (documentSymbol, workspaceSymbol), |
| 192 | // show operation and file without position details |
| 193 | parts.push(`operation: "${input.operation}"`); |
| 194 | if (input.filePath) { |
| 195 | const displayPath = verbose ? input.filePath : getDisplayPath(input.filePath); |
| 196 | parts.push(`file: "${displayPath}"`); |
| 197 | } |
| 198 | return parts.join(', '); |
| 199 | } |
| 200 | export function renderToolUseErrorMessage(result: ToolResultBlockParam['content'], { |
| 201 | verbose |
| 202 | }: { |
nothing calls this directly
no test coverage detected