Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

[JS code hints] Argument type guessing is too ambitious sometimes #3573

@peterflynn

Description

@peterflynn
  1. Open the Brackets src folder
  2. Open QuickOpen.js
  3. Insert the following code just below the QuickOpenPlugin() constructor:
    function foo(a, b) {
        return a + b;
    }
    foo(
  1. Press Ctrl+space after the (

Result: hint suggests the arguments are of type "fn:(pluginDef: ?)" and "fn()" respectively.

Expected: if I place the same code at the top or bottom of the module, it says "?" for both types.

It seems to vary a lot by position within the file. If I place the code after _filenameFromPath() I get "fn(query: String.prototype) -> number" and "fn() -> [?]" instead. It seems like the first argument is always inferred to be essentially a function with the same signature as whatever function came right before foo() in the code. I'm not sure why it would make sense to guess that, though.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions