get_errors tool returns "No errors found" when filePaths targets a Kotlin file with diagnostics, but global query works
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
### Copilot Chat Extension Version
Built-in (VS Code 1.127.0, Windows 11)
### VS Code Version
1.127.0
### OS Version
Windows 11
### Feature
Agent/Edit mode — `get_errors` tool
### Selected model
DeepSeek V4 Pro Via BYOK
### Steps to Reproduce
1. Open a Kotlin project with JetBrains Kotlin Server extension (e.g., a Gradle-based Android project).
2. Introduce a syntax error in a `.kt` file — for example, remove a comma between two function parameters.
3. Verify the VS Code Problems panel shows the error.
4. Have Copilot call `get_errors` with no arguments → correctly returns the diagnostic.
5. Have Copilot call `get_errors` with `filePaths: ["path/to/the/file.kt"]` → returns **"No errors found"**.
6. The same diagnostic that appeared in step 4 disappears when targeting the specific file.
### Expected behavior
`get_errors` with a specific `filePaths` entry should return the same diagnostics as the unfiltered global query.
### Actual behavior
`get_errors` with `filePaths` returns empty for Kotlin files, even though the Problems panel shows diagnostics and the global query returns them.
### Technical root cause analysis
From reading the source at `extensions/copilot/src/extension/tools/node/getErrorsTool.tsx`:
1. Both code paths read from the same data source: `languageDiagnosticsService.getAllDiagnostics()`
2. The difference is that `getSome()` (when `filePaths` is provided) filters results via:
```
resolveToolInputPath(filePath) → URI.file() → isEqualOrParent(resource, inputUri)
```
3. `isEqualOrParent` uses an `ExtUri` instance created with `() => false` (case-sensitive comparison)
4. On Windows, this can cause URI mismatch between:
- URIs stored by language servers (e.g., with percent-encoded drive letters like `e%3A`)
- URIs constructed by `URI.file()` from the user-provided filePath
5. When the string representation doesn't match exactly, `isEqualOrParent` returns `false`, the file is skipped, and the result is empty.
The issue was reproduced with the **JetBrains Kotlin Server** extension (`jetbrains.kotlin-server`), but likely affects any LSP on Windows where URI encoding differs between the LSP's diagnostic store and VS Code's URI construction.
### Workaround
Omitting `filePaths` (using the global query) successfully returns all diagnostics.
Contributor guide
Assessment
This issue has not been assessed yet.