Add path to search classes in intellisense

53 Views Asked by At

I'm working on a TypeScript project in Visual Studio Code and I want Intellisense to search for classes and give me tips not only in my project folder but also in another folder.

This is my folder structure:

├───@lib
│   └───typescript
│       └───src
│           └───logger.ts
│
└───typescript
    └───myproject
            main.ts
            myproject.code-workspace
            package.json
            tsconfig.json

The project I'm working on is on typescript/myproject folder.

While editing typescript/myproject/main.ts, I want to import Logger class from ../../@lib/typescript/src/logger. This works fine if I manually type the path, but I want to type Logg in the editor and be able to use Intellisense to auto import Logger class from the desidered path, like if the class was in the same project or in any subfolder.

I already tried to create a workspace (myproject.code-workspace) with both folders (myproject and typescript, or typescript/src).

I also tried to edit typescript/myproject/tsconfig.json adding path to "include" like below, but nothing happens:

{
    "compilerOptions": {
        ....
    },
    "include": [
        "../../@lib/typescript",
        "../../@lib/typescript/src"
    ]
}

How to tell intellisense to search classes and methods from ../../@lib/typescript/src path?

0

There are 0 best solutions below