Open stweedie opened 4 years ago
Running with this PR gave back zero results for me when I ran with cmd + r
:
( in comparison on master, where it was too much ) ( also sorry it took so long to get to this PR )
Thanks for the update @orta. I had to modify the symbols list. Being unable to find proper documentation for how sublime chooses what to put in their symbols list, the best I could do was to have one file to include some symbols (property definitions) and another to exclude other symbols (function calls, for instance).
This will need to be updated to keep up with the tmLanguage file.
Also, one curious thing I noticed is that there is no distinct scope for when you declare a property in the constructor of a class, for instance:
export class SomeClass {
constructor(private someDependency: SomeDependency) { }
}
in the above, the 'someDependency' has the scopes: source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts variable.parameter.ts, none of which describe someDependency as a class parameter.
and in case it helps, I'm using the following command:
import sublime
import sublime_plugin
class ListScopesCommand(sublime_plugin.TextCommand):
def run(self, view):
for reg in self.view.sel():
print(self.view.scope_name(reg.begin()))
if you put that in your packages/User folder, you can set a keybind to call 'list_scopes' and see the scopes of the object currently under your cursor.
Yeah, it looks like it uses a normal args list for the tokenizer there ( vscode has a very good tokenizer preview BTW, would recommend looking at it in that too ) perhaps it could get added to https://github.com/microsoft/TypeScript-TmLanguage
I think this is a pretty reasonable approach, it's very likely all of these names aren't changing anytime in the future.
I'm not sure if it's changed anything on my setup though:
I still get a bunch of weird results
Does that feel off to you?
yeah that does look off. Can you find the scopes for those, and I'll try and find some configuration that excludes them while not excluding stuff we would otherwise want
I'm also currently looking at how vscode is implementing their symbols list. I would guess it's not using the text mate scopes as class members defined in the constructor are properly sourced in vscode's symbol list, and there's no difference in scopes between a constructor parameter and a parameter in any class method
I think vscode uses the tsserver to get the list (probably getDocumentHighlights
or getNavigationBarItems
)
Fixes #604 where symbol list will show all references to a given function in a file instead of just the function definition.
This is the exact change proposed in #653, but the original author of that change abandoned it.