-
Notifications
You must be signed in to change notification settings - Fork 748
feat: add "Open in Terminal" option to folder context menu #1809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add "Open in Terminal" option to folder context menu #1809
Conversation
Summary of ChangesHello @bajrangCoder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature that allows users to directly open a folder in the integrated terminal via the context menu. This functionality is intelligently restricted to only those folders that are recognized as terminal-accessible, enhancing workflow efficiency for users working within designated terminal environments. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Greptile OverviewGreptile SummaryThis PR adds an "Open in Terminal" context menu option for terminal-accessible folders in the file explorer. The feature allows users to right-click on folders within Alpine root or public directories and open a terminal session that automatically navigates to that folder. Implementation Overview:
Architecture Integration: Issues Identified:
Positive Aspects:
Confidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User
participant ContextMenu as Context Menu
participant openFolder as openFolder.js
participant TerminalMgr as TerminalManager
participant Terminal as TerminalComponent
participant WebSocket as WS Connection
User->>ContextMenu: Right-click on folder
ContextMenu->>openFolder: handleContextmenu(type, url, name)
openFolder->>openFolder: isTerminalAccessiblePath(url)
alt Path is terminal accessible
openFolder->>ContextMenu: Add "Open in Terminal" option
ContextMenu-->>User: Show menu with option
User->>ContextMenu: Select "Open in Terminal"
ContextMenu->>openFolder: execOperation("open-in-terminal")
openFolder->>openFolder: convertToProotPath(url)
openFolder->>TerminalMgr: createTerminal({name, render: true})
TerminalMgr->>Terminal: new TerminalComponent()
Terminal->>Terminal: init() and mount()
Terminal->>WebSocket: connectToSession()
WebSocket-->>Terminal: onopen event
Terminal->>Terminal: isConnected = true
Terminal-->>TerminalMgr: return terminal instance
TerminalMgr-->>openFolder: return terminal
openFolder->>openFolder: waitForConnection() polling
loop Poll every 50ms
openFolder->>Terminal: Check isConnected
alt isConnected is true
Terminal-->>openFolder: resolve()
else Not connected yet
openFolder->>openFolder: setTimeout(check, 50)
end
end
openFolder->>Terminal: write(`cd ${prootPath}\n`)
openFolder->>openFolder: Sidebar.hide()
openFolder-->>User: Terminal opens with cd command
else Path not accessible
openFolder->>ContextMenu: Don't add option
ContextMenu-->>User: Show menu without terminal option
end
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 1 comment
| if (isAcodeTerminalPublicSafUri(url)) return true; | ||
| const { alpineRoot, publicDir } = getTerminalPaths(); | ||
| const cleanUrl = url.replace(/^file:\/\//, ""); | ||
| if (cleanUrl.startsWith(alpineRoot) || cleanUrl.startsWith(publicDir)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could just check if a file starts with file:// and if it’s readable, but this works too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 4 comments
Closes: #1806
But only for terminal accessible folder like terminal home dir and public folder