Skip to content

feat(cli): support #section syntax when opening files at sections via cli or typed command#15686

Open
sukidhar wants to merge 3 commits intohelix-editor:masterfrom
sukidhar:feat-open-sections
Open

feat(cli): support #section syntax when opening files at sections via cli or typed command#15686
sukidhar wants to merge 3 commits intohelix-editor:masterfrom
sukidhar:feat-open-sections

Conversation

@sukidhar
Copy link
Copy Markdown

@sukidhar sukidhar commented Apr 27, 2026

Closes #15680

Instead of using just positions, updated the structure to use position as part of FileTarget struct. It adds support for opening files by section. For now, it opens at sections as the issue suggested. I have tested this with README.md and also with Cargo.toml. As long as the TagKind::Section is supported by the language of file, it should work on both the cli as well as commands from the editor. As of now, it takes Section precedence over the usual positioning. I am not sure if something like a mix of both is required.

Examples

# Open README.md with cursor at the "Features" heading
hx README.md#Features                                                                                                                                                                                            
 
# Open Cargo.toml with cursor at the [package] section                                                                                                                                                           
hx Cargo.toml#package
                                                                                                                                                                                                                 
# Combine with line number (section takes priority)
hx README.md#Installation:10                                                                                                                                                                                     
                
# From within Helix:                                                                                                                                                                                               
:open README.md#Features

I am contributing for the very first time on this repository. happy to address any changes needed. Thanks!

@sukidhar
Copy link
Copy Markdown
Author

sukidhar commented Apr 28, 2026

I have updated the tests, I ran cargo test —-workspace and it seemed to work but didn’t realise there’s integration tests. I fixed the issue identified in CI and also added one test case to test the change in action

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 sections

1 participant