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

Add current_project/1 helper function #360

Merged
merged 1 commit into from
Sep 13, 2023

Conversation

scottming
Copy link
Collaborator

@scottming scottming commented Sep 12, 2023

I found the bin/debug_shell.sh is pretty cool, and I want to debug the current editor's project node. with this function, the debug flow would be:

~/Code/lexical add-current-project ❯ _build/dev/package/lexical/bin/debug_shell.sh                  
Erlang/OTP 25 [erts-13.2.2.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(manager-lexical-37683@127.0.0.1)1> project = current_project()
%LXical.Project{
  root_uri: "file:///Users/scottming/Code/lexical",
  mix_exs_uri: "file:///Users/scottming/Code/lexical/mix.exs",
  mix_project?: true,
  mix_env: nil,
  mix_target: nil,
  env_variables: %{},
  project_module: nil,
  entropy: "37683"
}
iex(manager-lexical-37683@127.0.0.1)2> complete(project, "demod|")

20:04:21.959 [info] Completion for %LXical.Document.Position{line: 1, character: 6}

20:04:26.663 [info] Local completions are [%LXical.RemoteControl.Completion.Candidate.Macro{argument_names: ["alias", "do_block"], arity: 2, name: "defmodule", origin: "Kernel", type: :macro, visibility: :public, spec: "", metadata: %{}}]

20:04:26.672 [warning] Emitting completions: [#Protocol.Types.Completion.Item<[detail: "", insert_text: "defmodule ${1:File} do\n  $0\nend\n", insert_text_format: :snippet, kind: :class, label: "defmodule (Define a module)", sort_text: "092_defmodule (Define a module)"]>]
[
  #Protocol.Types.Completion.Item<[
    detail: "",
    insert_text: "defmodule ${1:File} do\n  $0\nend\n",
    insert_text_format: :snippet,
    kind: :class,
    label: "defmodule (Define a module)",
    sort_text: "092_defmodule (Define a module)"
  ]>
]

@scohen scohen merged commit 4de2e9a into lexical-lsp:main Sep 13, 2023
@scottming scottming deleted the add-current-project branch April 6, 2024 01:36
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.

3 participants