[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 9882bf2 072/139: Cleanup mistake with TextDocumen
From: |
João Távora |
Subject: |
[elpa] externals/eglot 9882bf2 072/139: Cleanup mistake with TextDocumentItem and TextDocumentIdentifier |
Date: |
Mon, 14 May 2018 09:54:56 -0400 (EDT) |
branch: externals/eglot
commit 9882bf243cc5b2a4f3700838d2a42a2d9d792f18
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Cleanup mistake with TextDocumentItem and TextDocumentIdentifier
Also introduce eglot--path-to-uri
* eglot.el (eglot--path-to-uri): Rename from eglot--uri and rework.
(eglot--connect): Use it.
(eglot--current-buffer-TextDocumentIdentifier): New function.
(eglot--current-buffer-VersionedTextDocumentIdentifier)
(eglot--signal-textDocument/didChange)
(eglot--signal-textDocument/didClose)
(eglot--signal-textDocument/willSave)
(eglot--signal-textDocument/didSave): Use it.
---
eglot.el | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/eglot.el b/eglot.el
index 2b3f270..2afb0e7 100644
--- a/eglot.el
+++ b/eglot.el
@@ -254,9 +254,8 @@ SUCCESS-FN with no args if all goes well."
(eglot--obj :processId (unless (eq (process-type proc)
'network)
(emacs-pid))
- :rootUri (eglot--uri
- (expand-file-name (car (project-roots
- (project-current)))))
+ :rootUri (eglot--path-to-uri
+ (car (project-roots (project-current))))
:initializationOptions []
:capabilities (eglot--client-capabilities))
:success-fn
@@ -699,7 +698,11 @@ identifier. ERROR is non-nil if this is a JSON-RPC error."
(apply #'format format args)
:warning)))
-(defun eglot--uri (path) "Add file:// to PATH." (concat "file://" path))
+(defun eglot--path-to-uri (path)
+ "Urify PATH."
+ (url-hexify-string
+ (concat "file://" (file-truename path))
+ url-path-allowed-chars))
;;; Minor modes
@@ -1033,15 +1036,14 @@ running. INTERACTIVE is t if called interactively."
(defvar-local eglot--versioned-identifier 0)
+(defun eglot--current-buffer-TextDocumentIdentifier ()
+ "Compute TextDocumentIdentifier object for current buffer."
+ (eglot--obj :uri (eglot--path-to-uri buffer-file-name)))
+
(defun eglot--current-buffer-VersionedTextDocumentIdentifier ()
"Compute VersionedTextDocumentIdentifier object for current buffer."
- (eglot--obj :uri
- (eglot--uri
- (url-hexify-string
- (file-truename buffer-file-name)
- url-path-allowed-chars))
- ;; FIXME: later deal with workspaces
- :version eglot--versioned-identifier))
+ (append (eglot--current-buffer-TextDocumentIdentifier)
+ (eglot--obj :version eglot--versioned-identifier)))
(defun eglot--current-buffer-TextDocumentItem ()
"Compute TextDocumentItem object for current buffer."
@@ -1154,7 +1156,7 @@ Records START, END and PRE-CHANGE-LENGTH locally."
(eglot--notify proc
:textDocument/didClose
(eglot--obj :textDocument
- (eglot--current-buffer-TextDocumentItem)))))
+
(eglot--current-buffer-TextDocumentIdentifier)))))
(defun eglot--signal-textDocument/willSave ()
"Send textDocument/willSave to server."
@@ -1163,7 +1165,7 @@ Records START, END and PRE-CHANGE-LENGTH locally."
:textDocument/willSave
(eglot--obj
:reason 1 ; Manual, emacs laughs in the face of auto-save muahahahaha
- :textDocument (eglot--current-buffer-TextDocumentItem))))
+ :textDocument (eglot--current-buffer-TextDocumentIdentifier))))
(defun eglot--signal-textDocument/didSave ()
"Send textDocument/didSave to server."
@@ -1173,7 +1175,7 @@ Records START, END and PRE-CHANGE-LENGTH locally."
(eglot--obj
;; TODO: Handle TextDocumentSaveRegistrationOptions to control this.
:text (buffer-substring-no-properties (point-min) (point-max))
- :textDocument (eglot--current-buffer-TextDocumentItem))))
+ :textDocument (eglot--current-buffer-TextDocumentIdentifier))))
(defun eglot-flymake-backend (report-fn &rest _more)
"An EGLOT Flymake backend.
- [elpa] externals/eglot c7bd095 118/139: Improve eglot-eldoc-function, (continued)
- [elpa] externals/eglot c7bd095 118/139: Improve eglot-eldoc-function, João Távora, 2018/05/14
- [elpa] externals/eglot 3e0f1c3 122/139: Misc little adjustments for readability, João Távora, 2018/05/14
- [elpa] externals/eglot 3dcbc30 109/139: Add minimal headers, commentary and autoloads, João Távora, 2018/05/14
- [elpa] externals/eglot 71e47d2 102/139: Fix odd bugs and tweak stuff, João Távora, 2018/05/14
- [elpa] externals/eglot 05c67ee 112/139: Adjust flymake integration, João Távora, 2018/05/14
- [elpa] externals/eglot 9ff97a6 079/139: Increase request timeout length to 10 seconds, João Távora, 2018/05/14
- [elpa] externals/eglot 571b08f 076/139: Fix the odd bug here and there, João Távora, 2018/05/14
- [elpa] externals/eglot a7ddce6 080/139: Support javascript's javascript-typescript-langserver, João Távora, 2018/05/14
- [elpa] externals/eglot d40f9ac 094/139: Half-decent imenu support via textDocument/documentSymbol, João Távora, 2018/05/14
- [elpa] externals/eglot bbc64b4 087/139: Clean up client capabilities, João Távora, 2018/05/14
- [elpa] externals/eglot 9882bf2 072/139: Cleanup mistake with TextDocumentItem and TextDocumentIdentifier,
João Távora <=
- [elpa] externals/eglot 8160cd4 071/139: Handle dynamic registration in general (but nothing specific yet), João Távora, 2018/05/14
- [elpa] externals/eglot c4ffabc 083/139: Half-decent completion support, João Távora, 2018/05/14
- [elpa] externals/eglot d431d41 088/139: Fix bug in hover support, João Távora, 2018/05/14
- [elpa] externals/eglot 1356844 097/139: Fix odd bugs, João Távora, 2018/05/14
- [elpa] externals/eglot 6e76b08 100/139: Support workspace/applyEdit, João Távora, 2018/05/14
- [elpa] externals/eglot 5ce9ab0 106/139: Call eglot-eldoc-function after completion finishes, João Távora, 2018/05/14
- [elpa] externals/eglot ecd334f 101/139: Update README, João Távora, 2018/05/14
- [elpa] externals/eglot 39e8b9e 081/139: Add (dummy) tests and Travis CI integration, João Távora, 2018/05/14
- [elpa] externals/eglot 23b79e0 111/139: Shorten summary line to appease package-lint.el, João Távora, 2018/05/14
- [elpa] externals/eglot 37b7329 098/139: Reasonable textDocument/documentHighlight support, João Távora, 2018/05/14