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

prismals exits as soon as I type anything in the buffer #18

Open
rhz opened this issue Aug 4, 2024 · 0 comments
Open

prismals exits as soon as I type anything in the buffer #18

rhz opened this issue Aug 4, 2024 · 0 comments

Comments

@rhz
Copy link

rhz commented Aug 4, 2024

Hi, I'm using Prelude emacs. To install emacs-prisma-mode I added the two .el files (ie, lsp-prisma.el and prisma-mode.el) into .emacs.d/vendor folder, which the docs say "Any code that you place here will be available via require." So then in the Prelude-equivalent of init.el I added

(require 'prisma-mode)
(add-hook 'prisma-mode-hook #'lsp-deferred)
(add-hook 'before-save-hook #'(lambda () (when (eq major-mode 'prisma-mode)
                                           (lsp-format-buffer))))

I'm using emacs-nativecomp version 29.4 on EndeavourOS (based on Arch Linux). I get the following warnings when opening the prisma.schema file in my project.

⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for prisma is unavailable (not-found): (libtree-sitter-prisma libtree-sitter-prisma.0 libtree-sitter-prisma.0.0 libtree-sitter-prisma.so libtree-sitter-prisma.so.0 libtree-sitter-prisma.so.0.0) No such file or directory
⛔ Warning (treesit): Cannot activate tree-sitter, because language grammar for prisma is unavailable (not-found): (libtree-sitter-prisma libtree-sitter-prisma.0 libtree-sitter-prisma.0.0 libtree-sitter-prisma.so libtree-sitter-prisma.so.0 libtree-sitter-prisma.so.0.0) No such file or directory
⛔ Warning (lsp-mode): Unable to calculate the languageId for buffer ‘schema.prisma’. Take a look at ‘lsp-language-id-configuration’. The ‘major-mode’ is prisma-ts-mode

Then, I got asked in the minibuffer Unable to find installed server supporting this file. The following servers could be installed automatically: prismals. If I proceed, I get the following buffer.

-*- mode: compilation; default-directory: "~/code/react/upa-pos/prisma/" -*-
Comint started at Sat Aug  3 23:33:43

~/.nvm/versions/node/v21.6.2/bin/npm -g --prefix ~/.emacs.d/.cache/lsp/npm/\@prisma/language-server install \@prisma/language-server

added 16 packages in 7s

This makes me think that @prisma/language-server was installed globally at ~/.emacs.d/.cache/lsp/npm/, despite the fact that it was installed locally in my project, ie you can find it in ./node_modules/.bin/prisma-language-server. Why isn't emacs-prisma-mode able to use the one installed locally, like the Typescript LSP server does?

After restarting emacs, I got asked a question about importing the project root, which I did. Now syntax highlighting and indentation work. However, as soon as I type anything into the buffer, I get in the minibuffer the prompt Server prismals:264102 exited (check corresponding stderr buffer for details). Do you want to restart it? (y or n). If I press y, I get the same prompt again. If I press n, I cat go check the stderr buffer which contains the following.

node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, stat '/home/rhz/code/react/upa-pos/prisma/.#schema.prisma'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/home/rhz/code/react/upa-pos/prisma/.#schema.prisma'
}

Node.js v21.6.2

Process prismals stderr finished

After that, the mode line in the schema.prisma buffer says LSP[Disconnected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant