#suggestions - vscode

3 messages · Page 1 of 1 (latest)

shut remnant
#

I have install astro extension for vs code. but suggestions for import doesn't work for newly created components. how to fix?

fringe jayBOT
#

Hi @shut remnant. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

Astro provides built-in support for TypeScript, which can help with autocompletion, hints, and errors in your editor. However, the Astro dev server won't perform any type checking. You can use a separate script to check for type errors from the command line source (https://docs.astro.build/en/guides/typescript#_top).

If you're having issues with the VSCode extension not providing suggestions for newly created components, it could be due to a variety of reasons. Here are a few things you can try:

  1. Check your TypeScript setup: Make sure you have a .ts file and import an Astro component into it. You should have no warning messages from your editor source (https://docs.astro.build/en/guides/typescript#setup).

  2. Use defineConfig() in your configuration file: Astro recommends using the defineConfig() helper in your configuration file. This provides automatic IntelliSense in your IDE. Editors like VSCode are able to read Astro’s TypeScript type definitions and provide automatic jsdoc type hints, even if your configuration file isn’t written in TypeScript source (https://docs.astro.build/en/guides/configuring-astro#config-intellisense).

  3. Check for errors in your components: If you're trying to import or render an invalid component, or one that is not working properly, you might encounter issues. Try looking for errors in any component you are importing and rendering, and make sure it’s working correctly source (https://docs.astro.build/en/guides/troubleshooting#expected-a-default-export).

If none of these suggestions work, it might be a good idea to open an issue on the Astro GitHub page (https://github.com/withastro/astro/issues) to get help from the community.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: