What are effective methods for enhancing Typescript IntelliSense in VsCode for improved performance?

Behold, my trusty machine:

  • MacBook Pro (16-inch, 2019)
  • 2.3 GHz 8-Core Intel Core i9
  • 16 GB 2667 MHz DDR4
  • Intel UHD Graphics 630 1536 MB

When I delve into typescript with angular, a glitch arises: https://i.sstatic.net/jcNcE.gif

The larger the project, the longer the load times get, dampening my developer vibe. Is there a way to beef up VS Code's performance by allocating more resources? Any tricks or optimizations worth exploring?

Remedies attempted:

Sample Project layout:

Answer №1

Turning off this feature significantly improved the speed.

You can test if a specific extension is causing the issue with this method.

  • Access the Command Palette by pressing Ctrl+Shift+P
  • Search for "Disable all installed extensions"
  • Re-enable extensions one at a time or in batches and observe the impact on IntelliSense performance

Answer №2

Here are your options:

  • Turn off the default extensions and reboot your system

  • Deactivate eslint and tslint-plugin

  • This decision varies depending on which version of VsCode you have

Answer №3

If you're looking to make a change, head over to the settings and select this option:

Disable Automatic Type Acquisition in TypeScript

https://i.sstatic.net/HC9DW.png

Answer №4

Dealing with a similar issue, I found a solution by updating the TypeScript SDK used by VSCode. Start by installing the latest version of TypeScript globally using npm or yarn.

npm i -g typescript@latest

Next, locate the global installation location of your TypeScript library by running the following command:

npm root -g

This will provide the path to the global node_modules directory, such as C:\Users\bob\npm\node_modules. In the settings of VSCode, search for typescript.tsdk and enter the path from the previous command followed by /typescript/lib, like

C:\Users\bob\npm\node_modules\typescript\lib
. https://i.sstatic.net/CShST.png

After making these changes, try restarting VSCode... Hopefully, this information proves helpful :)

Answer №5

To troubleshoot any issues with your TS Server, it is recommended to review the server logs. You can do this by adjusting the following setting in your settings.json:

"typescript.tsserver.log": "verbose"

After making this change, navigate to the output tab in the bottom pane to locate the tsserver Log file. Once you have identified the file, run the command tail -f /path/to/tsserver.log.

If you discover that certain files are not being ignored, you can resolve this issue by updating your jsconfig.json file located at the root of your project. Simply add the following code snippet:

{
    "exclude": [
        "node_modules",
        "<folder with unnecessary large files>"
    ]
}

Answer №6

In case you are utilizing mongoose, certain editions may lead to this issue (specifically versions 5x and possibly some of the 6x). Resolving the problem could involve updating mongoose or transitioning to prisma.

Answer №7

Head over to the extensions tab and search for TypeScript-specific extensions that are labeled as Reload Required. If you come across any, make sure to reload them.

In my case, I found that the

JavaScript and TypeScript Nightly
extension needed a refresh.

Answer №8

The issue, in my opinion, stems from the codebase we are using. By removing the PandaCSS generated files (.d.ts and .mjs), we noticed a significant improvement in speed.

Answer №9

In my experience, adjusting the VSCode preference

"files.autoSaveDelay": 10
significantly slows down the linting process. It might be more effective to set it to a higher value such as 100 or even 1000.

Answer №10

After struggling with sluggish intellisense features for a while, I finally discovered the culprit today. Upon examining vscode's settings.json file, I found inaccuracies in the watcherExclude block, particularly the incorrect path mapping "**/node_modules/*/**": true. Additionally, there were exclusions set for the .git directory. Since my workspace root contains a node_modules folder, I adjusted this to "node_modules/**/*": true and ".git/**/*": true to exclude all contents within the .git folder. Surprisingly, after making these changes, regardless of the TypeScript version I use, tsserver now operates at the desired speed. Hopefully, this improvement is not just temporary!

Answer №12

Changing the setting for "Include Package JSON Auto Imports" to "On" instead of "auto" was the solution that worked for me.

"typescript.preferences.includePackageJsonAutoImports": "on"

I'm not entirely sure why this change improves performance, so if anyone has more insights, I would greatly appreciate an explanation.

Source: https://github.com/microsoft/TypeScript/issues/58709#issuecomment-2153332198

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

TypeScript function that differentiates types and provides extra information

Can a type guard function also provide additional data? Like this example: function isNumberData(value: any): [value is number, message: string] { if (typeof value === 'number') { return [true, ""] } else { retu ...

Unable to generate a preview of the image that has been uploaded [using the REST API

While attempting to upload from my Ionic App to the Codeigniter Rest Server, I encountered an issue where the image could not be previewed after it was opened. To guide me through the uploading process from the app's end, I followed this tutorial: Th ...

React Hot Toast useState is unfortunately not exported from the React library

While working on a Next.js project, I encountered an issue when trying to use react-hot-toast. When I attempted to import it into any file, I received the following error message: Error - ./node_modules/react-hot-toast/dist/index.mjs Attempted import erro ...

Tips for organizing my data upon its return into a more efficient structure

I need to restructure API data that is not optimized in its current format Unfortunately, I am unable to ask backend developers to make the necessary changes, so I am exploring ways to clean up the model locally before using it in my Angular 2 application ...

The Facebook provider is missing in Ionic Native

An error has occurred: No provider for Facebook!     InjectionError (core.es5.js:1231)     NoProviderError (core.es5.js:1269)     ReflectiveInjector_ ...

Problem with opening the keyboard feature in an Ionic app

Hello everyone, I'm relatively new to Ionic development and I've been trying to integrate a keyboard plugin into my application that opens from the footer and focuses on input fields for entering values. Here is the link to the plugin I used: ht ...

Typescript HashMap implementation with Lists as values

Currently delving into TypeScript, I am attempting to generate a collection in a manner akin to the following Java example: HashMap<String, List<String>> hashMap = new HashMap<String,List<String>>(); Struggling to locate any releva ...

How to define an object type in Typescript without specifying types for keys in order to access keyof

Is there a way to define the type for object keys without individually defining types for each value? const sizes: Record<string, CSSObject>= { md: { padding: [10, 24], fontSize: 'medium', }, xs: { padding: [6, 12], f ...

Leveraging a shared library in Typescript

How can I efficiently share code between different codebases that are all written in TypeScript and constantly being developed? I am seeking a straightforward solution. Some of the methods I have attempted include: 1 Utilizing import statements with path ...

Removing an item from Storage in Angular 2: A simple guide

Is there a way to remove items from storage by clicking on a button added through input and stored in the page? Although elements are deleted from the page, they seem to be retained in storage even after refreshing the page. file home.html <ion-list&g ...

An issue arises with launching karma.js when importing node-openid-client in a TypeScript specification file

Utilizing the node-openid-client library for OpenIDConnect based authentication with an OpenID Provider. Encountering challenges while attempting to write test cases for the program. The application runs smoothly from node CLI, obtaining the code and toke ...

Retrieve the value of an ng-select component upon submitting a form

As a newcomer to Angular, I'm seeking guidance on how to properly handle form submissions with NgSelect in my project. Within my new-team.component.html file, I have the following code structure: <app-header></app-header> <div class="c ...

Building a typeguard in Typescript that handles errors

type VerifiedContext = Required<ApolloContext>; function authenticateUser(context: ApolloContext): context is VerifiedContext { if (!context.user) { throw new AuthenticationError("Login required for this operation"); } return true; } Here ...

Create a mock of a function that executes a promise

I've been struggling to write unit tests for a registration page in a new React application. Since I'm new to Sinon stubs/spies, I've been facing difficulties intercepting function calls and forcing resolutions. Below is my initial test ca ...

Creating a unique theme export from a custom UI library with Material-UI

Currently, I am in the process of developing a unique UI library at my workplace which utilizes Material-UI. This UI library features a custom theme where I have integrated custom company colors into the palette object. While these custom colors work perfe ...

What is the best way to dynamically add or utilize a pipe in Angular 8?

I have a special pipe in my Angular 8 application that I created: import { Pipe, PipeTransform } from '@angular/core'; import { MyService} from '../_services/my.service'; @Pipe({ name: 'myPipe' }) export class MyPipe imp ...

Retrieve the final variable in an Observable sequence

In my code, I have a variable called 'messages' which stores messages from a conversation: messages: Observable<Message[]>; To populate the 'messages' variable, I do the following: const newMessage = new Message(objMessage); ne ...

Leveraging JSX components from a React theme within an ASP.NET Core React Redux web application template with VS2017

I have developed a project in Visual Studio 2017 preview using the ASP.NET Core "React.js and Redux" project template. Now, I am attempting to integrate components from a theme into my project, but encountering some issues that I have not been able to res ...

In Angular 4, the variable within the component is refreshed or updated only when the service is called for the second

Recently, I started working with the Angular framework and encountered an issue while developing a basic data retrieval feature from a component using a service. I had already set up a web service that returns specific data for an ID (wwid). The function c ...

Dealing with mistakes in an Angular service

I've been grappling with error handling in Angular. I attempted to handle errors within a service, but I'm uncertain if that's the correct approach. @Injectable({ providedIn: 'root', }) export class CaseListService { public con ...