question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma types are not regeneraetd until Visual Studio Code restarts

See original GitHub issue

Bug description

When adding a new model to my schema, Visual Studio Code fails to realize that I can use this as a property on the prisma object until I restart the program. Perhaps this is a Visual Studio Code bug instead? Sorry if so and feel free to close.

How to reproduce

  1. Open schema and a .ts file in Visual Studio Code
  2. Add a model to your schema, or change the name of your schema
  3. Try to find the new or renamed schema in your .ts file
  4. It cannot

Expected behavior

I would expect the new schema values to be available in my .ts files.

Prisma information

No special schema in place. You can reproduce this with this simple code in your .ts file:

const test = await prisma.schemaName.findMany();

Environment & setup

  • OS: Mac OS
  • Database: SQLite
  • Node.js version: v14.4.0
  • Prisma version
2.21.2

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
theowiersemacommented, May 7, 2021

Hmm. Well if I ever come across another reproducible case I’ll attempt to document it. In the meantime, when in doubt I can just npx prisma generate excessively 😉

0reactions
janpiocommented, May 7, 2021

VSCode and Typescript are not super big friends when it comes to reload type definitions. We actually do some fancy stuff in our VSCode extension to try to work around that, but it does not work all the time (and unfortunately there is no way for us to recognize). Maybe you hit one of these cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Have to restart vscode after prisma generate #3474 - GitHub
I have to restart ascode after running prisma generate in order to use autocompletion (prisma extension is installed).
Read more >
Prisma Schema not updating properly after adding new fields
Restart VS Code language server (Hit Ctrl + Shift + P , then search for Restart TS server )
Read more >
Improving the Prisma VS Code Extension with WebAssembly
Learn about the Prisma schema and how we improved reliability and simplified the Prisma Visual Studio Extension with Rust and WebAssembly.
Read more >
Prisma client breaks when I add a field to a model
I'm trying to add a new field to an existing model, and I keep hitting a mysterious Prisma error. Here's what I did:...
Read more >
Fullstack ecommerce site using Nextjs, Supabase, prisma and ...
To put it another way, this tutorial will not only teach you how to ... For this article tutorial, we'll be using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found