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

[Bug?]: Autocomplete and auto-import not working on v7.3.0 for JS projects #10422

Closed
1 task
higajooj opened this issue Apr 4, 2024 · 9 comments
Closed
1 task
Labels
bug/needs-info More information is needed for reproduction

Comments

@higajooj
Copy link

higajooj commented Apr 4, 2024

What's not working?

Short after updating to v7.3.0 I started noticing some LSP problems. It turns out autocomplete barely works anymore with .js, .jsx files. I am using neovim 0.9.5.

Previously (RW v7.1.3), when I typed:

useA -> import { useAtom } from 'jotai' would show up, or
<Bui -> import { Building } from 'lucide-react'.

Now, with RW 7.3, I don't get any autocompletion at all from any package installed, besides code from within my workspace (say, import { useAuth } from 'src/auth', which works just fine).

Also, when hitting CTRL+Space in the following situation, before I would get all possible imports.
image

Now, nothing shows up.
image

I use typescript-language-server, but just to make sure this bug is not related with my editor, environment or LSP config, I also tested using vtsls and typescript-tools, results were still the same. I don't use any fancy configuration, and all other JavaScript projects I have (not using Redwood) works normally.

Now, two things worth mentioning.

  1. When I rename files from .jsx to .tsx, everthing works normally just like before, so this is only affecting JavaScript files (.js, .jsx)
  2. VS Code doesn't seem to be affected, so autocomplete and auto import works even with .js,.jsx files.

This is what bugs me the most. I work 90% slower on VS code and I also can't convert my whole project to TypeScript.

I also tried creating a brand new Redwood project (yarn create redwood-app), installed lucide-react yarn workspace web add lucide-react, and when I go to any .jsx file (page, component, cell) nothing shows up (like the screenshot above).

How do we reproduce the bug?

No response

What's your environment? (If it applies)

No response

Are you interested in working on this?

  • I'm interested in working on this
@higajooj higajooj added the bug/needs-info More information is needed for reproduction label Apr 4, 2024
@higajooj
Copy link
Author

higajooj commented Apr 5, 2024

Update!!

I've been able to track this issue down to exactly this:
chore(deps): update dependency typescript to v5.4.3

VS Code uses its own bundled typescript. If you see here, VS Code 1.88 just got rolled out with typescript v5.4 - version 1.87 and previous versions were using typescript <= 5.3. That's why I had it breaking with Neovim but not VS Code.

This is not something that affects Redwood exclusively. The simplest way to reproduce this bug is to create a Vite app using React + Typescript, install some package (Lucide or Jotai like I used as example, or any other), and just bring autocomplete to see if any imports show up. If you get your hands on VS Code >= 1.88, the same issue stated above should happen to you.

Worth remembering that this is only affecting .js and .jsx files.

@Tobbe
Copy link
Member

Tobbe commented Apr 5, 2024

Thanks for the update @higajooj! That's some great detective work right there 🙂 🕵️

As a workaround for any VSCode users you can downgrade your RW project's TS version to 5.4.2 and then tell VSCode to use the workspace version of TS instead of its built-in version. Just click the TS version number in the status bar, and choose 5.4.2 in the popup you get at the top of the screen
image
image
(I'm still on an older version of VSCode, and have 5.4.3 as my workspace version. Your numbers will look different)

@Tobbe Tobbe changed the title [Bug?]: Autocomplete and auto-import not working on v7.3.0 [Bug?]: Autocomplete and auto-import not working on v7.3.0 for JS projects Apr 5, 2024
@higajooj
Copy link
Author

higajooj commented Apr 5, 2024

Thanks @Tobbe! Unfortunately 5.4.2 is also broken. The solution is to stay on 5.3.x for now.

@Tobbe
Copy link
Member

Tobbe commented Apr 5, 2024

@higajooj BTW, is this only for RW projects, or do you see the same issue in other projects as well?

@higajooj
Copy link
Author

higajooj commented Apr 5, 2024

@Tobbe, both Redwood and plain Vite apps are affected (npm create vite). I'm not sure about other frameworks.

@higajooj
Copy link
Author

@Josh-Walker-GM
Copy link
Collaborator

Hey @higajooj, I just merged in the dependency upgrade, confirmed it fixed the problem for me locally then released it in v7.4.1. Can you confirm that v7.4.1 works as expected for you?

@higajooj
Copy link
Author

It's working 👍🏻. I was using

  "resolutions": {
    "typescript": "5.3.2"
  }

to keep up with latest Redwood without breaking my dev environment.

Thanks @Josh-Walker-GM and @Tobbe !

@Josh-Walker-GM
Copy link
Collaborator

Fixed in #10452

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/needs-info More information is needed for reproduction
Projects
None yet
Development

No branches or pull requests

3 participants