Sublime Forum

Navigate to next/previous symbol?

#1

Hi,

from Visual Studio I’m used to quickly navigate through my source files by pressing Ctrl + Up/Down which jumps to the previous or next function/event/property in a C# file.
Is this also possible with Sublime or any Sublime plugin?

Thanks,
Steven

0 Likes

#2

Of course, you should use “Goto Symbol”, just press CTRL-R, which will display the list of symbols in the file. Then you can use the up/down arrows to move between them, and even type something which will filter out symbol names using Sublime’s fuzzy matching.

You even have a preview, so as long as you hover over symbols, you’ll be able to preview them. Press Escape and you’ll be back to where you were, otherwise just press Enter to confirm

0 Likes

#3

Hello. I’m experiencing similar problem.

I have C# code, but navigate to symbol (Cmd+R) drop down shows only namespaces and classes definitions.
It is 99% unusable, because I need at least methods definitions.

Where can I add this symbols support for C# via editing .tmLanguage file?
Or maybe you could improve definitions.

In C# as in Java we use one class per file, so navigation through classes rarely make sense. Methods, properties support will be much-much better.

I’ve bought Sublime Text 2 license, so I hope for some answer.


0 Likes

#4

As noomorph already said, this is useless since symbols aren’t detected.

@noomorph: if you would fix the definitions, could you post them here?

0 Likes

#5

@noomorph, steven11: Sublime Text 3 Beta

Of course, if there already is a file you would either have to edit it or just add another file with that structure in your User package. It does not matter where the file is located, only the “scope” is important. As for finding out what selector you would need, try the “ctrl+alt+shift+p” command or inspect the tmLanguage.

0 Likes

#6

This quick dirty solution is better than nothing.
You can find my C#.tmLanguage file here: http://txtup.co/UZeM6

This dict tag does the job:

		<dict>
			<key>captures</key>
			<dict>
				<key>1</key>
				<dict>
					<key>name</key>
					<string>storage.modifier.source.cs</string>
				</dict>
				<key>2</key>
				<dict>
					<key>name</key>
					<string>entity.name.type.package.source.cs</string>
				</dict>
			</dict>
			<key>match</key>
			<string>^\s*(private|protected|internal|public)\s*(.*\(^;]+)$</string>
			<key>name</key>
			<string>meta.keyword.using.source.cs</string>
		</dict>

Now my file looks like on screenshot.


0 Likes