Skip to content

Show the cursor's offset from the beginning of the line #257728

@KingSupernova31

Description

@KingSupernova31

Many languages/environments show the exact location of an error in a line of code. In Javascript for example, typing globalThis.a.a.a will log Uncaught TypeError: Cannot read properties of undefined (reading 'a') at <anonymous>:1:14. The last number, 14, is a reference to the second a since it's the 14th character in the line. This is useful because, in this example, it tells me which of the three a identifiers is the problem.

Previous IDEs I've used show the cursor's position in the document with the same scheme, displaying a line number and character number in that line, which makes it easy to locate exactly where the issue is.

I was surprised to learn that VSCode does not do this; it only shows the line number. Perhaps I'm missing a setting somewhere, but I've looked around and cannot find any way to enable seeing the cursor's offset from the beginning of the line.

There is a workaround, which is that VSCode will show me a count of the number of characters currently highlighted, so I can put the cursor at the beginning of the line, hold shift, and then move the cursor around to see the character offset. This is honestly not that bad, but I have to remember that it's the method, and I really think that something this basic should be displayed by default. Or at least offer a setting to enable it.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions