Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoTo Definition shows all function calling in file #604

Open
vosecek opened this issue May 3, 2017 · 8 comments · May be fixed by #727
Open

GoTo Definition shows all function calling in file #604

vosecek opened this issue May 3, 2017 · 8 comments · May be fixed by #727

Comments

@vosecek
Copy link

vosecek commented May 3, 2017

GoTo Definition by cmd+r on Mac shows all function calling in open file of project. The tool is useless now, if there are multiple calling of one method in current file.

screenshot 2017-05-03 11 18 14

@billti
Copy link
Member

billti commented May 5, 2017

Is this only for the Sublime "GoTo definition"? Does the TypeScript one (F12) work as expected for you?

@it6
Copy link
Contributor

it6 commented May 6, 2017

This actually happens in 'Go To Symbol' which navigates across symbols in a given file, (F12) 'Go To Definition' works as expected

@saskoh
Copy link

saskoh commented May 26, 2017

Here's a workaround to display only method names in the symbol list by setting up a configuration file for SublimeText that excludes bindables, method calls, etc.:

  1. Open the SublimeText Packages Folder and navigate to the "TypeScript" folder
  2. Inside the "TypeScript" folder create a new file called "Symbol List.tmPreferences"
  3. Edit this file and copy the following lines into it:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>name</key>
  <string>Symbol List</string>
  <key>scope</key>
  <string>meta.decorator.ts, meta.var.expr.ts, meta.block.ts, meta.field.declaration.ts</string>
  <key>settings</key>
  <dict>
    <key>showInSymbolList</key>
    <integer>0</integer>
  </dict>
</dict>
</plist>
  1. Save the file

The next time you press "ctrl-r" in a TypeScript file, you'll only get the method names displayed.

@vosecek
Copy link
Author

vosecek commented May 26, 2017

@saskoh Thanks, works great.

@vosecek vosecek closed this as completed May 26, 2017
@stweedie
Copy link

Why has this not made it to the actual package?

@binarynate
Copy link

@stweedie , I think it's just that nobody had created a PR yet. So, I just put up #653 for it.

@kylebebak
Copy link
Contributor

For anyone that stumbles on this, you can create a .tmPreferences file in any directory from which .tmPreferences files are loaded, included the User directory.

It can also have any name you want.

I have TypeScript - Symbol List.tmPreferences in Packages/User, which is nice, because it won't get overwritten every time there's a new release of the TypeScript plugin.

Also, there are a few other scopes that should be ignored aside from the ones @saskoh listed. This is what I'm working with right now:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>name</key>
  <string>Symbol List</string>
  <key>scope</key>
  <string>meta.function-call.ts, meta.parameters.ts, meta.decorator.ts, meta.var.expr.ts, meta.block.ts, meta.field.declaration.ts</string>
  <key>settings</key>
  <dict>
    <key>showInSymbolList</key>
    <integer>0</integer>
    <key>showInIndexedSymbolList</key>
    <integer>0</integer>
  </dict>
</dict>
</plist>

@stweedie stweedie linked a pull request Sep 26, 2019 that will close this issue
@ntr-808
Copy link

ntr-808 commented Oct 28, 2020

The above XML snippets didn't give me very many symbols to navigate to.

I copied the following from the #727 PR:

~/.config/sublime-text-3/Packages/User/ts-symbols-exclude.tmPreferences

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>name</key>
  <string>Symbol List</string>
  <key>scope</key>
  <string>meta.import.ts,meta.parameters.ts,meta.function-call.ts,meta.return.type.ts,meta.type.parameters.ts,meta.type.annotation.ts,meta.var.expr.ts,entity.name.type.module.ts,entity.name.type.ts</string>
  <key>settings</key>
  <dict>
    <key>showInSymbolList</key>
    <integer>0</integer>
  </dict>
</dict>
</plist>

~/.config/sublime-text-3/Packages/User/ts-symbols-include.tmPreferences

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>name</key>
  <string>Symbol List</string>
  <key>scope</key>
  <string>entity.name.type.class.ts, meta.definition.property.ts</string>
  <key>settings</key>
  <dict>
    <key>showInSymbolList</key>
    <integer>1</integer>
  </dict>
</dict>
</plist>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants