-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Cannot lookup symbol of nested function in method #6828
Comments
From @tinganho on February 1, 2016 10:35 Yes. |
Moving to the TS team. |
this is by desing to limit noise in the list. functions are supported to allow for JS coding patterns using nested functions. which does not seem to be that common with classes. |
@mhegazy I think the tsserver nor the language service should make that 'design' decision. It should report the full structure. If a user interface does want to limit the noise we can either filter on the UI side or instruct the tsserver with an option when running the request. |
@mhegazy I think I disagree here. It adds as much noise as if, if I would use a private method. Though the downside with a private method is that they cannot access local variables. I have found it quite useful to nest functions instead of declaring private methods. Since they are declared inside the methods which they are used. And most of my private methods is only used by one other method, I think it is more intuitive to nest the functions instead. Though, for very large methods I got a lot of nested functions. And not having the ability to find them by symbol, makes my productivity go down. And I also think something is broken every time I don't find something auto completing or not being able to find something by symbol. |
Just to clarify this is the pattern I use: Instead of this: if (true) {
a += 1;
b += 1;
c += 1;
d += 1;
} I can refactor it as: if (true) {
incrementABCD();
}
function incrementABCD() {
a += 1;
b += 1;
c += 1;
d += 1;
} I've learnt this pattern through your source code 😉 . Though, I don't want to go pure functional since I think it lacks some typing that classes got. |
PRs welcomed. |
Also related is #4481. |
Should be fixed - thanks @tinganho! |
From @tinganho on January 31, 2016 17:22
I cannot get a symbol of nested function in method.
I think the symbol
test
should show up when I doCMD + SHIFT + O
. Since it works with nested functions:I can get
test2
above.Copied from original issue: microsoft/vscode#2584
The text was updated successfully, but these errors were encountered: