Broken configuration property "prismaLanguageServer.prismaFmtBinPath"
Closed this issue ยท 11 comments
Thanks for your work on this repo. It's made my introduction to prisma much smoother. Though recently it stopped working. I believe I've found the root of the issue.
The following error began popping up upon opening a .prisma
file:
[coc.nvim] The "prisma" server crashed 4 times in the last 3 minutes. The server will not be restarted.
Inspecting CocCommand workspace.showOutput
, we see
[Info - 1:28:19 PM] Default version of Prisma binary 'prisma-fmt': e421996c87d5f3c8f7eeadd502d4ad402c89464d
[Info - 1:28:19 PM] Extension name @prisma/language-server with version 2.21.2
[Info - 1:28:19 PM] Prisma CLI version: 2.21.2
/home/khalliday/.vim/plugged/coc-prisma/node_modules/@prisma/language-server/dist/src/server.js:173
const prismaFmtBinPath = getPrismaFmtBinPath(settings.prismaFmtBinPath);
^
TypeError: Cannot read property 'prismaFmtBinPath' of null
at /home/khalliday/.vim/plugged/coc-prisma/node_modules/@prisma/language-server/dist/src/server.js:173:67
at Generator.next (<anonymous>)
at fulfilled (/home/khalliday/.vim/plugged/coc-prisma/node_modules/@prisma/language-server/dist/src/server.js:24:58)
[Info - 1:28:19 PM] Connection to server got closed. Server will restart.
I believe this issue arises when @prisma/language-server
attempts to get the workspace config settings here.
It seems the workspace configuration section
is now prisma
, not prismaLanguageServer
(as it was in previous versions).
Changing my coc configuration from
"prismaLanguageServer.prismaFmtBinPath": "",
to
"prisma.prismaFmtBinPath": "",
You might consider updating the coc prismaFmtBinPath configuration key in your next release.
I will also note that the issue persists if you do not provide a "prisma.prismaFmtBinPath"
in your coc-settings.json
. Think it would be nice if you did not have to set it to the empty string to force a fallback to the default prisma-fmt
path, and instead just omit the config option.
Hey,
I have personally migrated to neovim's native lsp but I will look into this. I am aware of this issue and have encounter this when trying to configure lsp on neovim.
I think better place for this would be the lsp itself where it should null check prismaFmtBinPath
and fallback if its null: https://github.com/prisma/language-tools
@khalliday7 Im getting this too. Where exactly did you change your config?
@khalliday7 Im getting this too. Where exactly did you change your config?
In .config/nvim/coc-settings.json
, added the line "prisma.prismaFmtBinPath": ""
Hey,
I have personally migrated to neovim's native lsp but I will look into this. I am aware of this issue and have encounter this when trying to configure lsp on neovim.
I think better place for this would be the lsp itself where it should null check
prismaFmtBinPath
and fallback if its null: https://github.com/prisma/language-tools
Agreed the prisma lsp should fallback if the prismaFmtBinPath
is null. I believe It does. The issue is that the settings
object from which the lsp attempts to react prismaFmtBinPath
is null. They should also handle this case - surprised they don't.
To illustrate this, the problem still goes away if you just set "prisma": {}
in coc-settings.json
.
I imagine you might be able to alleviate this problem on your end by defaulting to an empty configuration object?
Regardless, I think "You might consider updating the coc prismaFmtBinPath configuration key in your next release. " still applies.
Noob question warning!
Although the linting works after I've made the change in coc-settings.json
suggested by @khalliday7 , the auto format on save doesn't. Weird enough, it works with :Format
. Do you have any idea what's the difference between :Format
and "coc.preferences.formatOnSaveFiletypes"
from coc-settings.json
?
@lutaalbert it's not even working for me. Only :Format
is working. Did you find any solution to this?
@Kavin25 hey, i've only added "prisma.prismaFmtBinPath": ""
inside coc-settings.json
, nothing else.
Update here:
Upstream change is being made which will eliminate the use of binary: prisma/prisma-engines#2222
So this should get addressed automatically when the language server starts to use WASM library. I will keep this open so that I can remove the binary path option when this gets released.
Fixed in 0.11.0
That version uses a build of language server which uses wasm instead of a binary: https://github.com/prisma/prisma-fmt-wasm
Please report any issues here.
@lutaalbert you can put something like this in your vimrc:
augroup formatPrismaFilesOnSave
autocmd!
autocmd BufWritePre *.prisma execute 'Format'
augroup END
@MarceliJankowski this indeed does work, thank you so much!