Skip to content

jump to defn based on Locate Library loop and .glob files#265

Draft
aa755 wants to merge 2 commits intocpitclaudel:masterfrom
aa755:new_jump_to_defn
Draft

jump to defn based on Locate Library loop and .glob files#265
aa755 wants to merge 2 commits intocpitclaudel:masterfrom
aa755:new_jump_to_defn

Conversation

@aa755
Copy link
Contributor

@aa755 aa755 commented Nov 30, 2022

2 major changes

  1. the target file of the jump is now computed using the Locate Library loop on prefixes of fully quantified name, as @cpitclaudel proposed here. This is more robust in our work at bedrock systems where we use a lot of elpi code-generation stuff like NES which creates modules. When trying to jump to such definitions, the current implementation always tries to open the wrong file.
  2. improved in-file location of the definition using .glob files: We often have many definitions of the same name in a file, using modules/NES. the current implementation just jumps to the first occurrence of the name, not the one in the right module. This MR uses .glob files to find the right offset. if no .glob file is found, the old strategy is used as fallback.

(this MR is currently in DRAFT state to seek feedback and/or suggestions on better ways to implement the functionality. I still have some debugging stuff in. I will remove them once I use the new implementation for about a week to fix any bugs that pop up)

"\\s-*\\(" (regexp-quote short-name) "\\)\\_>"))))
(short-name (replace-regexp-in-string "\\`.*\\." "" fqn)))
(or (-when-let* ((loc (company-coq--loc-fully-qualified-name fqn));; will fail iff the definition is in current file
(vfile (concat (replace-regexp-in-string "_build/default" "" (car loc) nil 'literal) ".v"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be on the safer side, check that the parent directory of _build has a dune-project file

…e resolution: when globfile is present, jump to constructor now works even the inductive is inside a module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant