Description
GitHub Issue for OpenCode
Title
incorrect file reference format "In @" when opening OpenCode from VSCode (Windows)
Issue Description
When opening OpenCode from VSCode extension on Windows, the file reference format in the dialog shows incorrect formatting:
Current behavior:
- Shows:
In @Homework/file name
- The "In " prefix is unnecessary
- File path uses forward slash
/ instead of Windows backslash \
Expected behavior:
- Should show:
@Homework\file name
- No "In " prefix
- Use correct Windows path separator
\
Environment
- OS: Windows 10/11
- VSCode extension:
sst-dev.opencode version 0.0.13
- Extension file:
~/.vscode/extensions/sst-dev.opencode-0.0.13/dist/extension.js
Reproduction Steps
- Open a file in VSCode on Windows (e.g., a file in
Homework folder)
- Use VSCode keyboard shortcut (Ctrl+Esc) to open OpenCode
- Observe the text automatically inserted in the OpenCode dialog
- The text shows:
In @Homework/文件
Root Cause Analysis
Found in /dist/extension.js (compressed code):
Issue 1: "In " prefix
// Line around 32 in the compressed code
c&&(await h(t,`In ${r}`),n.show())
Should be:
c&&(await h(t,`${r}`),n.show())
Issue 2: Path separator
// Path generation logic
c=`@${o.workspace.asRelativePath(n.uri)}`
VSCode's asRelativePath() API returns relative paths with OS-specific separators, but on Windows it should convert to backslash \ for consistency with Windows file path conventions.
Possible Fix
Fix 1 - Remove "In " prefix:
In extension.js, change:
to:
Fix 2 - Convert path separator for Windows:
Option A: In the VSCode extension, modify the path generation:
c=`@${o.workspace.asRelativePath(n.uri).replace(/\//g, "\\")}`
Option B: Better approach - Handle this in the OpenCode server side to normalize paths regardless of OS:
- Convert all paths to Unix format with
/ for cross-platform consistency
- Or preserve OS-specific format based on client OS
Additional Context
- The
@ syntax for file references is great
- The automatic file context when opening from VSCode is a useful feature
- Only the formatting needs adjustment for better UX on Windows
Alternative
Consider using Unix-style paths (@Homework/file name) universally if the backend handles paths in a platform-agnostic way, which might be simpler than OS-specific formatting.
Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Description
GitHub Issue for OpenCode
Title
incorrect file reference format "In @" when opening OpenCode from VSCode (Windows)
Issue Description
When opening OpenCode from VSCode extension on Windows, the file reference format in the dialog shows incorrect formatting:
Current behavior:
In @Homework/file name/instead of Windows backslash\Expected behavior:
@Homework\file name\Environment
sst-dev.opencodeversion 0.0.13~/.vscode/extensions/sst-dev.opencode-0.0.13/dist/extension.jsReproduction Steps
Homeworkfolder)In @Homework/文件Root Cause Analysis
Found in
/dist/extension.js(compressed code):Issue 1: "In " prefix
Should be:
Issue 2: Path separator
VSCode's
asRelativePath()API returns relative paths with OS-specific separators, but on Windows it should convert to backslash\for consistency with Windows file path conventions.Possible Fix
Fix 1 - Remove "In " prefix:
In
extension.js, change:to:
Fix 2 - Convert path separator for Windows:
Option A: In the VSCode extension, modify the path generation:
Option B: Better approach - Handle this in the OpenCode server side to normalize paths regardless of OS:
/for cross-platform consistencyAdditional Context
@syntax for file references is greatAlternative
Consider using Unix-style paths (
@Homework/file name) universally if the backend handles paths in a platform-agnostic way, which might be simpler than OS-specific formatting.Plugins
No response
OpenCode version
No response
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response