Skip to content

feat(completion): handle symlinked directories in file completion#339

Merged
sudo-tee merged 2 commits intomainfrom
feat/symlinks-support
Mar 23, 2026
Merged

feat(completion): handle symlinked directories in file completion#339
sudo-tee merged 2 commits intomainfrom
feat/symlinks-support

Conversation

@sudo-tee
Copy link
Copy Markdown
Owner

This should resolve #336

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for mentioning/adding files located under symlinked directories within the current working directory (fix for #336), primarily by changing how “inside cwd” is determined so that logical (non-resolved) paths can be accepted.

Changes:

  • Update util.is_path_in_cwd to allow relative paths that stay logically within cwd without resolving symlinks.
  • Adjust file completion to build an absolute path without explicitly resolving symlinks.
  • Add unit tests for util.is_path_in_cwd.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
lua/opencode/util.lua Adds a “logical path” check path for relative paths to support symlinked directories.
lua/opencode/ui/completion/files.lua Changes how completion items compute full_path used when adding a file to context.
tests/unit/util_spec.lua Adds new test cases for util.is_path_in_cwd.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/opencode/util.lua Outdated
Comment thread lua/opencode/ui/completion/files.lua
Comment thread tests/unit/util_spec.lua
@sudo-tee sudo-tee merged commit 281e026 into main Mar 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Symbolic link files within cwd cannot be added to context

2 participants