Skip to content

discussion: separate the module file detection logic ? #391

@aviatesk

Description

@aviatesk

Hi @timholy, thanks for your great work on Revise :)

tl;dr; In this issue I would like to propose the idea of separating the code in Revise.jl, which finds files in a loaded module, into a separate package.

background

Currently there is a strong need for a robust implementation of a logic to find included files in a module (let me call this "module file finding logic"), in Juno:

features that will use "module file finding logic":

  1. automatic file's module detection
  2. features based on static code analysis
    • like outline, symbol jump (and in the future, rename, and so on)
    • all those static code analysis should be done per module

Within those features, it's really important to be able to find all the files in a specific module (including files in a non-precompiled package, or files in a submodule), as accurately as possible.

In order to meet the requirement, I and @pfitzseb now have the 2-stage logic.

"2-stage logic":

  1. first take a "Revise-like" logic (specifically, we're using modulefiles(mod::Module))
  2. when approach 1. fails (e.g. for non-precompiled files), fallback to CSTParse-based "static module traverse"

You can find our current implementation of 1. here (and just fyi: that of 2. here)

(subnote: currently the "automatic file's module revealing" uses CodeTools, but we're planning to use "2-stage logic" for this feature as well)

proposal

It may be obvious our implementation of "Revise-like" approach is not so ideal -- I just copied all the code that was related to modulefiles from Revise.
It works now, but the problem is that its maintainability: since we really don't want to depend on Revise, we have to watch on changes in Revise and make an equivalent patch on Atom.jl like this PR.

So in conclusion, we would like to ask you to separate code in Revise that includes its logic to find files in a (loaded) module into a separate package. Then it's enough to make changes just in one place.
What do you think of this idea ?

another discussion

Also I would like to know if you have any idea to improve our "module finding logic". Is there any utility in Revise or CodeTracking that we can reuse for the "2-stage logic" ?

/cc @pfitzseb

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions