elixir-ls
elixir-ls copied to clipboard
[WIP/Proposal] feat: add working first draft
This PR aims to add custom symbols as part of the symbol finder
This is a step to improve upon Nx development and usage, but done in a more generalized way. The idea is to detect if a given node ends up defining a function (in the LSP sense) inside it through macro calls.
Given this proposal is accepted, I plan to provide a user configuration for a list of custom names (which solves imported macros as is usual with Nx's defns) and I also plan to add an option to load the "locals_without_parens" list from the formatter configuration (this should reduce even further the use cases in which a user would have to provide their custom symbol)
I've added the Symbols
struct mostly so I didn't have to carry tuples around, but I'm not too set on the implementation details yet.
There has been discussions about using compilation tracers. With compilation tracers, you will always know if a macro expands to def
, so you can track all definitions. But it requires the code to be compiled.
There has been discussions about using compilation tracers. With compilation tracers, you will always know if a macro expands to
def
, so you can track all definitions. But it requires the code to be compiled.
This seems interesting. Perhaps it could be done as sort of a partial implementation where some symbols are done "as is" and others are added through said tracers?
Is this a functionality which is already present in Elixir?
General note here: it seems that I've used an outdated version of main, so if the proposal is accepted I'll resolve conflicts properly.
There has been discussions about using compilation tracers. With compilation tracers, you will always know if a macro expands to
def
, so you can track all definitions. But it requires the code to be compiled.This seems interesting. Perhaps it could be done as sort of a partial implementation where some symbols are done "as is" and others are added through said tracers?
Is this a functionality which is already present in Elixir?
It is, I have a local PoC of switching document symbols provider to a tracer. It has other problems besides compilation though. Only a limited amount of code level info is available to a tracer.