mason.nvim icon indicating copy to clipboard operation
mason.nvim copied to clipboard

[New package]: racket-langserver

Open ignamartinoli opened this issue 1 year ago • 11 comments

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

ignamartinoli avatar Jul 31 '22 18:07 ignamartinoli

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.

williambotman avatar Jul 31 '22 18:07 williambotman

If no one is working on this, I could make a PR in a few days.

haoyun avatar Oct 21 '22 22:10 haoyun

@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

ignamartinoli avatar Oct 22 '22 23:10 ignamartinoli

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).

williamboman avatar Oct 23 '22 15:10 williamboman

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.

haoyun avatar Oct 23 '22 22:10 haoyun

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"

williamboman avatar Oct 25 '22 14:10 williamboman

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.

Spaceface16518 avatar Feb 14 '23 00:02 Spaceface16518

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.

Lazerbeak12345 avatar Mar 11 '23 04:03 Lazerbeak12345

Yep, fortunately raco works great out of the box

ignamartinoli avatar Mar 12 '23 17:03 ignamartinoli

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,
        }
    }
}

dhruvdabhi101 avatar Jun 23 '23 14:06 dhruvdabhi101

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" },
    }
  }
}

qazxcdswe123 avatar Jul 09 '23 07:07 qazxcdswe123