Open Ismael-Oliv opened 4 years ago
Does it show any other autocomplete? Something like:
["1"].conc
should suggest concat
.
yeah, It does
@lierdakil Any idea about this? Has anything changed from the TypeScript side?
@Ismael-Oliv Please try with v1.2.1 and see if this fixes it.
Not yet, but it worked when I installed the express types' => @types/express.
And I think it's because of autocomplete-paths package , its showing so many stuffs .
If you type
const fs = require('f
doesn't it offer 'fs'?
It offers all the installed dependencies and Node libraries to me:
If you want a specific library you should install it inside package.json, otherwise, it will only show the Node libraries.
yeah, But it just shows the "require" options because I had installed the express types of typescript
When I try to import anything without installing any library, it's not showing ...
But I'm gonna remove atom and Install again with all packages. to see if it work
OK. Now I understand the problem better. When you do not have any library installed, it does not show it. Although I cannot reproduce it, I will take a closer look.
I do not think reinstalling Atom helps much. If you install atom-ide-javascript only, it will install all the deps automatically.
I can confirm that sometimes the autocomplete is not fast/intelligent enough here. It might be because of the TypeScript server. @lierdakil and I will take a look into this.
I installed it again and it's not working yet
if is there something that I can do to help you, just tell me.
Try installing @types/node
for now, which you should always do when writing Node programs, until we see if we can reproduce this.
Alright, no problem. :+1:
I think I should add an option for automatic Nodejs completions. Maybe it works on my system out of the box because I have @types/node
installed globally.
Alright, I'm gonna try it ...
Without @types/*
packages in scope, TypeScript server should generally recognize require
, but only offers sub-directories of node_modules
as "bare" import suggestions. If you add ./
to the argument, it switches to local files instead. Generally a good idea to add relevant @types
to devDependencies
in any case, although I appreciate it can be a bit of a hassle. Also, unless require
is defined somewhere in the ambient declaration, tsserver doesn't assume require
is even defined, so it doesn't offer it as a suggestion.
There is a caveat however, TypeScript will sometimes cache type definitions in $HOME/.cache/typescript
and might use those even if there aren't any installed in the current project. There is very little information on when exactly this happens however, so I couldn't tell you how that works if my life depended on it.
Including/enabling Node definitions by default isn't the greatest idea, because some of us write code for the browser (shocking, I know), and we don't really want to see Node-specific suggestions that won't work.
I have a suggestion. We can add a command and a Tool-bar button to add Nodejs support by using that. People who need Node should click or run that command first, or should install the @types
Typing npm i --save-dev --only=dev @types/node
once per project isn't that much of a chore I reckon, so I don't see much value in inventing new ways to add some definitions (which aren't even necessarily correct, because who knows what node version does the user intend to use) only for the sake of saving a couple keystrokes.
The "hassle" I was talking about above is tracking down and installing definitions for all the dependencies -- that is a bit of a chore.
I am planning to add a npm IDE which adds GUI and clickable buttons for running various operations. I think we can address installing the types in that package!
When I try to import using javascript like this way "const fs = require('fs') and typescript with "import", it doesn't show all the "require" options that it used to do. I'm using the 1.2.0 atom-ide-javascript version
video.zip