这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@VAIBHAVSING
Copy link
Contributor

@VAIBHAVSING VAIBHAVSING commented Oct 10, 2025

Summary

This PR implements the ability to open a session's working directory in an external editor directly from CodeLayer.

Changes

  • Added an 'Open in Editor' button (📝 icon) next to the Archive button in the session detail view
  • Added a settings section to configure the preferred editor (Cursor, VS Code, or Zed)
  • Implemented Cmd+Shift+E (⌘+Shift+E on Mac, Ctrl+Shift+E on Windows/Linux) hotkey to open the working directory
  • Used tauri-plugin-opener for cross-platform editor launching

Implementation Details

  • Added new preferences in src/lib/preferences.ts for storing editor choice
  • Updated ActionButtons component to include the new button
  • Updated ResponseInput component to handle the editor opening logic and hotkey
  • Added editor selection dropdown in SettingsDialog

Testing

  • Ran existing tests - all previously passing tests still pass
  • Ran linter - no new warnings introduced
  • TypeScript compilation successful for our changes

Closes #479


Important

Adds 'Open in Editor' feature with configurable editor preference and hotkey support in CodeLayer.

  • Behavior:
    • Adds 'Open in Editor' button in ActionButtons and ActiveSessionActionButtons components.
    • Supports editors: Cursor, VS Code, Zed, and system default.
    • Implements hotkey Cmd+Shift+E for opening the editor.
  • Preferences:
    • Adds PREFERRED_EDITOR_KEY in preferences.ts for storing preferred editor.
    • Provides editor options in EDITOR_OPTIONS.
    • Updates SettingsDialog to include editor selection dropdown.
  • Commands:
    • Adds open_in_editor command in lib.rs to handle directory opening logic.
    • Uses tauri-plugin-opener for cross-platform support.
  • Testing:
    • Existing tests pass, no new warnings from linter.
    • TypeScript compilation successful.

This description was created by Ellipsis for e908159. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 2d60767 in 1 minute and 10 seconds. Click for details.
  • Reviewed 277 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. humanlayer-wui/src/components/SettingsDialog.tsx:47
  • Draft comment:
    Ensure 'fetchClaudeConfig' is stable in the useEffect dependencies to avoid unnecessary re-fetches.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. humanlayer-wui/src/components/SettingsDialog.tsx:172
  • Draft comment:
    Consider validating the selected editor value against EDITOR_OPTIONS in handleEditorChange to guard against unexpected values.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. humanlayer-wui/src/components/internal/SessionDetail/components/ActionButtons.tsx:127
  • Draft comment:
    Consider using a more distinct icon than Pencil for the 'Open in Editor' action to avoid confusion with text editing.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None
4. humanlayer-wui/src/components/internal/SessionDetail/components/ResponseInput.tsx:396
  • Draft comment:
    Specify a dependency array for the 'mod+shift+e' hotkey callback to ensure updated session values (e.g. workingDir, isDraft) are correctly captured.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
5. humanlayer-wui/src/lib/preferences.ts:31
  • Draft comment:
    Consider validating the stored editor preference to ensure it matches one of the allowed values ('cursor', 'code', 'zed').
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_8ADAP84yyfZAVwwD

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@VAIBHAVSING VAIBHAVSING marked this pull request as draft October 10, 2025 10:32
@VAIBHAVSING VAIBHAVSING force-pushed the feat/open-in-editor-479 branch from 34d161d to 7c7b00a Compare October 18, 2025 07:54
@VAIBHAVSING VAIBHAVSING marked this pull request as ready for review October 19, 2025 11:50
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to e908159 in 42 seconds. Click for details.
  • Reviewed 593 lines of code in 11 files
  • Skipped 1 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. humanlayer-wui/src/lib/preferences.ts:40
  • Draft comment:
    Casting the stored value to EditorType without validation may lead to unexpected behavior if the stored value is invalid. Consider parsing or validating the value before defaulting to 'cursor'.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. humanlayer-wui/src/components/internal/SessionDetail/components/ActiveSessionInput.tsx:272
  • Draft comment:
    The useImperativeHandle hook is used with an empty dependency array. Although refs are stable, ensure that it's safe to assume that tiptapRef.current remains unchanged. If not, consider adding tiptapRef as a dependency.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. humanlayer-wui/src/components/internal/SessionDetail/components/ActiveSessionInput.tsx:293
  • Draft comment:
    The async setup for drag-and-drop event handling may be subject to race conditions if the component unmounts during setup. Ensure that the cleanup is robust (e.g. by verifying component mounted state) to avoid potential memory leaks.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None

Workflow ID: wflow_dk4LdC3RnrsmxRNk

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@VAIBHAVSING
Copy link
Contributor Author

@dexhorthy PTAL
hopefully its working on mac
now it working on ubantu

@VAIBHAVSING
Copy link
Contributor Author

Screenshot from 2025-10-18 14-15-09

@dexhorthy
Copy link
Contributor

related to #479

Copy link
Contributor

@K-Mistele K-Mistele left a comment

Choose a reason for hiding this comment

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

The sub-text is hard to read here when a given option is focused - it should probably change to be more visible like how most of our buttons do

Also, the "Cursor" text in the select component's selection appears to have a weird left indent, and that box could use a bit more padding as well
Screenshot 2025-10-23 at 1 57 08 PM

left a few other comments too

</TooltipTrigger>
<TooltipContent>
<p className="flex items-center gap-1">
Open in editor <KeyboardShortcut keyString="⌘+Shift+E" />
Copy link
Contributor

Choose a reason for hiding this comment

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

in other places we are using the shift unicode character, it's spelled out here - this should probably be changed

sessionStatus,
isArchived,
workingDir,
preferredEditor = 'cursor',
Copy link
Contributor

Choose a reason for hiding this comment

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

imho the default should be VS Code not cursor since VS Code is far more likely to be installed

Comment on lines 397 to 413
// Cmd+Shift+E to open in editor
useHotkeys(
'mod+shift+e',
e => {
e.preventDefault()
if (session.workingDir) {
handleOpenInEditor()
}
},
{ enableOnFormTags: true },
)

Copy link
Contributor

Choose a reason for hiding this comment

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

This hotkey does not appear to have a scope configured properly, please review other usages of this hook in the codebase to understand how scopes work. probably this should be in sessions.details scope but tbh I'd just tell claude to dig into how hotkey scopes and hotkey boundaries work (pattern locator agent should be good for this) and make a recommendation

Also enableOnContentEditable is probably appropriate as well

@VAIBHAVSING
Copy link
Contributor Author

VAIBHAVSING commented Nov 3, 2025

Implementation Update for PR #730

I've addressed the feedback from the PR review with the following key improvements:

✅ Changes Implemented

  1. Switched to tauri-plugin-opener for cross-platform compatibility

    • Removed custom shell command logic (400+ lines)
    • Now uses native Tauri opener API for reliable editor launching
    • Works on macOS without requiring CLI tools to be installed
    • Platform-specific app name mapping (e.g., "Visual Studio Code" on macOS, "Code" on Windows)
  2. Changed default editor from Cursor to VS Code

    • Updated default in preferences
    • VS Code is more commonly installed across platforms
  3. Fixed keyboard shortcut display

    • Changed from ⌘+Shift+E to ⌘⇧E to match codebase style
    • Now consistent with other keyboard shortcuts in the app
  4. Added proper hotkey scope configuration

    • Added HOTKEY_SCOPES.SESSION_DETAIL and SESSION_DETAIL_ARCHIVED scopes
    • Added enableOnContentEditable: true for proper editor integration
    • Hotkey now properly scoped to session detail views

🔄 Remaining Work

The Settings UI improvements are not yet implemented. This requires:

  • Making the editor selector match the model selector button style
  • Improving focus states for better readability
  • Fixing padding and indentation issues

I plan to address the UI improvements in a follow-up commit after getting feedback on the core functionality changes.

🧪 Testing Needed

Please test on macOS to verify that editors open correctly without CLI tools installed. The new implementation should work with just the applications installed in /Applications.

cc @dexhorthy @K-Mistele - ready for review!

- Add 'Open in Editor' button next to Archive button in session detail
- Support Cursor, VS Code, and Zed editors
- Add editor preference selector in Settings dialog
- Implement Cmd+Shift+E hotkey to open working directory in preferred editor
- Use tauri-plugin-opener for cross-platform editor launching

Resolves humanlayer#479
@VAIBHAVSING VAIBHAVSING force-pushed the feat/open-in-editor-479 branch from 857218f to df905c8 Compare November 3, 2025 12:51
@dexhorthy
Copy link
Contributor

dexhorthy commented Nov 3, 2025 via email

- Resolved conflicts in lib.rs by keeping both read_last_log_lines and save_window_state functions
- Resolved conflicts in SettingsDialog.tsx by merging editor preferences with log handling
- Combined imports and state management from both branches
- Applied UI improvements: better padding, improved focus states for select items
- Add px-2.5 padding to SelectTrigger to fix weird left indent
- Change description text from text-muted-foreground to opacity-70 with group-data state
- Make sub-text more readable when focused by increasing opacity on focus
- Update keyboard shortcut display from ⌘+Shift+E to ⌘⇧E
- Add group class to SelectItem for better state management

Addresses feedback from @K-Mistele in PR humanlayer#730
@VAIBHAVSING VAIBHAVSING requested a review from K-Mistele November 3, 2025 13:55
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.

Open Cursor Editor from Working Directory

3 participants