pichillilorenzo / JavaScriptEnhancements

JavaScript Enhancements is a plugin for Sublime Text 3. It offers not only a smart javascript autocomplete but also a lot of features about creating, developing and managing javascript projects (real-time errors, code refactoring, etc.).
MIT License
638 stars 41 forks source link

Plugin doesn't autocomplete from node_modules imports #61

Closed nelsonvassalo closed 6 years ago

nelsonvassalo commented 6 years ago

Expected Behavior

Autocomplete from node_modules

Actual Behavior

Empty definitions and no autocomplete for node modules

Sublime Text console logs

Screenshots

Steps to Reproduce the Problem

  1. Hovering or hitting key combination for completion shows only any => any

Specifications

pichillilorenzo commented 6 years ago

To get autocompletion from your imported files from node_modules, you need to download the flow type definitions (typescript works the same), see:https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Adding-new-definitions-with-flow-typed

If the type definition is missing in the official flow-typed repository, then autocompletion will not show up because Flow cannot get it.

nelsonvassalo commented 6 years ago

Hi

Does that mean every single library needs its own Flow type definition? Or is there s single Flow def for ‘node_modules’?

What about my custom modules, will they be autocompleted?

Thank you On 6 Jul 2018, 00:36 +0100, Lorenzo Pichilli notifications@github.com, wrote:

To get autocompletion from your imported files from node_modules, you need to download the flow type definitions (typescript works the same), see:https://github.com/pichillilorenzo/JavaScriptEnhancements/wiki/Adding-new-definitions-with-flow-typed If the type definition is missing in the official flow-typed repository, then autocompletion will not show up because Flow cannot get it. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

pichillilorenzo commented 6 years ago

Does that mean every single library needs its own Flow type definition?

Yes, for example if you are using "express" in a node.js app, you will need its flow type definition to get autocompletion

What about my custom modules, will they be autocompleted?

technically, yes! But if they are in node_modules folder, then you need also here flow type definition

This is how flow (and typescript) works

nelsonvassalo commented 6 years ago

So if instead of laoding a big library, like say Three.js out of the modules and into my own source folder, they’d suddenly get autocomplete?

nelsonvassalo commented 6 years ago

So I came across a Typescript definitoon for these libraries. Any chance I can use that instead of the flow def?

pichillilorenzo commented 6 years ago

You need to install the Typescript plugin for Sublime to work with .ts files because this plugin works only with .js files! If you are working in a typescript project, then the Typescript plugin will do the job