Skip to content

Support Default Editor Setting In Windows#1454

Merged
ramya18101 merged 6 commits intomainfrom
DXCDT-1481/windows_default_editor
Mar 11, 2026
Merged

Support Default Editor Setting In Windows#1454
ramya18101 merged 6 commits intomainfrom
DXCDT-1481/windows_default_editor

Conversation

@bkiran6398
Copy link
Copy Markdown
Contributor

@bkiran6398 bkiran6398 commented Mar 3, 2026

🔧 Changes

Adds platform-specific argument parsing for the EDITOR environment variable to allow setting default on Windows.

  • On Windows: uses the native CommandLineToArgvW API to correctly handle backslash paths and quoted paths with spaces
  • On Unix: continues using go-shellquote for POSIX shell quoting
  • Platform-specific implementations via Go build tags (editor_windows.go, editor_unix.go)
README updates:
  • Documents default editors (vim on Linux/macOS, notepad on Windows)
  • Adds Windows-specific instructions for setting EDITOR in PowerShell and Command Prompt

📚 References

🔬 Testing

Automated tests added for both platforms covering:

  • Simple editor names, Paths with spaces in quotes, Multiple flags, Edge cases

Manual testing performed on a Windows machine:

  • Verified editor launches correctly in both PowerShell and Command Prompt for single-session and persistent (across sessions) configurations
  • Tested with editor paths containing spaces in both shells

📝 Checklist

  • All new/changed/fixed functionality is covered by tests (or N/A)
  • I have added documentation for all new/changed functionality (or N/A)

bkiran6398 and others added 4 commits March 3, 2026 14:15
- Added `parseEditorArgs` function for Windows and POSIX systems to handle command line arguments for text editors.
- Created `editor_windows.go` and `editor_unix.go` files to separate platform-specific implementations.
- Introduced tests in `editor_windows_test.go` and `editor_unix_test.go` to ensure correct parsing behavior across different scenarios.
- This change enhances compatibility with various text editors by correctly interpreting command line arguments, improving user experience.
- Clarified the default text editor settings for Linux/macOS and Windows.
- Added examples for setting the `EDITOR` environment variable in PowerShell and Command Prompt on Windows.
- Ensured instructions are clear for both terminal and non-terminal editors.
- Updated the Notepad++ and Visual Studio Code paths to a more generic format.
@bkiran6398 bkiran6398 marked this pull request as ready for review March 6, 2026 10:20
@bkiran6398 bkiran6398 requested a review from a team as a code owner March 6, 2026 10:20
- Included examples for using popular editors like Visual Studio Code and Sublime Text.
- Ensured consistency in formatting and improved clarity for users configuring their environment.
- Replaced custom argument parsing logic in `parseEditorArgs` with
  `windows.DecomposeCommandLine` for improved reliability and
  maintainability.
- Removed unnecessary error handling and conversions related to
  UTF-16 encoding, streamlining the function's implementation.
@ramya18101 ramya18101 merged commit ff79f87 into main Mar 11, 2026
6 checks passed
@ramya18101 ramya18101 deleted the DXCDT-1481/windows_default_editor branch March 11, 2026 05:35
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