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

formatter configuration issue? #141

Open
just-walk opened this issue Jan 17, 2024 · 3 comments
Open

formatter configuration issue? #141

just-walk opened this issue Jan 17, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@just-walk
Copy link

I cannot seem to get JuliaFormatter to work in julia-snail.

My .dir-locals.el file has the line
((julia-mode . ((julia-snail-extensions . (repl-history formatter)))))
But running C-c j f b on a buffer in the project gives
Parsing error, formatting failed
in the *Messages* buffer and

┌ Error: UndefVarError(:JuliaFormatter)
└ @ Main.JuliaSnail.Extensions.Formatter ~/dotfiles/emacs.d/elpa/julia-snail-20231219.417/extensions/formatter/Formatter.jl:42

in the corresponding REPL

In another project, I get the error

UndefVarError: `Formatter` not defined

eval_in_module(fully_qualified_module_name::Matrix{Symbol}, expr::Expr) at JuliaSnail.jl:217
(::Main.JuliaSnail.var"#30#36"{Sockets.TCPSocket})() at JuliaSnail.jl:913

Are these bugs, or am I missing something?

@gcv
Copy link
Owner

gcv commented Jan 18, 2024

Are you using Julia 1.10? I managed to reproduce the problem once, but not again. It seems related to initialization and precompilation somehow. Try doing something like import JuliaFormatter at the REPL, see if that kicks off a precompilation. If it does, then quit the REPL, restart Snail, and try using the formatter extension again.

I'm having a hard time figuring out how I got this bug to happen because now that the latest version of the JuliaFormatter is installed in my environment, it started working.

@just-walk
Copy link
Author

just-walk commented Jan 20, 2024

Yes, I'm using Julia 1.10. I just tried what you said, and it resolved the issue. I didn't appear to precompile, but it worked. Thanks!

Just so I understand, it's not necessary to import JuliaFormatter to a project normally. It's just that the package needed to loaded somewhere initially so that Julia would precompile it, and emacs would be able to call the executable. Is that right?

I did test it with another REPL where I didn't issue the import command, and it worked.

@gcv
Copy link
Owner

gcv commented Jan 20, 2024

That's right. I think something happened in 1.10 with all the precompilation changes, and the way Snail loads extensions stopped working unless the dependency packages have all been precompiled. Or something like that. I'll keep this ticket open as a reminder to look into fixing this in the future.

@gcv gcv reopened this Jan 20, 2024
@gcv gcv added the bug Something isn't working label Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants