Handles the issue of languages whose major mode has a
different name than the name that the LSP server expects for
the language. One can now:
(put 'favourite-major-mode 'eglot-language-id "foobarbaz")
And "foobarbaz" will be used as the LSP "languageId" value.
* eglot.el (eglot--TextDocumentItem): Consult 'eglot-language-id.
Copyright-paperwork-exempt: yes
GitHub-reference: fix https://github.com/joaotavora/eglot/issues/525
(append
(eglot--VersionedTextDocumentIdentifier)
(list :languageId
- (if (string-match "\\(.*\\)-mode" (symbol-name major-mode))
- (match-string 1 (symbol-name major-mode))
- "unknown")
+ (cond
+ ((get major-mode 'eglot-language-id))
+ ((string-match "\\(.*\\)-mode" (symbol-name major-mode))
+ (match-string 1 (symbol-name major-mode)))
+ (t "unknown"))
:text
(eglot--widening
(buffer-substring-no-properties (point-min) (point-max))))))