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

I cannot get autocompletion when using .es6 file extension #1429

Open emanuelbsilva opened 6 years ago

emanuelbsilva commented 6 years ago

Issue and Steps to Reproduce

When using .es6 file extension autocompletion does not work. The moment i change the file extension of the file to .js it starts working.

I already tried to use the config.cson atom file to add a customFileType to "source.js" but it still doesn't work.

Versions

Additional Details

├── MagicPython@1.0.12 ├── angularjs@0.5.1 ├── atom-typescript@11.0.6 ├── busy-signal@1.4.3 ├── file-icons@2.1.15 ├── file-types@0.5.5 ├── highlight-selected@0.13.1 ├── intentions@1.1.5 ├── language-babel@2.81.1 ├── language-graphql@0.9.0 ├── language-haskell@1.17.2 ├── language-ini@1.19.0 ├── language-lua@0.9.11 ├── language-ocaml@1.9.5 ├── language-rust@0.4.12 ├── language-scala@1.1.9 ├── language-swift@0.5.0 ├── language-thrift@1.0.2 ├── linter@2.2.0 (disabled) ├── linter-ui-default@1.2.4 ├── nuclide@0.273.0 ├── nuclide-format-js@0.0.43 ├── platformio-ide-terminal@2.8.0 ├── set-syntax@0.4.0 ├── sort-lines@0.18.0 └── tool-bar@1.1.0

emanuelbsilva commented 6 years ago

I did more research on the issue and found out the origin of it. It appears that the JSAutoImports autocomplete provider is not yielding any results for some reason and that makes Atom not being able to present any autocomplete results because it's still waiting for JSAutoImports i'm assuming.

Taking a close look at the https://github.com/facebook/nuclide/blob/master/pkg/nuclide-js-imports-client/lib/main.js file i found out this code:

const lspService = await jsService.initializeLsp(
    ['.flowconfig'],
    ['.js'],
    (featureConfig.get('nuclide-js-imports-client.logLevel'): any),
    fileNotifier,
    host,
    getAutoImportSettings(),
  );
  return lspService || new NullLanguageService();

When i added '.es6' to the ['.js'] array autocomplete started working.

I think the best approach to solve the issue is to use whatever extension Atom's config.cson has registered for source.js.