Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jump to definition with dune #261

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions company-coq.el
Original file line number Diff line number Diff line change
Expand Up @@ -2180,12 +2180,17 @@ to a non-existent file (for an example of such a case, try
(file-name-nondirectory (buffer-file-name proof-script-buffer))))))
proof-script-buffer
(let* ((lib-name (concat lib-path mod-name))
(output (company-coq-ask-prover-swallow-errors (format company-coq-locate-lib-cmd lib-name))))
(or (and output (save-match-data
(when (and (string-match company-coq-locate-lib-output-format output)
(string-match-p company-coq-compiled-regexp (match-string-no-properties 3 output)))
(concat (match-string-no-properties 2 output) ".v"))))
(and fallback-spec (expand-file-name (concat mod-name ".v") (cdr fallback-spec)))))))
(output (company-coq-ask-prover-swallow-errors (format company-coq-locate-lib-cmd lib-name)))
(path (or (and output (save-match-data
(when (and (string-match company-coq-locate-lib-output-format output)
(string-match-p company-coq-compiled-regexp (match-string-no-properties 3 output)))
(concat (match-string-no-properties 2 output) ".v"))))
(and fallback-spec (expand-file-name (concat mod-name ".v") (cdr fallback-spec)))))
(stripped (replace-regexp-in-string "_build/default" "" path nil 'literal)))
(if (file-exists-p stripped)
stripped
path
))))

(defun company-coq--locate-name (name functions)
"Find location of NAME using FUNCTIONS.
Expand Down Expand Up @@ -2261,7 +2266,7 @@ Returns a cons as specified by `company-coq--locate-name'."
(let ((candidates (company-coq-candidates-modules module)))
(cl-loop for candidate in candidates
when (string= module candidate)
thereis (cons (company-coq-get-prop 'location candidate) nil))))
thereis (cons (replace-regexp-in-string "_build/default" "" (company-coq-get-prop 'location candidate) nil 'literal) nil))))

(defun company-coq--maybe-complain-docs-not-found (interactive-p doc-type name)
"If INTERACTIVE-P, complain that do DOC-TYPE was found for NAME."
Expand Down