Description
TS and JS Grammar Extension version: 0.0.18 / latest
This issue is likely Sublime Text specific, which relies on scoping to provide simple navigation in all languages:
- Go to symbol: by listing all symbols with scopes like
entity.name.function.ts - Go to definition: by finding a matching
entity.name.function.tsfor avariable.function.ts.
Because the TypeScript grammar labels function calls as entity.name.function.ts, the symbol list is polluted with invocations and Go To Definition does not know which entry to navigate to.
If no regressions are caused in themes / other editors, it would be great if Sublime's guidelines could be used: (from https://www.sublimetext.com/docs/3/scope_naming.html#variable)
Function and method names should be scoped using the following, but only when they are being invoked. When defined, they should use entity.name.function.
- variable.function
Code
function myFunc() {
}
myFunc();
myFunc();
myFunc();Results
Go to definition hover:

Go to symbol: 
I was able to fix the symptoms by changing to "variable.function.ts" in the function-call matcher at https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScript.tmLanguage#L3791
The syntax did use variable.function before, but it was changed in 55c8c9e , perhaps in response to #72.
Activity
sheetalkamat commentedon Apr 21, 2017
Function calls now have 'meta.function-call' scope by f2cdd8b and that should help with the themes. Unless there is absolute need I don't think we can change the scope to variable.function as that doesn't seem to be common use (eg. look at the grammar at atom/language-javascript )
tomv564 commentedon Apr 24, 2017
Thanks for responding - is there a plan to eventually remove
entity.name.function.tswheremeta.function-callwas added?As this is not a theming issue, there is no other workaround (short of maintaining a fork of this syntax) for ST3 users.
sheetalkamat commentedon Apr 24, 2017
As such there is no plan to replace
entity.name.functionwithvariable.function(in function usage scenarios). I am adding Matt Bierner (@mjbvz) and Martin Aeschlimann (@aeschli) to see what they think as they would need to make changes to vscode themes if we decide to change this.tomv564 commentedon Apr 24, 2017
Forgot to add that switching to
variable.functionis not really important,meta.function-callis fine (also commonly used in the ST3 syntaxes).Several other of the VS Code syntaxes (go, python, ruby) only apply
entity.name.functionto function definitions, but several others (rust, c#) apply to invocations as well.aeschli commentedon Apr 25, 2017
I think using
entity.name.functiononly for function declarations is the right thing to do, but none of the grammars in our repo usesvariable.function. I know that the Sublime doc lobbies for it but my guess it will result in a lot of functions colored as variables. IMO most common issupport.functioneven I understand that this is not 100% correct.meta.function-callis also used and I wouldn't object to support it.mikelward commentedon Jun 18, 2018
Sheetal Nandi (@sheetalkamat) It doesn't help, because of vscode-textmate issue 52, which means you can't style
entity.name.function - meta.function-calldifferently fromentity.name.function.