Boursomaster
Boursomaster

Reputation: 230

Intellisense stuck on loading with typescript

Got an issue with intellisense of visual studio code while i'm using typeScript. When i type 'myobject.', i don't have autocomplete. And when i force it with ctrl + space i got a loading... If i wait like 5 minutes on the code, i finaly manage to have the autocomplete, but i have to wait like 5 min everytime i want to use the intelisense.

I've tried to use npm install -g typescript.

I've also to check if "TypeScript and JavaScript Language Features" was enable.

Here is my tsconfig.json

{
  "compilerOptions": {
    "noImplicitAny": true,
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "@angular/*": ["node_modules/@angular/*"]
    }
  },
  "typeRoots": [
    "node_modules/@types"
  ],
  "exclude": [
    "node_modules",
    "out",
    "src/**/*.spec.ts",
    "src/test.ts",
    "../node_modules"
  ],
  "include": [
    "src/**/*.ts",
      "plugins/cordova-plugin-file/types/index.d.ts"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

Can you please help me to make intellisense work properly ?

Upvotes: 7

Views: 2939

Answers (2)

Henry Ozoani
Henry Ozoani

Reputation: 125

I had this same problem, but it started when I made a deeply recursive type. I think while the intellisense was trying to making sense of the type, it stuck on an infinite loop, which would be why it was stuck on loading.

What I did that solved the issue on my case was:

  • Uninstall and reinstall VS Code with the latest version ( v1.96.2 ).

  • Update my Node.js version to latest (v23.5.0).

  • Disable GitHub Copilot extensions.

For a reference on the recursive type I made:


/**
 * Enumerate numbers from 0 to N-1
 * @template N - The upper limit (exclusive) of the enumeration
 * @template Acc - An accumulator array to collect the numbers
 *
 * @see {@link https://stackoverflow.com/a/39495173/19843335 restricting numbers to a range - StackOverflow}
 */
type Enumerate<
    N extends number,
    Acc extends number[] = [],
> = Acc["length"] extends N // Check if the accumulator array's length has reached N
    ? Acc[number] // If so, return the numbers in the accumulator array as a union type
    : Enumerate<N, [...Acc, Acc["length"]]>; // Otherwise, continue the enumeration by adding the current length to the accumulator array

/**
 * Create a range of numbers from F to T-1
 * @template F - The starting number of the range (inclusive)
 * @template T - The ending number of the range (exclusive)
 *
 * @see {@link https://stackoverflow.com/a/39495173/19843335 restricting numbers to a range - StackOverflow}
 */
type IntRange<F extends number, T extends number> = Exclude<
    Enumerate<T>, // Enumerate numbers from 0 to T-1
    Enumerate<F> // Exclude numbers from 0 to F-1, resulting in a range from F to T-1
>;

/**
 * Define a range of numbers for question steps, from 1 to 10 (inclusive of 1, exclusive of 11)
 *
 * @see {@link https://stackoverflow.com/a/39495173/19843335 restricting numbers to a range - StackOverflow}
 */
type QuestionsStepsRange = IntRange<1, 11>;

Upvotes: 0

Ellix4u
Ellix4u

Reputation: 586

Try uninstalling "debugger-for-chrome" extension if installed.

Upvotes: 2

Related Questions