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

"Quick info" and "go to definition" not working inside old school JavaScript constructor functions #26666

Closed
mjbvz opened this issue Aug 24, 2018 · 2 comments
Labels
VS Code Tracked There is a VS Code equivalent to this issue Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Aug 24, 2018

From @jakub-g on August 24, 2018 15:2

Perhaps related to #55910

  • VSCode Version: 1.26.1 stable, 1.27.0 insiders
  • OS Version: Win 10
    Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. Create JS file with contents like this (this kind of constructions are quite often used in old school mixin-based frameworks)
function MyAwesomeConstructor() {
  /**
   * @return {Number} Always 42
   */
  this.foo = function() {
    return 42
  }

  this.bar = function() {
    this.foo()
  }
}

const myObject = new MyAwesomeConstructor()
  1. Hover line 10: this.foo() call

Expected:

  • On hover, quick info with the this.foo jsdoc from the beginning of the file is displayed
  • On Ctrl+clicking on foo(), the editor should move me to the definition

Actual:

  • Quick info stating any is displayed
  • Not possible to Ctrl+click

Note: When you write myObject. and do CTRL_SPACE, both foo and bar are correctly suggested.

Copied from original issue: microsoft/vscode#57157

@mjbvz mjbvz self-assigned this Aug 24, 2018
@mjbvz mjbvz added the Domain: JavaScript The issue relates to JavaScript specifically label Aug 24, 2018
@mjbvz mjbvz added VS Code Tracked There is a VS Code equivalent to this issue and removed Domain: JavaScript The issue relates to JavaScript specifically labels Aug 24, 2018
@mjbvz mjbvz removed their assignment Aug 24, 2018
@mjbvz
Copy link
Contributor Author

mjbvz commented Aug 24, 2018

Possibly same problem as #18171

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Aug 24, 2018
@RyanCavanaugh
Copy link
Member

We'd recognize this as a class if it used the standard ES5-style prototype properties, but objects like this which don't reuse method closures are fairly rare and often don't represent class objects, so we're more conservative here and don't consider this to be all part of the same object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
VS Code Tracked There is a VS Code equivalent to this issue Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants