microsoft / microsoft/edit

Feature request: open file at position supports negative index

Open
#684 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
14.6k
Forks
734
Avg merge
8h 40m
Merged PRs (30d)
4

Description

It would be nice if the line and column position supports the negative numbers and start counting from the end of the file.

Example:

We have a readme.md file filled with 20 lines.

edit readme.md:10 - opens the file at line 10
edit readme.md:-1 - opens the file at the last row
edit readme.md:-5 - opens the file at line 16

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the `edit readme.md:10` argument is parsed and how line and column positions are currently applied. Support negative positions relative to the end of the file, then verify that `-1` selects the last line and `-5` selects line 16 in a 20-line file.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.