Open bradyt opened 5 years ago
With (setq dart-enable-analysis-server t), if we try to compare contents of modified buffer to file, with M-x ediff-current-buffer, we get a message, Wrong type argument: stringp, nil, and if we toggle debug-on-error, we get the following backtrace.
(setq dart-enable-analysis-server t)
M-x ediff-current-buffer
Wrong type argument: stringp, nil
debug-on-error
Debugger entered--Lisp error: (wrong-type-argument stringp nil) expand-file-name(nil) locate-dominating-file(nil "pubspec.yaml") (let* ((file-to-add (or file buffer-file-name)) (pub-root (locate-dominating-file file-to-add "pubspec.yaml")) (current-dir (file-name-directory file-to-add))) (if pub-root (dart-add-to-analysis-roots (directory-file-name (expand-file-name pub-root))) (dart-add-to-analysis-roots (directory-file-name (expand-file-name current-dir))))) dart-add-analysis-root-for-file() dart--start-analysis-server-for-current-buffer() (if (null dart-sdk-path) (dart-log "Cannot find `dart' executable or Dart analysis server snapshot.") (dart--start-analysis-server-for-current-buffer)) (progn (if (null dart-sdk-path) (dart-log "Cannot find `dart' executable or Dart analysis server snapshot.") (dart--start-analysis-server-for-current-buffer))) (if dart-enable-analysis-server (progn (if (null dart-sdk-path) (dart-log "Cannot find `dart' executable or Dart analysis server snapshot.") (dart--start-analysis-server-for-current-buffer)))) (let ((delay-mode-hooks t)) (prog-mode) (setq major-mode 'dart-mode) (setq mode-name "Dart") (progn (if (get 'prog-mode 'mode-class) (put 'dart-mode 'mode-class (get 'prog-mode 'mode-class))) (if (keymap-parent dart-mode-map) nil (set-keymap-parent dart-mode-map (current-local-map))) (let ((parent (char-table-parent dart-mode-syntax-table))) (if (and parent (not (eq parent (standard-syntax-table)))) nil (set-char-table-parent dart-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get dart-mode-abbrev-table :parents) (eq dart-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put dart-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map dart-mode-map) (set-syntax-table dart-mode-syntax-table) (setq local-abbrev-table dart-mode-abbrev-table) (modify-syntax-entry 47 "_ 124b") (modify-syntax-entry 42 ". 23") (modify-syntax-entry 10 "> b") (modify-syntax-entry 39 "\"") (set (make-local-variable 'electric-indent-chars) '(10 41 93 125)) (setq comment-start "//") (setq comment-end "") (setq fill-column 80) (setq font-lock-defaults dart-font-lock-defaults) (setq indent-line-function 'dart-indent-line-function) (setq indent-tabs-mode nil) (setq tab-width 2) (set (make-local-variable 'syntax-propertize-function) dart-syntax-propertize-function) (if dart-enable-analysis-server (progn (if (null dart-sdk-path) (dart-log "Cannot find `dart' executable or Dart analysis server snapshot.") (dart--start-analysis-server-for-current-buffer)))) (add-hook (make-local-variable 'before-save-hook) #'(lambda nil (if dart-format-on-save (progn (dart-format)))))) (progn (make-local-variable 'delay-mode-hooks) (let ((delay-mode-hooks t)) (prog-mode) (setq major-mode 'dart-mode) (setq mode-name "Dart") (progn (if (get 'prog-mode 'mode-class) (put 'dart-mode 'mode-class (get 'prog-mode 'mode-class))) (if (keymap-parent dart-mode-map) nil (set-keymap-parent dart-mode-map (current-local-map))) (let ((parent (char-table-parent dart-mode-syntax-table))) (if (and parent (not (eq parent ...))) nil (set-char-table-parent dart-mode-syntax-table (syntax-table)))) (if (or (abbrev-table-get dart-mode-abbrev-table :parents) (eq dart-mode-abbrev-table local-abbrev-table)) nil (abbrev-table-put dart-mode-abbrev-table :parents (list local-abbrev-table)))) (use-local-map dart-mode-map) (set-syntax-table dart-mode-syntax-table) (setq local-abbrev-table dart-mode-abbrev-table) (modify-syntax-entry 47 "_ 124b") (modify-syntax-entry 42 ". 23") (modify-syntax-entry 10 "> b") (modify-syntax-entry 39 "\"") (set (make-local-variable 'electric-indent-chars) '(10 41 93 125)) (setq comment-start "//") (setq comment-end "") (setq fill-column 80) (setq font-lock-defaults dart-font-lock-defaults) (setq indent-line-function 'dart-indent-line-function) (setq indent-tabs-mode nil) (setq tab-width 2) (set (make-local-variable 'syntax-propertize-function) dart-syntax-propertize-function) (if dart-enable-analysis-server (progn (if (null dart-sdk-path) (dart-log "Cannot find `dart' executable or Dart analysis server snapshot.") (dart--start-analysis-server-for-current-buffer)))) (add-hook (make-local-variable 'before-save-hook) #'(lambda nil (if dart-format-on-save (progn (dart-format))))))) dart-mode() ediff-current-file() funcall-interactively(ediff-current-file) call-interactively(ediff-current-file record nil) command-execute(ediff-current-file record) execute-extended-command(nil "ediff-current-file" "ediff-cur") funcall-interactively(execute-extended-command nil "ediff-current-file" "ediff-cur") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command)
Closing this issue.
We recommend instead of using (setq dart-enable-analysis-server t), to try lsp-mode. Some notes can be found at https://github.com/bradyt/dart-mode/wiki/LSP.
lsp-mode
With
(setq dart-enable-analysis-server t)
, if we try to compare contents of modified buffer to file, withM-x ediff-current-buffer
, we get a message,Wrong type argument: stringp, nil
, and if we toggledebug-on-error
, we get the following backtrace.