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

TypeScript symbols is empty inside closure (like jQuery plugins) #8218

Closed
jrieken opened this issue Apr 20, 2016 · 8 comments
Closed

TypeScript symbols is empty inside closure (like jQuery plugins) #8218

jrieken opened this issue Apr 20, 2016 · 8 comments
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@jrieken
Copy link
Member

jrieken commented Apr 20, 2016

From @Ciantic on January 2, 2016 8:38

I tried developing basic jQuery plugin with TS, looks like the symbols list is totally empty if I use following code:

/// <reference path="./typings/tsd.d.ts" />
(function ($: JQueryStatic) {

    interface Anything {
        something : string
    }

    function func() {
    }

})(jQuery);

I think it should recgonize the whole file spanning closure and not let it ruin the symbols listing.

Copied from original issue: microsoft/vscode#1741

@jrieken
Copy link
Member Author

jrieken commented Apr 20, 2016

From @felixfbecker on January 3, 2016 12:5

I also think this is annoying. Symbols view only shows symbols in the global scope, also for Javasript. If you use class expressions for Angular, like .controller('MyController', class MyController { ... }) you will never get any methods of that class show up in the symbol view.

@jrieken jrieken self-assigned this Apr 20, 2016
@jrieken jrieken added the js label Apr 20, 2016
@jrieken
Copy link
Member Author

jrieken commented Apr 20, 2016

From @paramquery on April 20, 2016 14:5

+1

much needed feature.

@jrieken
Copy link
Member Author

jrieken commented Apr 20, 2016

This is an issue with TypeScript. For JavaScript this actually works a lot better then for TypeScript despite using the same language service...

@mhegazy mhegazy added Bug A bug in TypeScript API Relates to the public API for TypeScript and removed js labels Apr 20, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Apr 20, 2016

@billti had a fix for the JS case. we need to unify the two implementations. #7523 tracks some of this work.

@mhegazy mhegazy added this to the TypeScript 2.0 milestone Apr 20, 2016
@mhegazy mhegazy assigned ghost and unassigned billti Jun 6, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jun 6, 2016

@andy-ms would this be handled by your refactor?

@ghost
Copy link

ghost commented Jun 6, 2016

In the #8958 branch, Anything shows up, but func doesn't. We had decided that inner functions wouldn't show up if they didn't have any children. I don't know how exactly we should handle this, but maybe the entire module going in a single closure is a pattern we could recognize — although trying to recognize particular patterns like this could pile up to a list of messy special cases.
So, not sure if this is totally resolved. Improved, though.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 6, 2016

i think that is a better place to be in. if that turned out to be another source of complains, may be we should allow all function declarations regardless if they are containers or not.

@ghost ghost mentioned this issue Jun 7, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jun 9, 2016
@ghost ghost mentioned this issue Jun 16, 2016
@ghost
Copy link

ghost commented Jun 20, 2016

Closed by #9220

@ghost ghost closed this as completed Jun 20, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants