facebookarchive / nuclide

An open IDE for web and native mobile development, built on top of Atom
https://nuclide.io
Other
7.79k stars 682 forks source link

Flow Class autcomplete for "extends" #444

Closed xhyp0 closed 8 years ago

xhyp0 commented 8 years ago

Issue and Steps to Reproduce

When extending a class, flow doesn't seem to provide an auto-complete. This repros on the following code:

/* @flow */

class C {
  x: string;
  y: number;
  constructor(x) { this.x = x; }
  foo() { return this.x; }
  bar(y) { this.y = y; }
}

class D extends C {
  z: number;
  foo() { return super.foo() + "!"; }
  bar(y) { super.bar(y || 0); }
}

When I create a new instance of C, the autocomplete works fine: screenshot from 2016-04-01 11 49 20

But when I create a new instance of D, it doesn't seem to work at all: screenshot from 2016-04-01 11 50 35

Even though there's no auto-complete, it looks like flow is still properly checking the code because if you try to access something that isn't in the class it will produce an error. screenshot from 2016-04-01 11 44 04

Expected Behavior

The auto-complete should list include the members of both classes.

Actual Behavior

None of the expected auto-complete entries show up. screenshot from 2016-04-01 11 50 35

Versions

OS X

├── dash@1.6.0
├── git-plus@5.9.0
├── haskell-grammar@0.4.0
├── highlight-selected@0.11.1
├── language-babel@2.16.0
├── language-ini@1.15.0
├── language-ocaml@1.1.2
├── language-thrift@1.0.2
├── linter@1.11.3
├── linter-eslint@7.1.3
├── merge-conflicts@1.3.7
├── minimap@4.21.0
├── nuclide@0.127.0
├── sort-lines@0.14.0
├── sync-settings@0.6.0
├── tool-bar@0.4.0
└── vim-mode@0.65.0

Ubuntu

├── atom-ternjs@0.13.2
├── atom-typescript@8.3.1
├── git-plus@5.7.0
├── haskell-grammar@0.4.0
├── highlight-selected@0.11.2
├── language-babel@2.16.0
├── language-ini@1.14.0
├── language-ocaml@1.1.2
├── language-thrift@1.0.2
├── linter@1.11.3
├── linter-eslint@7.1.3
├── minimap@4.21.0
├── nuclide@0.124.0
├── release-notes@0.53.0
├── sort-lines@0.14.0
├── sync-settings@0.6.0
├── tool-bar@0.3.0
└── vim-mode@0.65.0
nmote commented 8 years ago

I can reproduce this on Flow v0.21.0 (haven't tried other versions).

This is almost certainly an issue with Flow itself. We get the autocomplete results directly from Flow. I get that the Flow typechecker correctly understands extends but the autocomplete that it provides is more rudimentary. Could you re-open this issue on the Flow repository?