Home Download Buy Blog Forum Support

Navigate to next/previous symbol?

Navigate to next/previous symbol?

Postby steven11 on Thu Jan 31, 2013 8:17 am

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
steven11
 
Posts: 2
Joined: Thu Jan 31, 2013 8:12 am

Re: Navigate to next/previous symbol?

Postby pipomolo on Thu Jan 31, 2013 9:09 am

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
pipomolo
 
Posts: 16
Joined: Wed Jan 30, 2013 2:14 pm

Re: Navigate to next/previous symbol?

Postby noomorph on Fri Feb 01, 2013 10:10 am

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.
Attachments
Screen Shot 2013-02-01 at 11.46.31 AM.png
Screen Shot 2013-02-01 at 11.46.31 AM.png (177.14 KiB) Viewed 1348 times
noomorph
 
Posts: 2
Joined: Fri Feb 01, 2013 10:04 am

Re: Navigate to next/previous symbol?

Postby steven11 on Fri Feb 01, 2013 10:22 am

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

@noomorph: if you would fix the definitions, could you post them here?
steven11
 
Posts: 2
Joined: Thu Jan 31, 2013 8:12 am

Re: Navigate to next/previous symbol?

Postby FichteFoll on Sat Feb 02, 2013 3:25 am

@noomorph, steven11: viewtopic.php?f=2&t=10780&p=42450#p42450

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.
FichteFoll
 
Posts: 388
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Navigate to next/previous symbol?

Postby noomorph on Thu Mar 14, 2013 12:05 pm

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:
Code: Select all
      <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.
Attachments
Capture.PNG
Capture.PNG (114.18 KiB) Viewed 1196 times
noomorph
 
Posts: 2
Joined: Fri Feb 01, 2013 10:04 am


Return to Technical Support

Who is online

Users browsing this forum: Google [Bot] and 24 guests