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

simplify Julia config #1811

Merged
merged 3 commits into from
Mar 15, 2022
Merged

simplify Julia config #1811

merged 3 commits into from
Mar 15, 2022

Conversation

ChrHorn
Copy link
Contributor

@ChrHorn ChrHorn commented Mar 14, 2022

This simplifies the setup for the Julia language server. 
Also changes the standard indent to 4 spaces, which is recommended in the style guide. 
https://docs.julialang.org/en/v1/manual/style-guide/#Indentation

Comment on lines -471 to -479
"""
using LanguageServer;
using Pkg;
import StaticLint;
env_path = dirname(Pkg.Types.Context().env.project_file);
server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, "");
server.runlinter = true;
run(server);
""",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seemed to be the recommended config that would properly detect the project dir, as well as set up the linter: https://github.com/julia-vscode/LanguageServer.jl/wiki/Vim-and-Neovim

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs seem to be all over the place though, with README suggesting one version, and kakoune wiki another

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of the wiki stuff is just outdated and runserver() is now the recommended option.

https://github.com/julia-vscode/LanguageServer.jl/blob/master/src/runserver.jl
runserver() should detect an exsting project dir automatically, linting is enabled by default.

At least for me everything seems to work fine with this setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be an issue where I get different false positive lint messages for the new and old setup. VScode works fine. Need to dig a bit to see what's going on.

Copy link
Contributor Author

@ChrHorn ChrHorn Mar 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked it again. Detection of local environments was broken with the old config, now everything should work as expected.

There are some false positives for both configs after the initial loading of a file, but they disappear after a save.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good then 👍🏻

@archseer archseer merged commit 0902ede into helix-editor:master Mar 15, 2022
@ChrHorn ChrHorn deleted the julia branch March 15, 2022 04:13
@Seelengrab
Copy link
Contributor

Seelengrab commented Sep 8, 2022

Naively installing the julia language server as documented and launching helix with a julia file in a project does not start the language server for me successfully. I get the following error:

2022-09-08T09:16:18.926 helix_lsp::transport [ERROR] err <- "ERROR: ArgumentError: Package LanguageServer not found in current path.\n"
2022-09-08T09:16:18.926 helix_lsp::transport [ERROR] err <- "- Run `import Pkg; Pkg.add(\"LanguageServer\")` to install the LanguageServer package.\n"
2022-09-08T09:16:18.926 helix_lsp::transport [ERROR] err <- "Stacktrace:\n"
2022-09-08T09:16:18.926 helix_lsp::transport [ERROR] err <- " [1] macro expansion\n"
2022-09-08T09:16:18.926 helix_lsp::transport [ERROR] err <- "   @ ./loading.jl:1243 [inlined]\n"
2022-09-08T09:16:18.926 helix_lsp::transport [ERROR] err <- " [2] macro expansion\n"
2022-09-08T09:16:18.926 helix_lsp::transport [ERROR] err <- "   @ ./lock.jl:267 [inlined]\n"
2022-09-08T09:16:18.944 helix_lsp::transport [ERROR] err <- " [3] require(into::Module, mod::Symbol)\n"
2022-09-08T09:16:18.944 helix_lsp::transport [ERROR] err <- "   @ Base ./loading.jl:1224\n"
2022-09-08T09:16:18.956 helix_lsp::transport [ERROR] err: <- StreamClosed
2022-09-08T09:16:18.956 helix_lsp::transport [ERROR] err: <- StreamClosed

Which indicates to me that the language server specific environment mentioned in the documentation is not being picked up. I added LanguageServer to my main environment, thinking that may be solved by this, but then I get this:

2022-09-08T09:18:12.876 helix_term::application [ERROR] Timed out waiting for language servers to shutdown

What am I doing wrong?

@ChrHorn
Copy link
Contributor Author

ChrHorn commented Sep 8, 2022

The install instructions seem to be old and copied from the neovim extension.

The helix script assumes that LanguageServer is installed in the global v1.x environment. Starting julia and then ]add LanguageServer should be enough to set it up.

@Seelengrab
Copy link
Contributor

Thanks! That does make the errors go away and the logs do suggest the lsp is running, but helix still claims there's no language server, stating Language server not active for current buffer 🤔

@ChrHorn
Copy link
Contributor Author

ChrHorn commented Sep 8, 2022

Do maybe get a timeout message in your logs? If so, try to increase your timeout by adding this to your languages.toml

[[language]]
name = "julia"
language-server = { command = "julia", timeout = 60, args = [
    "--startup-file=no",
    "--history-file=no",
    "--quiet",
    "-e",
    "using LanguageServer; runserver()",
    ]}

@Seelengrab
Copy link
Contributor

That worked, thanks!

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