mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-05 11:25:52 +00:00
Merge branch 'main' into languages/dockerfile
This commit is contained in:
commit
f64049708c
6 changed files with 118 additions and 122 deletions
|
|
@ -25,6 +25,12 @@
|
||||||
- The `setupOpts.mappings` options were also removed. Use the built-in Neovim
|
- The `setupOpts.mappings` options were also removed. Use the built-in Neovim
|
||||||
settings (nvf's {option}`vim.keymaps`)
|
settings (nvf's {option}`vim.keymaps`)
|
||||||
|
|
||||||
|
[Snoweuph](https://github.com/snoweuph)
|
||||||
|
|
||||||
|
- Fix `vim.assistant.codecompanion-nvim.setupOpts.display.diff.provider` to only
|
||||||
|
allow valid options. `default` is no longer valid. `inline` and `split` are
|
||||||
|
two new valid options.
|
||||||
|
|
||||||
## Changelog {#sec-release-0-9-changelog}
|
## Changelog {#sec-release-0-9-changelog}
|
||||||
|
|
||||||
[taylrfnt](https://github.com/taylrfnt)
|
[taylrfnt](https://github.com/taylrfnt)
|
||||||
|
|
@ -164,6 +170,8 @@
|
||||||
- Added [tera](https://keats.github.io/tera/) language support (syntax
|
- Added [tera](https://keats.github.io/tera/) language support (syntax
|
||||||
highlighting only).
|
highlighting only).
|
||||||
|
|
||||||
|
- Added [`golangci-lint`](https://golangci-lint.run/) for more diagnostics.
|
||||||
|
|
||||||
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
|
[vagahbond](https://github.com/vagahbond): [codewindow.nvim]:
|
||||||
https://github.com/gorbit99/codewindow.nvim
|
https://github.com/gorbit99/codewindow.nvim
|
||||||
|
|
||||||
|
|
|
||||||
6
flake.lock
generated
6
flake.lock
generated
|
|
@ -38,11 +38,11 @@
|
||||||
},
|
},
|
||||||
"mnw": {
|
"mnw": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1768701608,
|
"lastModified": 1769981889,
|
||||||
"narHash": "sha256-kSvWF3Xt2HW9hmV5V7i8PqeWJIBUKmuKoHhOgj3Znzs=",
|
"narHash": "sha256-ndI7AxL/6auelkLHngdUGVImBiHkG8w2N2fOTKZKn4k=",
|
||||||
"owner": "Gerg-L",
|
"owner": "Gerg-L",
|
||||||
"repo": "mnw",
|
"repo": "mnw",
|
||||||
"rev": "20d63a8a1ae400557c770052a46a9840e768926b",
|
"rev": "332fed8f43b77149c582f1782683d6aeee1f07cf",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
provider = mkOption {
|
provider = mkOption {
|
||||||
type = enum ["default" "mini_diff"];
|
type = enum ["inline" "split" "mini_diff"];
|
||||||
default = "default";
|
default = "inline";
|
||||||
description = "The preferred kind of provider.";
|
description = "The preferred kind of provider.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
inherit (lib.meta) getExe;
|
inherit (lib.meta) getExe;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
inherit (lib.types) bool enum package;
|
inherit (lib.types) bool enum package;
|
||||||
inherit (lib.nvim.types) mkGrammarOption deprecatedSingleOrListOf;
|
inherit (lib.nvim.types) mkGrammarOption diagnostics deprecatedSingleOrListOf;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
inherit (lib.nvim.attrsets) mapListToAttrs;
|
inherit (lib.nvim.attrsets) mapListToAttrs;
|
||||||
|
|
||||||
|
|
@ -78,6 +78,91 @@
|
||||||
package = pkgs.delve;
|
package = pkgs.delve;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
defaultDiagnosticsProvider = ["golangci-lint"];
|
||||||
|
diagnosticsProviders = {
|
||||||
|
golangci-lint = let
|
||||||
|
pkg = pkgs.golangci-lint;
|
||||||
|
in {
|
||||||
|
package = pkg;
|
||||||
|
config = {
|
||||||
|
cmd = getExe pkg;
|
||||||
|
args = [
|
||||||
|
"run"
|
||||||
|
"--output.json.path=stdout"
|
||||||
|
"--issues-exit-code=0"
|
||||||
|
"--show-stats=false"
|
||||||
|
"--fix=false"
|
||||||
|
"--path-mode=abs"
|
||||||
|
# Overwrite values that could be configured and result in unwanted writes
|
||||||
|
"--output.text.path="
|
||||||
|
"--output.tab.path="
|
||||||
|
"--output.html.path="
|
||||||
|
"--output.checkstyle.path="
|
||||||
|
"--output.code-climate.path="
|
||||||
|
"--output.junit-xml.path="
|
||||||
|
"--output.teamcity.path="
|
||||||
|
"--output.sarif.path="
|
||||||
|
];
|
||||||
|
parser = mkLuaInline ''
|
||||||
|
function(output, bufnr)
|
||||||
|
local SOURCE = "golangci-lint";
|
||||||
|
|
||||||
|
local function display_tool_error(msg)
|
||||||
|
return{
|
||||||
|
{
|
||||||
|
bufnr = bufnr,
|
||||||
|
lnum = 0,
|
||||||
|
col = 0,
|
||||||
|
message = string.format("[%s] %s", SOURCE, msg),
|
||||||
|
severity = vim.diagnostic.severity.ERROR,
|
||||||
|
source = SOURCE,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
if output == "" then
|
||||||
|
return display_tool_error("no output provided")
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, decoded = pcall(vim.json.decode, output)
|
||||||
|
if not ok then
|
||||||
|
return display_tool_error("failed to parse JSON output")
|
||||||
|
end
|
||||||
|
|
||||||
|
if not decoded or not decoded.Issues then
|
||||||
|
return display_tool_error("unexpected output format")
|
||||||
|
end
|
||||||
|
|
||||||
|
local severity_map = {
|
||||||
|
error = vim.diagnostic.severity.ERROR,
|
||||||
|
warning = vim.diagnostic.severity.WARN,
|
||||||
|
info = vim.diagnostic.severity.INFO,
|
||||||
|
hint = vim.diagnostic.severity.HINT,
|
||||||
|
}
|
||||||
|
local diagnostics = {}
|
||||||
|
for _, issue in ipairs(decoded.Issues) do
|
||||||
|
local sev = vim.diagnostic.severity.ERROR
|
||||||
|
if issue.Severity and issue.Severity ~= "" then
|
||||||
|
local normalized = issue.Severity:lower()
|
||||||
|
sev = severity_map[normalized] or vim.diagnostic.severity.ERROR
|
||||||
|
end
|
||||||
|
table.insert(diagnostics, {
|
||||||
|
bufnr = bufnr,
|
||||||
|
lnum = issue.Pos.Line - 1,
|
||||||
|
col = issue.Pos.Column - 1,
|
||||||
|
message = issue.Text,
|
||||||
|
code = issue.FromLinter,
|
||||||
|
severity = sev,
|
||||||
|
source = SOURCE,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
return diagnostics
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.vim.languages.go = {
|
options.vim.languages.go = {
|
||||||
enable = mkEnableOption "Go language support";
|
enable = mkEnableOption "Go language support";
|
||||||
|
|
@ -134,6 +219,14 @@ in {
|
||||||
default = debuggers.${cfg.dap.debugger}.package;
|
default = debuggers.${cfg.dap.debugger}.package;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
extraDiagnostics = {
|
||||||
|
enable = mkEnableOption "extra Go diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||||
|
types = diagnostics {
|
||||||
|
langDesc = "Go";
|
||||||
|
inherit diagnosticsProviders;
|
||||||
|
inherit defaultDiagnosticsProvider;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
|
|
@ -179,5 +272,15 @@ in {
|
||||||
debugger.nvim-dap.enable = true;
|
debugger.nvim-dap.enable = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.extraDiagnostics.enable {
|
||||||
|
vim.diagnostics.nvim-lint = {
|
||||||
|
enable = true;
|
||||||
|
linters_by_ft.go = cfg.extraDiagnostics.types;
|
||||||
|
linters =
|
||||||
|
mkMerge (map (name: {${name} = diagnosticsProviders.${name}.config;})
|
||||||
|
cfg.extraDiagnostics.types);
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
inherit (lib.trivial) flip;
|
inherit (lib.trivial) flip;
|
||||||
inherit (builtins) filter isString hasAttr getAttr;
|
inherit (builtins) filter isString hasAttr getAttr;
|
||||||
|
|
||||||
getPin = flip getAttr (pkgs.callPackages ../../../npins/sources.nix {});
|
getPin = flip getAttr (inputs.mnw.lib.npinsToPluginsAttrs pkgs ../../../npins/sources.json);
|
||||||
|
|
||||||
# Build a Vim plugin with the given name and arguments.
|
# Build a Vim plugin with the given name and arguments.
|
||||||
buildPlug = attrs: let
|
buildPlug = attrs: let
|
||||||
|
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
fetchurl,
|
|
||||||
fetchgit,
|
|
||||||
fetchzip,
|
|
||||||
}:
|
|
||||||
builtins.mapAttrs
|
|
||||||
(
|
|
||||||
name: spec: let
|
|
||||||
mayOverride = name: path: let
|
|
||||||
envVarName = "NPINS_OVERRIDE_${saneName}";
|
|
||||||
saneName = builtins.concatStringsSep "_" (
|
|
||||||
builtins.concatLists (
|
|
||||||
builtins.filter (x: builtins.isList x && x != [""]) (builtins.split "([a-zA-Z0-9]*)" name)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
ersatz = builtins.getEnv envVarName;
|
|
||||||
in
|
|
||||||
if ersatz == ""
|
|
||||||
then path
|
|
||||||
else
|
|
||||||
# this turns the string into an actual Nix path (for both absolute and
|
|
||||||
# relative paths)
|
|
||||||
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
|
|
||||||
if builtins.substring 0 1 ersatz == "/"
|
|
||||||
then /. + ersatz
|
|
||||||
else /. + builtins.getEnv "PWD" + "/${ersatz}"
|
|
||||||
);
|
|
||||||
|
|
||||||
path =
|
|
||||||
rec {
|
|
||||||
GitRelease = Git;
|
|
||||||
Channel = Tarball;
|
|
||||||
|
|
||||||
Git =
|
|
||||||
if spec.url != null && !spec.submodules
|
|
||||||
then Tarball
|
|
||||||
else
|
|
||||||
fetchgit (
|
|
||||||
let
|
|
||||||
repo = spec.repository;
|
|
||||||
url =
|
|
||||||
{
|
|
||||||
Git = repo.url;
|
|
||||||
GitHub = "https://github.com/${repo.owner}/${repo.repo}.git";
|
|
||||||
GitLab = "${repo.server}/${repo.repo_path}.git";
|
|
||||||
Forgejo = "${repo.server}/${repo.owner}/${repo.repo}.git";
|
|
||||||
}
|
|
||||||
.${
|
|
||||||
repo.type
|
|
||||||
} or (throw "Unrecognized repository type ${repo.type}");
|
|
||||||
in {
|
|
||||||
name = let
|
|
||||||
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url;
|
|
||||||
appendShort =
|
|
||||||
if (builtins.match "[a-f0-9]*" spec.revision) != null
|
|
||||||
then "-${builtins.substring 0 7 spec.revision}"
|
|
||||||
else "";
|
|
||||||
in "${
|
|
||||||
if matched == null
|
|
||||||
then "source"
|
|
||||||
else builtins.head matched
|
|
||||||
}${appendShort}";
|
|
||||||
inherit url;
|
|
||||||
|
|
||||||
rev = spec.revision;
|
|
||||||
inherit (spec) hash;
|
|
||||||
fetchSubmodules = spec.submodules;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
PyPi = fetchurl {
|
|
||||||
inherit (spec) url hash;
|
|
||||||
};
|
|
||||||
|
|
||||||
Tarball = fetchzip {
|
|
||||||
inherit (spec) url hash;
|
|
||||||
extension = "tar";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
.${
|
|
||||||
spec.type
|
|
||||||
} or (builtins.throw "Unknown source type ${spec.type}");
|
|
||||||
|
|
||||||
version =
|
|
||||||
if spec ? revision
|
|
||||||
then builtins.substring 0 8 spec.revision
|
|
||||||
else "0";
|
|
||||||
in
|
|
||||||
spec
|
|
||||||
// {
|
|
||||||
name = "${name}-${version}";
|
|
||||||
pname = name;
|
|
||||||
inherit version;
|
|
||||||
outPath =
|
|
||||||
(
|
|
||||||
# Override logic won't do anything if we're in pure eval
|
|
||||||
if builtins ? currentSystem
|
|
||||||
then mayOverride name path
|
|
||||||
else path
|
|
||||||
).overrideAttrs
|
|
||||||
{
|
|
||||||
pname = name;
|
|
||||||
name = "${name}-${version}";
|
|
||||||
inherit version;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
)
|
|
||||||
(
|
|
||||||
let
|
|
||||||
json = lib.importJSON ./sources.json;
|
|
||||||
in
|
|
||||||
assert lib.assertMsg (json.version == 7) "Unsupported format version ${toString json.version} in sources.json. Try running `npins upgrade`";
|
|
||||||
json.pins
|
|
||||||
)
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue