feat(typst-lsp): added
This commit is contained in:
parent
21fdf2d031
commit
3368536455
20
default.nix
20
default.nix
@ -75,16 +75,28 @@ in
|
|||||||
];
|
];
|
||||||
extraLuaConfig =
|
extraLuaConfig =
|
||||||
let
|
let
|
||||||
paths = {
|
# tries to compute a package set required to make package resolution in lua
|
||||||
|
# via deps["pkg"] work
|
||||||
|
packages = file:
|
||||||
|
let
|
||||||
|
out = builtins.readFile (pkgs.runCommandLocal "extract-deps"
|
||||||
|
{ nativeBuildInputs = [ pkgs.gnused ]; __contentAddressed = true; } ''
|
||||||
|
sed -nr 's/.*(deps\.(.*)_path|deps\["(.*)"\]).*/\2/p' ${file} | uniq > $out
|
||||||
|
'');
|
||||||
|
names = lib.splitString "\n" (lib.traceVal out);
|
||||||
|
in
|
||||||
|
filter (name: name != "") names;
|
||||||
|
paths = (listToAttrs (map (name: { inherit name; value = builtins.getAttr name pkgs; }) (packages "${confDir}/*.lua"))) // {
|
||||||
lldb = pkgs.lldb;
|
lldb = pkgs.lldb;
|
||||||
rust_analyzer = rust-analyzer;
|
rust_analyzer = rust-analyzer;
|
||||||
|
typst_lsp = pkgs.typst-lsp;
|
||||||
};
|
};
|
||||||
pathsLua = pkgs.writeTextFile {
|
pathsLua = pkgs.writeTextFile {
|
||||||
name = "nvim-deps.lua";
|
name = "nvim-deps.lua";
|
||||||
text = ''
|
text = ''
|
||||||
return {
|
deps = {}
|
||||||
${concatStringsSep ",\n " (mapAttrsToList (name: path: ''${name}_path = "${path}"'') paths)}
|
${concatStringsSep "\n " (mapAttrsToList (name: path: ''deps["${name}_path"] = "${path}"'') paths)}
|
||||||
}
|
return deps
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
confDir = lib.sourceFilesBySuffices ./. [ "lua" "vim" ];
|
confDir = lib.sourceFilesBySuffices ./. [ "lua" "vim" ];
|
||||||
|
23
init.lua
23
init.lua
@ -125,5 +125,28 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
function() vim.lsp.buf.format {async = true} end, opts)
|
function() vim.lsp.buf.format {async = true} end, opts)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
|
-- deps.typst-lsp_path
|
||||||
|
lspconfig.typst_lsp.setup {
|
||||||
|
cmd = {(deps["typst-lsp_path"] .. "/bin/typst-lsp")},
|
||||||
|
settings = {
|
||||||
|
exportPdf = "onType", -- Choose onType, onSave or never.
|
||||||
|
serverPath = (deps["typst-lsp_path"] .. "/bin/typst-lsp"), -- Normally, there is no need to uncomment it.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lspconfig.nil_ls.setup {
|
||||||
|
cmd = {(deps.nil_path .. "/bin/nil")},
|
||||||
|
-- https://github.com/oxalica/nil/blob/main/docs/configuration.md
|
||||||
|
settings = {
|
||||||
|
command = {
|
||||||
|
formatting = "nixpkgs-fmt", },
|
||||||
|
},
|
||||||
|
flake = {
|
||||||
|
autoArchive = true,
|
||||||
|
autoEvalInputs = true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
require("lsp-inlayhints").setup()
|
require("lsp-inlayhints").setup()
|
||||||
require("completion")
|
require("completion")
|
||||||
|
4
rust.lua
4
rust.lua
@ -114,7 +114,7 @@ vim.g.rustaceanvim = {
|
|||||||
-- standalone file support
|
-- standalone file support
|
||||||
-- setting it to false may improve startup time
|
-- setting it to false may improve startup time
|
||||||
standalone = true,
|
standalone = true,
|
||||||
cmd = {(deps.rust_analyzer_path .. "/bin/rust-analyzer")},
|
cmd = {(deps.rust-analyzer_path .. "/bin/rust-analyzer")},
|
||||||
capabilities = require("cmp_nvim_lsp").default_capabilities(c),
|
capabilities = require("cmp_nvim_lsp").default_capabilities(c),
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
require("lsp-inlayhints").on_attach(client, bufnr)
|
require("lsp-inlayhints").on_attach(client, bufnr)
|
||||||
@ -281,7 +281,7 @@ rt.setup({
|
|||||||
-- standalone file support
|
-- standalone file support
|
||||||
-- setting it to false may improve startup time
|
-- setting it to false may improve startup time
|
||||||
standalone = true,
|
standalone = true,
|
||||||
cmd = {(deps.rust_analyzer_path .. "/bin/rust-analyzer")}
|
cmd = {(deps.rust-analyzer_path .. "/bin/rust-analyzer")}
|
||||||
}, -- rust-analyzer options
|
}, -- rust-analyzer options
|
||||||
|
|
||||||
-- debugging stuff
|
-- debugging stuff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user