镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Closed

Description

@mjbvz

From jakub-g (@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

Activity

  1. added
    Domain: JavaScriptThe issue relates to JavaScript specifically
    VS Code TrackedThere is a VS Code equivalent to this issue
    and removed
    Domain: JavaScriptThe issue relates to JavaScript specifically
    on Aug 24, 2018
  2. removed their assignment
    on Aug 24, 2018
  3. mjbvz commented on Aug 24, 2018

    @mjbvz
    ContributorAuthor

    Possibly same problem as #18171

  4. RyanCavanaugh commented on Aug 24, 2018

    @RyanCavanaugh
    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.

  5. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    VS Code TrackedThere is a VS Code equivalent to this issueWorking as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions