gluestack-ui: TypeScript Intellisense in VSCode Slows When Importing GlueStackUi in React Native

Description

Happens in react native. When importing packages into any component, Visual Studio Code’s (VSCode) suggestions feature experiences a significant slowdown. In certain instances, the suggestions might take an extended period to load or might not load at all. This issue was investigated by employing the following steps: Initially, all imports in the component were commented out, and VSCode was reloaded. One by one, each import was uncommented, and the IntelliSense speed was tested after each enabling. Notably, upon enabling the import for gluestack, a project-wide slowdown was observed in import-related IntelliSense. The slowdown in intellisense impacts productivity and responsiveness during coding sessions.

CodeSandbox/Snack link

No response

Steps to reproduce

  1. Open Visual Studio Code (VSCode).
  2. In react-native. Create a new component that requires multiple package imports.
  3. Temporarily disable all these imports within the code.
  4. Reload VSCode.
  5. Re-enable one of the imports, excluding @gluestack-ui/themed. For instance, choose react-native-vector-icons.
  6. Attempt to test IntelliSense by hovering over code elements or invoking IntelliSense with Ctrl + Option (on Mac) or the appropriate shortcut on your system.
  7. Finally, introduce an import for gluestack. Observe any changes in speed or performance.

gluestack-ui Version

0.1.1

Platform

  • Android
  • Expo
  • iOS
  • Next

Other Platform

No response

Additional Information

Used vscode. Tried both on Mac and Windows. Both of the OS in latest versions

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 5
  • Comments: 20 (4 by maintainers)

Most upvoted comments

@ankit-tailor I still have this issue with all the latest versions of gluestack. Just importing something like import { Box, Fab, FlatList, Heading, Text } from "@gluestack-ui/themed"; drastically makes it so the intellisense takes about 4-5 seconds to popup compared to instantly when the import is commented out.

Hey @suhaotian, We are working on this. You can track the issue here #1663.

Hi everyone, We’ll fix this issue in upcoming releases. We have added it to roadmap.

for those who are still wondering about the reason why intellisense is running slow, the answer may be - if you have added this regex from docs(https://gluestack.io/ui/docs/home/getting-started/tooling-setup) to the ./vscode/settings.json file:

slow
{
  "tailwindCSS.experimental.classRegex": [
    ["tva\\((([^()]*|\\([^()]*\\))*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
  ]
}

this regex slows down the tailwind autocomplete, and as a result it gets stuck. the temporary solution I found is to refactor the regex expression:

{
  "tailwindCSS.experimental.classRegex": [
    ["tva\\(([^)]*)\\)", "{?\\s?[\\w].*:\\s*?[\"'`]([^\"'`]*).*?,?\\s?}?"]
  ]
}

it still slows down my vscode today

First time trying using this library on a new project. Happened to me today, I thought was Neovim and tsserver configuration because was using a huge amount of memory ram.