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.

Code completion issue

See original GitHub issue

Hi, currently the auto formatting in VSCode gives me PascalCase entity relations but according to the docs this is kind of an anti-pattern.

I’m also very sure that this was not the case just a while ago. Not sure when exactly this changed. Is this a bug or did the convention actually change recently?

I’m on Prisma Extension 2.6.0 and I’m using prisma cli and client in version 2.6.0 as well.

Input:

model TestModel {
  id String @id @default(cuid())
  testModel OtherTestModel
}

model OtherTestModel {
  id String @id @default(cuid())
}

Output after save:

model TestModel {
  id               String         @id @default(cuid())
  testModel        OtherTestModel @relation(fields: [otherTestModelId], references: [id])
  otherTestModelId String
}

model OtherTestModel {
  id        String      @id @default(cuid())
  TestModel TestModel[] // <- this should be camelCase?!
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jsbraincommented, Sep 3, 2020

Alright @janpio, thank you for your investigation, I’m going to do as you advise 😇

0reactions
janpiocommented, Sep 3, 2020

That version is from December last year, https://github.com/prisma/prisma/releases/tag/2.0.0-preview019. Back then the CLI was still called prisma2. Unfortunately that did not include format as command yet, and I could not figure out easily which VSCode extension version was current back then. Going by the date, it could have been around ~0.0.20 which I could install in my VSCode. Buuuuut - it does not format my schema at all for some reason - so I can not reproduce.

But we indeed did relations totally different back then and only changed it during the beta period. So I would say that of course you are getting older (every day), what you are remembering might indeed be true. It might also be that back then we did not add any back relation fields at all really, that also got only added at a certain point, but I can not find that out right now.

So for now I would close this as “works as intended” and would ask you to possibly create an issue at https://github.com/prisma/prisma/ if you care about this behavior of the formatter (because the VSCode extension only uses that for this functionality, so the issue is better over there).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code completion | IntelliJ IDEA Documentation - JetBrains
This section covers various techniques of context-aware code completion that allow you to speed up your coding process.
Read more >
Code completion not working · Issue #177 - GitHub
The internal issue is that javaCode is not being set when the code cannot compile, which for code completion is always the case....
Read more >
IntelliSense in Visual Studio Code
IntelliSense is a general term for various code editing features including: code completion, parameter info, quick info, and member lists.
Read more >
Intelligent code completion - Wikipedia
Intelligent code completion is a context-aware code completion feature in some programming environments that speeds up the process of coding applications by ...
Read more >
PyCharm Code Completion for files outside project directory
The issue is that coding these external packages there is no code completion in regard to the main apps code.
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