[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/dart-mode ac14859 147/192: Normalize paths for dartanalyze
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/dart-mode ac14859 147/192: Normalize paths for dartanalyzer on Windows |
Date: |
Sun, 29 Aug 2021 11:02:07 -0400 (EDT) |
branch: elpa/dart-mode
commit ac1485924b22ee8b8cd10734e11db6954d694d7e
Author: Brady Trainor <mail@bradyt.com>
Commit: Brady Trainor <mail@bradyt.com>
Normalize paths for dartanalyzer on Windows
---
dart-mode.el | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/dart-mode.el b/dart-mode.el
index a9c0de7..8a0e8b9 100644
--- a/dart-mode.el
+++ b/dart-mode.el
@@ -805,6 +805,11 @@ object which can be passed to
`dart--analysis-server-unsubscribe'.")
msg))
(insert "\n"))))
+(defun dart--normalize-path (path)
+ (if (equal system-type 'windows-nt)
+ (replace-regexp-in-string (rx "/") (rx "\\") path)
+ path))
+
(defun dart--start-analysis-server-for-current-buffer ()
"Initialize Dart analysis server for current buffer.
@@ -867,11 +872,11 @@ errors for the current contents of the buffer, not
whatever is saved to disk."
(when buffer-file-name
(dart--analysis-server-send
"analysis.updateContent"
- `((files .
- ((,buffer-file-name . ((type . "add")
- (content . ,(save-restriction
- (widen)
- (buffer-string)))))))))))
+ `((files
+ . ((,(dart--normalize-path buffer-file-name)
+ . ((type . "add")
+ (content
+ . ,(save-restriction (widen) (buffer-string)))))))))))
(defun dart-change-analysis-overlay
(change-begin change-end change-before-length)
@@ -883,7 +888,7 @@ length of the text before the change is
CHANGE-BEFORE-LENGTH. See also
(dart--analysis-server-send
"analysis.updateContent"
`((files
- . ((,buffer-file-name
+ . ((,(dart--normalize-path buffer-file-name)
. ((type . "change")
(edits
. (((offset . ,(- change-begin 1))
@@ -897,7 +902,7 @@ length of the text before the change is
CHANGE-BEFORE-LENGTH. See also
See also `dart-add-analysis-overlay'."
(dart--analysis-server-send
"analysis.updateContent"
- `((files . ((,buffer-file-name . ((type . "remove"))))))))
+ `((files . ((,(dart--normalize-path buffer-file-name) . ((type .
"remove"))))))))
(defun dart-add-analysis-root-for-file (&optional file)
"Add the given FILE's root to the analysis server's analysis roots.
@@ -918,10 +923,7 @@ otherwise. If no FILE is given, then this will default to
the variable
The analysis roots are directories that contain Dart files. The analysis server
analyzes all Dart files under the analysis roots and provides information about
them when requested."
- (add-to-list 'dart-analysis-roots
- (if (equal system-type 'windows-nt)
- (replace-regexp-in-string (rx "/") (rx "\\") dir)
- dir))
+ (add-to-list 'dart-analysis-roots (dart--normalize-path dir))
(dart--send-analysis-roots))
(defun dart--send-analysis-roots ()
@@ -1057,10 +1059,7 @@ SUBSCRIPTION is an opaque object provided by
(dart-info (format "Checking syntax for %s" (current-buffer)))
(dart--analysis-server-send
"analysis.getErrors"
- `((file . ,(if (equal system-type 'windows-nt)
- (replace-regexp-in-string (rx "/") (rx "\\")
- (buffer-file-name))
- (buffer-file-name))))
+ `((file . ,(dart--normalize-path (buffer-file-name))))
(-let [buffer (current-buffer)]
(lambda (response)
(dart--report-errors response buffer callback)))))
@@ -1109,7 +1108,7 @@ reported to CALLBACK."
With a prefix argument, opens a new buffer rather than using the
minibuffer."
(interactive "P")
- (-when-let (filename (buffer-file-name))
+ (-when-let (filename (dart--normalize-path (buffer-file-name)))
(let ((show-in-buffer show-in-buffer)
(buffer (current-buffer))
(pos (point)))
@@ -1241,7 +1240,7 @@ minibuffer."
(defun dart-goto ()
(interactive)
- (-when-let (filename (buffer-file-name))
+ (-when-let (filename (dart--normalize-path (buffer-file-name)))
(dart--analysis-server-send
"analysis.getNavigation"
`(("file" . ,filename) ("offset" . ,(point)) ("length" . 0))
@@ -1265,7 +1264,7 @@ minibuffer."
(defun dart-find-refs (pos &optional include-potential)
(interactive "dP")
- (-when-let (filename (buffer-file-name))
+ (-when-let (filename (dart--normalize-path (buffer-file-name)))
(dart--analysis-server-send
"search.findElementReferences"
`(("file" . ,filename)
@@ -1468,7 +1467,7 @@ stayas in place when the parameter is overwritten.")
(setq dart--last-expand-index nil)
(setq dart--last-expand-subscription nil)
- (-when-let (filename (buffer-file-name))
+ (-when-let (filename (dart--normalize-path (buffer-file-name)))
(dart--analysis-server-send
"completion.getSuggestions"
`(("file" . ,filename)
- [nongnu] elpa/dart-mode 52034c7 110/192: Add a dart--get helper to make it easier to use JSON, (continued)
- [nongnu] elpa/dart-mode 52034c7 110/192: Add a dart--get helper to make it easier to use JSON, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode f3a7c7b 122/192: Properly tell flycheck when there are no errors, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 1153c53 134/192: Add ert-runner, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 2a95005 159/192: Fix typo in README, regarding M-/ fallback, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode c30eaa9 140/192: Specify path to the dart-sdk inside of flutter, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode d9a12e1 151/192: Fontifies function declarations, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode aa628c9 138/192: Remove deprecated analysis server option, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 5d0a7cd 139/192: Use dart-sdk-path to find dartfmt., ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 1879cb8 145/192: Update README for providing diff to dart-format on Windows, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 21abd77 152/192: Fontifies declared identifiers, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode ac14859 147/192: Normalize paths for dartanalyzer on Windows,
ELPA Syncer <=
- [nongnu] elpa/dart-mode 9d72469 169/192: Don't set variables globally, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 591b6fe 170/192: Improve handling of strings, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode f20f895 164/192: Move docs from README to Wiki, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 36fe2ce 166/192: Fontify identifiers after multi-nested types, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 57767bb 157/192: Makes current indentation logic more usable, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 90f1120 162/192: Require subr-x for string-empty-p, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 8983e17 186/192: Code in font-lock tests were copied from dart.dev site, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 07a9e76 189/192: Add failing font-lock test, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 3c089f3 183/192: Fix font lock for abstract method, ELPA Syncer, 2021/08/29
- [nongnu] elpa/dart-mode 40f6741 150/192: Fontifies more keywords, builtins, constants and types, ELPA Syncer, 2021/08/29