gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
230 stars 21 forks source link

latest CSTParser.jl breaks julia-snail #46

Closed dahtah closed 2 years ago

dahtah commented 3 years ago

It seems CSTParser.jl devs have removed (renamed?) the CSTParser.typof function, which breaks line 375 in JuliaSnail.jl. This was triggered on my machine by updating the general environment. Maybe it'd be a good idea to make JuliaSnail a package so that dependencies are versioned.

gcv commented 3 years ago

How is that possible? The dependency is versioned in Manifest.toml.

dahtah commented 3 years ago

No idea. All I did was ] update, things broke, and I tracked it to CSTParser. I'm not well versed in the mysteries of the Julia package manager

gcv commented 3 years ago

Please double check that you have the latest Snail with the manifest file.

dahtah commented 3 years ago

I've checked again, looks like it. Manifest.toml has CSTParser at 2.5.0, in the global environment it's at 3.1.0. Maybe something went wrong in the update process?

dahtah commented 3 years ago

Turns out removing CSTParser from the global environment fixes the problem. Add it back, you get the problem again. So the version that gets called seems to depend from the global environment

gcv commented 3 years ago

Right now, Snail adds its environment by pushing itself to the end of the LOAD_PATH:

push!(LOAD_PATH, @__DIR__)

It stands to reason that the global installation of CSTParser takes precedence, and because CSTParser does not have a public API, it broke Snail (see https://github.com/julia-vscode/CSTParser.jl/issues/56).

@orialb described this problem here: https://github.com/gcv/julia-snail/issues/33#issuecomment-637387247

I don't know what to do about it. I suppose I could add a manual check for the version of CSTParser and print a meaningful error message if Snail detects an incompatibility in this case.

Do you have CSTParser in your environment because you were trying it out before I finished integrating it? I'm wondering how common the problem is likely to be.

dahtah commented 3 years ago

Yes, I added CSTParser to the global environment when I was tinkering with julia-snail. I don't expect many users to come across this bug. A work-around could be to test on start-up that CSTParser.typof exists and issue a message pointing to this issue if it doesn't.

cobac commented 3 years ago

Just commenting here to say that I've run into the same issue. I am completely new to Julia, is there any way to use CSTParser 3.10 without breaking snail?

gcv commented 3 years ago

I suppose I’ll have to update Snail to use the latest CSTParser. I already asked CSTParser maintainers to add a changelog so breaking changes like this are less surprising (https://github.com/julia-vscode/CSTParser.jl/issues/240).

Since you’re new to Julia, I assume you didn’t install CSTParser in your global environment to hack on it. So how did you end up with it? Did you install something else that might have put the latest CSTParser on your system? I’d like to understand how users might end up with this conflict.

cobac commented 3 years ago

I did explicitly install CSTParser into my global environment to use julia-staticlint since they don't ship their Julia code in a package. I've removed CSTParser from my global environment and snails un-broke as expected. Thank you for your work!

gcv commented 2 years ago

Updated to CSTParser 3 in a71a536.