Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio Code - IntelliSense for JS and TS not working properly with NextJs. #32045

Closed
tahonaPL opened this issue Dec 2, 2021 · 6 comments · Fixed by #32077
Closed

Visual Studio Code - IntelliSense for JS and TS not working properly with NextJs. #32045

tahonaPL opened this issue Dec 2, 2021 · 6 comments · Fixed by #32077
Assignees
Labels
Developer Experience Issues related to Next.js logs, Error overlay, etc. TypeScript Related to types with Next.js.

Comments

@tahonaPL
Copy link

tahonaPL commented Dec 2, 2021

What version of Next.js are you using?

12.0.4

What version of Node.js are you using?

16.xx

What browser are you using?

Chrome

What operating system are you using?

Windows/MacOS

How are you deploying your application?

not important

Describe the Bug

VSC doesn't see Next components. I tried with clean install for ts and js project.

For this components:
Image, Head, Link etc.

there is no auto-completion/suggestions that should come from next/image , next/head and next/link.

Expected Behavior

nice auto completion and auto import.

To Reproduce

  1. yarn create next-app --typescript or yarn create next-app -
  2. go to /pages/index.ts
  3. remove import next/head
  4. click on < Head >
  5. hit CTRL + space (to show suggestion or import )
@tahonaPL tahonaPL added the bug Issue was opened via the bug report template. label Dec 2, 2021
@timneutkens
Copy link
Member

Can you try using next@canary? We recently landed #28316.

@tahonaPL
Copy link
Author

tahonaPL commented Dec 2, 2021

@timneutkens I have checked the canary. There is some improvement but it tries to use wrong module path.

example:
import { Head } from "next/document"; ???

and still no Link and Image in suggestions

@balazsorban44 balazsorban44 added the TypeScript Related to types with Next.js. label Dec 3, 2021
@balazsorban44
Copy link
Member

import { Head } from "next/document"

Is not the one you want to use in pages/index, that's for the _document file. This seems to work already on latest.

I do auto-suggestions after upgrading to canary like so:

next/head
image

next/image
image

next/link
image

@balazsorban44 balazsorban44 added Developer Experience Issues related to Next.js logs, Error overlay, etc. and removed bug Issue was opened via the bug report template. labels Dec 3, 2021
@kodiakhq kodiakhq bot closed this as completed in #32077 Dec 3, 2021
kodiakhq bot pushed a commit that referenced this issue Dec 3, 2021
Fixes #32045

doing `export { default } from 'module'` has some unexpected results for autocompletion in TypeScript, this PR changes root definitions to have a named default export where needed.

## Bug

- [x] Related issues linked using `fixes #number`
Kikobeats pushed a commit that referenced this issue Dec 3, 2021
Fixes #32045

doing `export { default } from 'module'` has some unexpected results for autocompletion in TypeScript, this PR changes root definitions to have a named default export where needed.

## Bug

- [x] Related issues linked using `fixes #number`
@balazsorban44
Copy link
Member

This is fixed in next@12.0.5-canary.16 give it a try!

Example:
image

@tahonaPL
Copy link
Author

tahonaPL commented Dec 4, 2021

Great job. thx for fixing this.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
natew pushed a commit to natew/next.js that referenced this issue Feb 16, 2022
Fixes vercel#32045

doing `export { default } from 'module'` has some unexpected results for autocompletion in TypeScript, this PR changes root definitions to have a named default export where needed.

## Bug

- [x] Related issues linked using `fixes #number`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Developer Experience Issues related to Next.js logs, Error overlay, etc. TypeScript Related to types with Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants