Skip to content
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

[Feature Request] Zero-based line numbers #134733

Closed
lonix1 opened this issue Oct 10, 2021 · 7 comments
Closed

[Feature Request] Zero-based line numbers #134733

lonix1 opened this issue Oct 10, 2021 · 7 comments
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality

Comments

@lonix1
Copy link

lonix1 commented Oct 10, 2021

Please add support for zero-based line numbers (e.g. editor.zeroBasedLineNumbers: true), so the first line is 0.

A similar request was closed due to insufficient votes. Please reconsider for the new reason below.

When developing vscode extensions, we use various zero-based properties like selection.start.line, selection.end.line, etc. I turn on editor.lineNumbers to make it easier to see what's going on, BUT, lines start at 1 so I often make mistakes when debugging. It would be much easier if I could set lines to start at 0.

Please reconsider this because:

  • you're currently working on a disassembly view
  • NEW REASON: it's useful for extension authors - and you obviously want to encourage extension authoring

Thanks!

@PieterBranderhorst
Copy link
Contributor

I don't think this would be good. Many vscode internals use one-relative line numbers. getLineContent, folding ranges, etc. Changing those places to use zero-relative numbers would break many existing extensions. And changing only the on-screen appearance of the numbers would then add a new point of confusion when debugging. Because the displayed numbers wouldn't match the numbers stored in internal constructs like ranges.

@lonix1
Copy link
Author

lonix1 commented Oct 10, 2021

No that's not what I meant. I don't want the APIs to change, obviously - besides, they are already 0-based. I want to optionally display 0-based line numbers in the editor, just for me.

All the APIs are 0-based, so showing 0-based line numbers would assist debugging extensions. (And there are other use cases too, see above).

@alexdima
Copy link
Member

@lonix1 You could write an extension that renders the selection in 0-based coordinates in the status bar.

@alexdima alexdima added feature-request Request for new features or functionality editor-rendering Editor rendering issues labels Oct 11, 2021
@lonix1
Copy link
Author

lonix1 commented Oct 11, 2021

@alexdima LOL that's actually a really clever idea! 😄

What about 0-based line numbers in the editor - do you think that is possible as an extension?

@alexdima alexdima removed their assignment Dec 1, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-rendering Editor rendering issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants
@alexdima @lonix1 @PieterBranderhorst and others