feat: add custom base path support for OpenCode terminal sessions#16
Merged
Conversation
added 2 commits
March 12, 2026 18:08
…o define the base path of the open code terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.