Skip to content

feat: add custom base path support for OpenCode terminal sessions#16

Merged
LaiZhou merged 2 commits into
LaiZhou:mainfrom
develm:feature/custom-base-path
Mar 17, 2026
Merged

feat: add custom base path support for OpenCode terminal sessions#16
LaiZhou merged 2 commits into
LaiZhou:mainfrom
develm:feature/custom-base-path

Conversation

@develm
Copy link
Copy Markdown

@develm develm commented Mar 12, 2026

Summary

This PR introduces the ability for users to specify a custom base path (working directory) when connecting to or starting an OpenCode terminal session. This is particularly useful for projects with multiple modules or when the OpenCode CLI needs to be executed from a specific subdirectory.

Screenshot from 2026-03-12 18-29-12

Changes

UI Enhancements:

Updated OpenCodeConnectDialog to include a "Custom base path" dropdown.
The dropdown is automatically populated with paths to all modules in the current project for easy selection.
Added persistence for the custom base path using PropertiesComponent, so the last used path is remembered across sessions.
Increased the default dialog size to accommodate the new input field.

##Service Logic:
Modified OpenCodeService to propagate the customBasePath throughout the connection lifecycle.
Updated createTerminalUIInternal to use the specified custom path as the working directory for the terminal widget.
Ensured that if no custom path is provided, it defaults to the project's base path as before.

Verification Results

Verified that the "Custom base path" field appears in the connection dialog.
Confirmed that module paths are correctly listed and selectable.
Validated that starting a session with a custom path correctly sets the terminal's working directory.
Confirmed that the chosen path is saved and restored when reopening the dialog.

Note

This change is based on the proposal described in the issue #11. In addition to the original proposal, the implementation includes a dropdown that lists all detected project modules, making it easier to select an appropriate base path. This enhancement provides a more convenient and less error-prone way for users to choose the correct working directory when multiple modules are present in a project.

@develm develm changed the title Feature/custom base path Allow custom base path Mar 12, 2026
@develm develm changed the title Allow custom base path feat: add custom base path support for OpenCode terminal sessions Mar 12, 2026
@develm develm marked this pull request as ready for review March 12, 2026 17:39
@LaiZhou LaiZhou merged commit 3311001 into LaiZhou:main Mar 17, 2026
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.

2 participants