redwoodjs / rw-shad

Generate components in your RedwoodJS project
MIT License
5 stars 0 forks source link

Restart TS server #6

Open Tobbe opened 2 months ago

Tobbe commented 2 months ago

VS code seems to not pick up on imports like src/utils/cn after adding a component. Restarting the TS server seems to help. It'd be cool if we could do that automatically after running the rwgc script.

Plan for this right now:

  1. Write a VSCode extension that triggers await vscode.commands.executeCommand("typescript.restartTsServer");
  2. Install the extension by running something like code --install-extension my-extension.name during setup
  3. Figure out a way to communicating with the extensions. Maybe by spinning up an http server. OR we could have it watch for newly added files in web/src/components/ui and automatically restart
  4. Have it trigger typescript.restartTsServer when new components are added (also see above)

References:

  1. https://github.com/qcz/vscode-restart-ts-server-button/blob/master/src/extension.ts#L41C2-L41C69
  2. https://github.com/neotan/vscode-auto-restart-typescript-eslint-servers/blob/master/src/extension.ts