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

feat(LS): references #1775

Merged
merged 6 commits into from
Jul 4, 2024
Merged

feat(LS): references #1775

merged 6 commits into from
Jul 4, 2024

Conversation

Druue
Copy link
Contributor

@Druue Druue commented Jun 26, 2024

To test this locally:

  1. npm i && npm run bootstrap in the root of language-tools
    2. ./prisma-schema-wasm/scripts/update-schema-wasm.sh in the root of engines
  2. npm run compile in the root of language-tools
  3. In VS Code open run & debug (cmd + shift + d on mac) and hit Launch VS Code extension

3.5 if you see the the following error message:

Error: Cannot find module '.../language-tools/packages/language-server/dist/bin'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1084:15)
    at node:internal/modules/cjs/loader:929:27
    at Function._load (node:electron/js2c/node_init:2:13672)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:101:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
  1. cd packages/language-server
  2. tsc -p ./ and re-try launching the extension

companion pr to prisma/prisma-engines#4934

@Druue Druue added this to the 5.17.0 milestone Jun 26, 2024
@Druue Druue self-assigned this Jun 26, 2024
Copy link

github-actions bot commented Jul 4, 2024

🤖 Pull request artifacts

empty string

file commit
prisma.vsix c16f72b

Copy link

github-actions bot commented Jul 4, 2024

github-actions bot added a commit that referenced this pull request Jul 4, 2024
@Druue Druue force-pushed the feat/references branch from 9bbb1fe to ea3c134 Compare July 4, 2024 11:35
github-actions bot added a commit that referenced this pull request Jul 4, 2024
@Druue Druue requested a review from SevInf July 4, 2024 11:37
github-actions bot added a commit that referenced this pull request Jul 4, 2024
github-actions bot added a commit that referenced this pull request Jul 4, 2024
github-actions bot added a commit that referenced this pull request Jul 4, 2024
Copy link

@SevInf SevInf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing console.log, otherwise looks good!

packages/language-server/src/server.ts Outdated Show resolved Hide resolved
@SevInf
Copy link

SevInf commented Jul 4, 2024

I've tested that a bit in a GitPod and i thing references for the fields works a little bit backwards from how I am expecting them to:

I have 3 files:

// config.prisma
generator client {
    provider = "prisma-client-js"
    previewFeatures = ["prismaSchemaFolder"]
}

datasource db {
    provider = "sqlite"
    url = "file:dev.db"
}

// User.prisma
model User {
    id   String @id
    name String
    posts Post[]
}


// Post.prisma

model Post {
    id String @id
    title String
    authorId String
    author User @relation(fields: [authorId], references: [id])
}

When I look for references of User.id, I'd expect to get author User @relation(fields: [authorId], references: [id]) line in Post.id as a result. At the same time, I am not sure, looking for references of [authorId] in relation/index definition should produce any result (it points to authorId now) - it is index or relation that references the field, not other way around.

Co-authored-by: Serhii Tatarintsev <[email protected]>
github-actions bot added a commit that referenced this pull request Jul 4, 2024
@Druue Druue merged commit ca5d029 into main Jul 4, 2024
6 checks passed
@Druue Druue deleted the feat/references branch July 4, 2024 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants