2

I have been using VSCode intellisense happily since quite a long time.

Now I am doing something very simple: create a new project, add a package like rxJs and then start coding.

What I find is that intellisense is not working as it is used to.

In particular, if I just open a file like test.ts and add the following innocent code

of('abc'). // of is a function of rxJs

I get this response from intellisense

intellisense not giving the right support

At the same time if I start importing manually the function and do ctrl+space between the brackets I get the expected help.

here intellisense works

I am pretty sure I am missing something very basic, but after few hours of browsing I could not find any answer.

Here my tsconfig.json

{
    "compilerOptions": {
      "target": "es6",
      "module": "commonjs",
      "outDir": "dist",
      "sourceMap": true,
      "declaration": true,
      "noUnusedLocals": true,  
      "noUnusedParameters": true  
    },
    "include": [
      "src/*.ts",
      "src/**/*.ts"
    ],
    "exclude": [
      "node_modules"
    ],
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }

2 Answers 2

0

The function of needs to be imported for it to be available in the file.

Error:

of('abc'). // of is a function of rxJs

No error:

import {of} from 'rxjs';
of('abc'). // of is a function of rxJs
Sign up to request clarification or add additional context in comments.

4 Comments

This is clear, but in all other projects I have, when I write of intellisense suggests where to import it from. This what I am not experiencing in this simple project.
there is quick fix option and there should be import suggestions. you can open quick fix window with "crrl+."
@basarat @Juraj Kocan The problem seems to have disappeared just with time. Probably its cause was that I was not giving enough time to VSCode to become aware of the existence of rxJs. After I left the computer idle for some time, I am not experiencing the problem any more.
I am having the same problem. Intellisense no longer working, I am unable to import of, filter, map etc. Have to type the import statement in manually. Quick fix is now useless - asks me if I want to replace 'filter' with 'file'. Obviously I do not.
0

My intellisense started working again after removing my include and exclude settings in tsconfig, despite them being correct. Odd!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.