LSP& formatter: Python and markdown

stolen from: https://github.com/spector700/Akari
This commit is contained in:
Barna Máté 2024-12-19 20:09:56 +01:00
parent 2981a118ae
commit 8d284b106c
3 changed files with 108 additions and 0 deletions

View file

@ -7,8 +7,10 @@
./html.nix ./html.nix
./json.nix ./json.nix
./lua.nix ./lua.nix
./markdown.nix
./nix.nix ./nix.nix
./protobuf.nix ./protobuf.nix
./python.nix
./rust.nix ./rust.nix
./ts.nix ./ts.nix
./yaml.nix ./yaml.nix

View file

@ -0,0 +1,61 @@
{ pkgs, helpers, ... }:
{
extraPackages = with pkgs; [
marksman
];
plugins = {
clipboard-image = {
enable = true;
clipboardPackage = pkgs.wl-clipboard;
};
image = {
enable = helpers.enableExceptInTests;
integrations.markdown = {
clearInInsertMode = true;
onlyRenderImageAtCursor = true;
};
};
markdown-preview = {
enable = true;
};
lsp.servers = {
marksman.enable = true;
ltex = {
enable = true;
filetypes = [
"markdown"
"text"
];
settings.completionEnabled = true;
extraOptions = {
checkFrequency = "save";
language = "en-GB";
};
};
};
lint = {
lintersByFt.md = [ "markdownlint-cli2" ];
linters.markdownlint-cli2.cmd = "${pkgs.markdownlint-cli2}/bin/markdownlint-cli2";
};
};
keymaps = [
{
mode = "n";
key = "<leader>m";
action = "<cmd>MarkdownPreviewToggle<cr>";
options = {
silent = true;
desc = "Toggle markdown preview";
};
}
];
}

View file

@ -0,0 +1,45 @@
{ pkgs, ... }:
{
plugins = {
dap.extensions.dap-python.enable = true;
conform-nvim.settings = {
formatters_by_ft.python = [
"ruff_format"
"ruff_organize_imports"
];
};
lint = {
lintersByFt.python = [ "mypy" ];
linters.mypy = {
cmd = "${pkgs.mypy}/bin/mypy";
args = [ "--ignore-missing-imports" ];
};
};
lsp.servers = {
pyright = {
enable = true;
extraOptions.settings = {
# Using Ruff's import organizer
pyright.disableOrganizeImports = true;
python.analysis = {
# Ignore all files for analysis to exclusively use Ruff for linting
ignore.__raw = ''{ '*' }'';
};
};
};
ruff = {
enable = true;
onAttach.function = ''
if client.name == 'ruff' then
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end
'';
};
};
};
}