LanguageServer.jl icon indicating copy to clipboard operation
LanguageServer.jl copied to clipboard

support for @reexport using SomePackage

Open Petr-Hlavenka opened this issue 6 years ago • 12 comments

Is it possible to specially parse the reexport using statement?

using Reexport
@reexport using SomePackage

so that it is parsed as without the @reexport macro. Now all the functions from SomePackage are marked as unknowns.

Petr-Hlavenka avatar Aug 28 '19 08:08 Petr-Hlavenka

I guess we could special case this, but maybe we should just be looking for a more generic solution? Not sure.

davidanthoff avatar Sep 06 '19 18:09 davidanthoff

Just to note, the Reexport package has added support for syntax like the following on the master branch, but it has not been released yet:

using Reexport: @reexport
@reexport using SomePackage: a, b

I would also greatly appreciate these special cases being added, as currently the plugin tells me all of the functions from other Modules inside of my package are unavailable.

Byrth avatar Jan 07 '20 21:01 Byrth

This is quite tricky to handle in a neat way. In the meantime, while I think about a solution, I've added a codeAction that provides the same functionality: https://github.com/julia-vscode/LanguageServer.jl/pull/463

ZacLN avatar Jan 08 '20 22:01 ZacLN

FWIW, it seems that Pluto recently fixed a similar issue by expanding macros for analysis. I don't know enough about the internals of either of these packages to judge whether this fix could be applied here but maybe it is a helpful data point:

https://github.com/fonsp/Pluto.jl/issues/196#issuecomment-800485127 https://github.com/fonsp/Pluto.jl/pull/1032

lassepe avatar Aug 08 '21 12:08 lassepe

@lassepe I believe they just run the macros. We can't do that (at least easily) because we have a policy to never run user code in the LS process. Maybe we need to think about a two process solution for this at some point, not sure...

davidanthoff avatar Aug 14 '21 06:08 davidanthoff

Or, maybe just treat @reexport lexicographically and special-case for it. It is really a widely used syntax sugar. On the other hand, having macros actions visible would be such a huge benefit. But I have no idea how to combine this with the LS safety/stability. Have their execution have sandboxed + interpreted? Is this possible with current interpreter? And, does it require interpreting the whole project code in order to do this?

  • I see, this is really tricky topic. My personal feeling is, that I'd rather like to sacrifice macros than have the unpredictably broken environments of Juno's time.

Petr-Hlavenka avatar Nov 26 '21 05:11 Petr-Hlavenka

This is quite tricky to handle in a neat way. In the meantime, while I think about a solution, I've added a codeAction that provides the same functionality: #463

where to find documentation about how to use the codeAction?

schlichtanders avatar Oct 27 '22 13:10 schlichtanders