Navigate to File and Method or Line Number in One Command

In Sublime Text, I can do CTRL+P, type in the name of a class/file, and then append @foo to go directly to the 'foo' function in that file, or :123 to go to line 123 in that file. In WebStorm you can sort of do this but it's clunky. I can either search for symbol with CTRL+SHIFT+ALT+N, but then there's way too many results and no way to quickly filter them down to just functions. Or I can do CTRL+SHIFT+N to find the file, then F12 to search for the function, but it's not ideal. Is there an equivalent in WebStorm to quick chain the two together via native support or from a plugin? Or alternatively, ideas for hotkey combinations/chains to make this flow well?

0
4 comments

Hi there,

Well ... "Navigate | File..." supports line numbers (e.g. "file:23" -- will go to line 23 in the file that is matches your search and currently selected).

If it would be PHP (and PhpStorm) .. then "Navigate | Class..." also supports method names (no completion help though) -- e.g. "cont#collect" -- will go to class "ContactForm" and focus on first "collectXXX" method -- may work for JavaScript as well (sorry, not JS person myself  -- only basic stuff).

Sorry, not sure about global functions and other stuff...

0
Avatar
Permanently deleted user

@Andriy Bazanov The line number thing does work universally apparently (Navigate Class or Navigate file). But unfortunately # only works for finding functions in JS classes, not standalone functions in a .js file. Even when finding a function in a JS class, there's no completion help, which sucks -- if you have functions that are prefixed the same you have to type out the function name until it's unique, so you have to know the exact name basically, which makes it difficult to use.

0

Consider submitting ticket to WebStorm Issue Tracker  and let devs decide how to better handle such scenario.

Since I'm neither JavaScript person.. or person that works a lot with global scoped functions .. I do not know such tickets. The ones I starred are more class-related like

 

BTW -- "Navigate | Symbol..." allows filtering by file type -- useful when you have lots of results for other languages. But if you have too many results from the same language (JavaScript in your case) then it does not help much.

BTW #2: Try Search Everywhere (Shift 2x times) -- maybe it works a bit differently/better (although it should not)

0

I agree Alex Beardsley I really really miss the go-to line shortcut. I can't find something like that in WebStorm just to type the FILE and then append the ":" to go to the certain line that really sucks. 

0

Please sign in to leave a comment.