crates.io

RSCLS

A proof-of-concept language server for rust-script.

How it works

Internally, RSCLS spawns an instance of rust-analyzer on the package directory generated by rust-script, and proxy communications between the client (your editor) and rust-analyzer. While proxying request/response/notifications, when it saw an URI that represents the rust-script sent from the client, it translates the URI to the source file in the generated package directory. And similary, when it saw an URI that represents the source file in the generated package directory sent from the server, it translates the URI to the original rust-script file.

What doesn't work

Example configuration

Here's an example configuration for nvim-lspconfig. I don't use other editor/IDEs, so please figure them out on your own. lua -- Assumes `autocmd BufEnter *.ers setlocal filetype=rust-script` local lsp_configs = require 'lspconfig.configs' if not lsp_configs.rlscls then lsp_configs.rlscls = { default_config = { filetypes = { 'rust-script' }, root_dir = function(fname) return lspconfig.util.path.dirname(fname) end, detached = false, get_language_id = function(bufnr, filetype) if filetype == 'rust-script' then return 'rust' end end, }, on_new_config = function(new_config, root_dir) if not new_config.cmd then local bufname = vim.api.nvim_buf_get_name(0) new_config.cmd = { 'rscls', bufname, } end end, docs = { description = [[ An awesome documentation here. ]], } } end lspconfig.rlscls.setup { }