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

Go to definition goes to lib.es6.d.ts definition instead of local class #12866

Closed
mjbvz opened this issue Dec 13, 2016 · 3 comments
Closed

Go to definition goes to lib.es6.d.ts definition instead of local class #12866

mjbvz opened this issue Dec 13, 2016 · 3 comments
Labels
Design Limitation Constraints of the existing architecture prevent this from being fixed VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Dec 13, 2016

From microsoft/vscode#17083

TypeScript Version: 2.1.4

Code

class History {
    foo() {
        new History()
    }
}

Trigger go to definition on History in new History()

Expected behavior:
TypeScript server returns definition result for the History class defined in this file

Actual behavior:
Returns definition for History from lib.es6.d.ts instead.

@RyanCavanaugh
Copy link
Member

This is a duplicate identifier error; there's no "local" class per se and it's just arbitrary which we go to. If this is in a module (add a top-level export / import statement), the go-to-def goes to the right place.

@mjbvz
Copy link
Contributor Author

mjbvz commented Dec 13, 2016

Yes, if this is in a TypeScript file then we see that error message. If the class is in a JavaScript file, I believe this is valid code and we do not generate any errors or warnings.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 15, 2016

not sure there is much we can do here. we should consider showing this error in a .js (as part of #6802) file to make it clear that you are overriding a known global declaration.

@mhegazy mhegazy added the Design Limitation Constraints of the existing architecture prevent this from being fixed label Dec 15, 2016
@mhegazy mhegazy closed this as completed Dec 15, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Design Limitation Constraints of the existing architecture prevent this from being fixed VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

3 participants