jemiloii
jemiloii

Reputation: 25759

How to navigate to character location in WebStorm?

I'm wondering how can I can navigate to a character location? I have a script that will tell me the character location number, no line number.

INFO: log-process/3093 on local-machine: Some Log Message

The 3093 is the character location number.

Upvotes: 10

Views: 9778

Answers (5)

sufkop
sufkop

Reputation: 1

Install the IdeaVim plugin.

Then type:

:normal! 0go3093 "

Your cursor will move to character 3093.

You can make this into a simple command by typing:

:command! -nargs=1 GoToChar execute 'normal! 0go' . (<args>-1) . ' '

Now you only have to type:

:GoToChar 3093

To go to character 3093.

Upvotes: 0

Javaru
Javaru

Reputation: 32026

No such navigation action exists. You'll need to either 1) Search for a plug-in that will do this; 2) write your own plug-in to do it; or 3) Open a feature request to add such functionality.

UPDATE

The "Go to Line" dialog was enhanced to be "Go to Line:Column". You can open it by:

  • Ctrl+G / +L
  • Menu: Navigate > Line:Column
  • Click on the cursor position in the bottom right of the window. For example: cursor position indication

This will open the Go to Line:Column dialog:

Go to Line:Column Dialog

In the dialog, you can enter a value such as 10:15 to go to the 15th character on line 10. You can also enter just a line, 10 which will take you to the start of that line (line 10 in this example). Or you can enter just a character position, for example :15, which will take you to that character position on the current line.

However, I am still unaware of a way say "Navigate to the Nth character position in the file". And the original poster's feature for such a feature is still open.

Upvotes: 3

Justin Schwartzenberger
Justin Schwartzenberger

Reputation: 2704

In WebStorm, if you mouse click on the file line and char count in the bottom bar:

enter image description here

it will open up a dialog where you can type in the line and char position:

enter image description here

Upvotes: 6

David Hudec
David Hudec

Reputation: 490

I do this by selecting code from the start of the file. Then, total number of selected characters is displayed in the bottom right corner, so I can find the character that I only knew the number of.

Upvotes: 34

John
John

Reputation: 11439

I had the same situation today. I have a minifed and uglified javascript file, and I was simply searching manually for error (14, 4974). In the bottom right corner of Webstorm, you can see the line number and character position.

enter image description here

Searching for lets say line 14 and position 18438 is not an easy task, but clicking inside the script file may help you to pin point the location.

Upvotes: 1

Related Questions