mason.nvim
mason.nvim copied to clipboard
[New package]: racket-langserver
Package name
racket-langserver
Package homepage
https://github.com/jeapostrophe/racket-langserver
Languages
Racket
How is this package distributed?
From what says it's section on nvim-lspconfig
, it should be installed with the command raco pkg install racket-langserver
. I tried to add it myself to the project but I wasn't able to understand who it's structured or should work. Help would be appreciated
Hello! Pull requests are always very welcomed to add new packages. If the distribution of the package is simple, the installation will most likely be so as well. See CONTRIBUTING.md and the API reference for more details! You may also use existing packages as reference.
If no one is working on this, I could make a PR in a few days.
@haoyun at the moment I don't have the time to work on this.
If you were able to fix this that would be awesome
Hey! It seems like the language server is only available via raco
, for which support would need to be added from scratch in Mason (similar to npm for example). There might be some aspects of raco
that makes it a bad fit for Mason - for example inability to customize installations (we don't want to be installing packages outside of Mason's install dir for instance).
You are right. It's seems impossible to install it into Mason's install dir. Its default dir is ~/.local/share/racket/<version>/pkgs
. It's also loaded as an racket library, via racket --lib racket-langserver
. Libary search paths for racket can be configured to a customized dir (https://docs.racket-lang.org/raco/config-file.html), then we cannot directly use https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/racket_langserver.lua.
I am quite new in both lua and racket. correct me if i said something stupid.
We can always override the cmd in mason-lspconfig should it be needed. Additionally we could even write a wrapper executable called racket-langserver
which calls racket --lib "/mason/packages/racket-langserver"
I need to use racket for school work, and I wanted to use my existing neovim setup with mason. Do we have racket support yet? Is there anything I can do move this along? I'm not very familiar with racket, as I'm learning it in a class, but I can open a try and PR if that is necessary.
For reasons (mostly involving my use of the unstable rolling-release versions of racket), I myself have found that manually installing racket-langserver
via raco pkg install racket-langserver
is an acceptable solution for me. Not for everyone, ofc.
I've included this line:
lspconfig.racket_langserver.setup(default_args) -- default_args has my on_attach function, and the like.
before my call to mason.setup
, and it's been working great.
Hope that helps anyone while this issue is pending - even though I don't expect to use mason for this particular langserver.
Yep, fortunately raco works great out of the box
I added into my init.lua file and it worked.
require('lspconfig').racket_langserver.setup{
cmd = { "racket", "--lib", "racket-langserver", "--", "--stdio" },
filetypes = { "racket" },
root_dir = require('lspconfig/util').root_pattern("info.rkt", "main.rkt", "test.rkt", "langserver.rkt", ".git"),
settings = {
racket = {
runtime = "/usr/bin/racket",
useGlobalErrorPort = true,
useGlobalWarningPort = true,
trace = false,
traceDetails = false,
traceExpansion = false,
traceSyntax = false,
traceIO = false,
traceGC = false,
traceJIT = false,
traceOptimize = false,
traceCompile = false,
traceResolve = false,
traceLink = false,
traceRun = false,
traceExpand = false,
traceContract = false,
traceMacro = false,
traceMacroExpansion = false,
traceExpandOutput = false,
traceExpandInput = false,
traceExpandSyntax = false,
traceExpandSyntaxOutput = false,
}
}
}
for those who are using lazyvim, you can add this to overwrite the lspconfig
after installing the lsp via raco
ref: https://www.lazyvim.org/plugins/lsp
opts = {
servers = {
racket_langserver = {
cmd = { "racket", "--lib", "racket-langserver", "--", "--stdio" },
filetypes = { "racket", "scheme" },
}
}
}