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

go to definition #42

Closed
mhanberg opened this issue Jun 26, 2023 · 3 comments
Closed

go to definition #42

mhanberg opened this issue Jun 26, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@mhanberg
Copy link
Collaborator

No description provided.

@mhanberg mhanberg added the enhancement New feature or request label Jun 26, 2023
@mhanberg mhanberg self-assigned this Jul 1, 2023
@mhanberg
Copy link
Collaborator Author

mhanberg commented Jul 3, 2023

@mhanberg mhanberg closed this as completed Jul 3, 2023
@josevalim
Copy link

Hi @mhanberg, quick question: you are using the compilation tracer to collect information about aliases, function calls, etc. This requires, however, the current module to be compiled for you to enable this functionality. Has this been a problem? Or are you frequently compiling the code behind the scenes instead of relying on the Mix compiler exclusively?

@mhanberg
Copy link
Collaborator Author

hi @josevalim!

Next LS does require a full compilation for go to def/references/workspace symbols to become fully populated (meaning, if you are starting it for the first time, or a migration is run on the sqlite database), but i haven't noticed this to be a problem. (if i do notice a problem, there is usually one or more other things going wrong, so most likely not a tracer related thing)

and yes, it utilizes the mix compiler exclusively. this is the code it uses when executing the compiler

defmodule :_next_ls_private_compiler do
  @moduledoc false

  @tracers Code.get_compiler_option(:tracers)

  def compile do
    # keep stdout on this node
    Process.group_leader(self(), Process.whereis(:user))
    Code.put_compiler_option(:parser_options, columns: true, token_metadata: true)

    Code.put_compiler_option(:tracers, [NextLSPrivate.DepTracer | @tracers])

    Mix.Task.clear()

    # load the paths for deps and compile them
    # will noop if they are already compiled
    # The mix cli basically runs this before any mix task
    # we have to rerun because we already ran a mix task
    # (mix run), which called this, but we also passed
    # --no-compile, so nothing was compiled, but the
    # task was not re-enabled it seems
    Mix.Task.rerun("deps.loadpaths")

    Code.put_compiler_option(:tracers, [NextLSPrivate.Tracer | @tracers])

    Mix.Task.rerun("compile", [
      "--ignore-module-conflict",
      "--no-protocol-consolidation",
      "--return-errors"
    ])
  rescue
    e -> {:error, e}
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants