[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa 9882bf2 072/139: Cleanup mistake with TextDocument
From: |
João Távora |
Subject: |
[elpa] externals/elpa 9882bf2 072/139: Cleanup mistake with TextDocumentItem and TextDocumentIdentifier |
Date: |
Mon, 14 May 2018 09:53:39 -0400 (EDT) |
branch: externals/elpa
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/elpa b69302c 060/139: Make M-x eglot's interactive spec a separate function, (continued)
- [elpa] externals/elpa b69302c 060/139: Make M-x eglot's interactive spec a separate function, João Távora, 2018/05/14
- [elpa] externals/elpa b657b32 068/139: Use rootUri instead of rootPath, João Távora, 2018/05/14
- [elpa] externals/elpa eebd32b 059/139: When user declines to reconnect, first quit existing server, João Távora, 2018/05/14
- [elpa] externals/elpa f1b6485 053/139: Trim some edges and add a bunch of boring RPC methods, João Távora, 2018/05/14
- [elpa] externals/elpa df5d76d 065/139: Reply to client/registerCapability (don't handle it yet), João Távora, 2018/05/14
- [elpa] externals/elpa f76f04e 057/139: More correctly keep track of didOpen/didClose per buffer, João Távora, 2018/05/14
- [elpa] externals/elpa a199c8e 070/139: Honour textDocumentSync, João Távora, 2018/05/14
- [elpa] externals/elpa 79a2a1e 069/139: Be quite explicit about our lack of capabilities right now, João Távora, 2018/05/14
- [elpa] externals/elpa ff5a03d 074/139: Very basic xref support, João Távora, 2018/05/14
- [elpa] externals/elpa b1554fc 055/139: * eglot.el (eglot--process-receive): Skip null method notifs., João Távora, 2018/05/14
- [elpa] externals/elpa 9882bf2 072/139: Cleanup mistake with TextDocumentItem and TextDocumentIdentifier,
João Távora <=
- [elpa] externals/elpa fc6879f 084/139: Explain why didOpen on after-revert-hook is a bad idea, João Távora, 2018/05/14
- [elpa] externals/elpa fdb4de1 039/139: Simplify flymake integration, João Távora, 2018/05/14
- [elpa] externals/elpa 39e8b9e 081/139: Add (dummy) tests and Travis CI integration, João Távora, 2018/05/14
- [elpa] externals/elpa 1356844 097/139: Fix odd bugs, João Távora, 2018/05/14
- [elpa] externals/elpa 889ef20 085/139: Tweak the async request engine., João Távora, 2018/05/14
- [elpa] externals/elpa 1add335 078/139: Workaround two suspected Emacs bugs, João Távora, 2018/05/14
- [elpa] externals/elpa 9d404c9 054/139: Update README.md, João Távora, 2018/05/14
- [elpa] externals/elpa c417eb4 009/139: Cancel timeouts when process dies unexpectedly, João Távora, 2018/05/14
- [elpa] externals/elpa 6689a15 026/139: Add eglot-clear-status interactive command, João Távora, 2018/05/14
- [elpa] externals/elpa 63f2208 030/139: Less obstrusive flymake stuff for now, João Távora, 2018/05/14