Merge pull request #157 from snosov1/fix-goto-definition
fix goto definition with respect to UTF-8 encoding
This commit is contained in:
commit
172330ab53
|
@ -421,8 +421,8 @@ so I have to replace it with struct name."
|
||||||
(replace-match "\\\\n"))
|
(replace-match "\\\\n"))
|
||||||
))
|
))
|
||||||
|
|
||||||
(defun ac-dcd-get-ddoc (pos)
|
(defun ac-dcd-get-ddoc ()
|
||||||
"Get document with `dcd-client --doc'. `POS' is cursor position."
|
"Get document with `dcd-client --doc'."
|
||||||
(save-buffer)
|
(save-buffer)
|
||||||
(let ((args
|
(let ((args
|
||||||
(append
|
(append
|
||||||
|
@ -449,7 +449,7 @@ so I have to replace it with struct name."
|
||||||
(defun ac-dcd-show-ddoc-with-buffer ()
|
(defun ac-dcd-show-ddoc-with-buffer ()
|
||||||
"Display Ddoc at point using `display-buffer'."
|
"Display Ddoc at point using `display-buffer'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(ac-dcd-get-ddoc (ac-dcd-cursor-position))
|
(ac-dcd-get-ddoc)
|
||||||
(ac-dcd-reformat-document)
|
(ac-dcd-reformat-document)
|
||||||
(display-buffer (get-buffer-create ac-dcd-document-buffer-name)))
|
(display-buffer (get-buffer-create ac-dcd-document-buffer-name)))
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ so I have to replace it with struct name."
|
||||||
"Goto declaration of symbol at point."
|
"Goto declaration of symbol at point."
|
||||||
(interactive)
|
(interactive)
|
||||||
(save-buffer)
|
(save-buffer)
|
||||||
(ac-dcd-call-process-for-symbol-declaration (point))
|
(ac-dcd-call-process-for-symbol-declaration)
|
||||||
(let* ((data (ac-dcd-parse-output-for-get-symbol-declaration))
|
(let* ((data (ac-dcd-parse-output-for-get-symbol-declaration))
|
||||||
(file (car data))
|
(file (car data))
|
||||||
(offset (cdr data)))
|
(offset (cdr data)))
|
||||||
|
@ -493,21 +493,15 @@ so I have to replace it with struct name."
|
||||||
(message "Not found")
|
(message "Not found")
|
||||||
(progn
|
(progn
|
||||||
(ac-dcd-goto-def-push-marker)
|
(ac-dcd-goto-def-push-marker)
|
||||||
(if (string= file "stdin") ; When the declaration is in the current file
|
(unless (string= file "stdin") ; the declaration is in the current file
|
||||||
(progn
|
(find-file file))
|
||||||
(goto-char (point-min))
|
(goto-char (byte-to-position (string-to-number offset)))))))
|
||||||
(forward-char (string-to-number offset)))
|
|
||||||
(progn
|
|
||||||
(find-file file)
|
|
||||||
(goto-char (point-min))
|
|
||||||
(forward-char (string-to-number offset))))))))
|
|
||||||
|
|
||||||
|
|
||||||
;; utilities for goto-definition
|
;; utilities for goto-definition
|
||||||
|
|
||||||
(defun ac-dcd-call-process-for-symbol-declaration (pos)
|
(defun ac-dcd-call-process-for-symbol-declaration ()
|
||||||
"Get location of symbol declaration with `dcd-client --symbolLocation'.
|
"Get location of symbol declaration with `dcd-client --symbolLocation'."
|
||||||
`POS' is cursor position."
|
|
||||||
(let ((args
|
(let ((args
|
||||||
(append
|
(append
|
||||||
(ac-dcd-build-complete-args (ac-dcd-cursor-position))
|
(ac-dcd-build-complete-args (ac-dcd-cursor-position))
|
||||||
|
|
Loading…
Reference in New Issue