emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.72k stars 860 forks source link

Volar/Vue: how to get autocompletions in javascript, HTML & CSS in vue files? #4446

Closed pedroprieto closed 1 month ago

pedroprieto commented 2 months ago

Thank you for the bug report

Bug description

I am unable to get completions in Vue files both in HTML/CSS sections (emmet) and <script> sections. It seems that when I get one working, the other stops.

I have tried both eglot and lsp-mode. In eglot, I am able to get emmet completions from vue language tools, but no javascript (maybe because eglot does not support multiple servers?); in lsp-mode, I get javascript working, including embedded javascript in Vue template section, but no emmet completions:

imagen

imagen

I have tried with multiple major modes: vue-mode, tree-sitter and web-mode, with no luck.

I suspect that it is related to how those modes tell the lsp server its languageid, but I am not sure. Is there any kind of config that I am missing?

Steps to reproduce

Just open a .vue file and run lsp-mode.

Expected behavior

Emacs should show emmet completions in <template> and <style> sections inside .vue files.

Which Language Server did you use?

lsp-volar

OS

Linux

Error callstack

No response

Anything else?

No response

sdvcrx commented 1 month ago

Please try:

(setq lsp-vetur-emmet "inMarkupAndStylesheetFilesOnly")

lsp-vetur disabled Emmet suggestions by default:

pedroprieto commented 1 month ago

Ah, ok. I will try it. Thanks!!