emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot 2fbcab2 2/2: Fix #525: Offer better control over


From: Stefan Monnier
Subject: [elpa] externals/eglot 2fbcab2 2/2: Fix #525: Offer better control over "languageId" value sent to LSP
Date: Fri, 26 Mar 2021 22:46:59 -0400 (EDT)

branch: externals/eglot
commit 2fbcab293e11e1502a0128ca5f59de0ea7888a75
Author: rvs314 <71688932+rvs314@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    Fix #525: Offer better control over "languageId" value sent to LSP
    
    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
---
 eglot.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/eglot.el b/eglot.el
index 5914f2d..03e8baa 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1741,9 +1741,11 @@ THINGS are either registrations or unregisterations 
(sic)."
   (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))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]