-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.nix
More file actions
85 lines (77 loc) · 2.45 KB
/
config.nix
File metadata and controls
85 lines (77 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{ callPackage
, lib
, stdenv
, pythonWithPackages
, kernelName
}:
let
common = callPackage ../../../common.nix {};
diagnostic-languageserver = (callPackage ../../../../language_servers/diagnostic-languageserver/default.nix {})
."diagnostic-languageserver-git+https://github.com/codedownio/diagnostic-languageserver.git#0171e0867e0c340c287bfd60c348425585e21eeb";
python = pythonWithPackages (ps: [ps.flake8]);
languageServerName = "flake8";
passthru = {
inherit languageServerName;
};
in
common.writeTextDirWithMetaAndPassthru python.pkgs.flake8.meta passthru "lib/codedown/language-servers/python-${kernelName}-flake8.yaml"
(lib.generators.toYAML {} [{
name = languageServerName;
version = python.pkgs.flake8.version;
display_name = "Flake8";
description = python.pkgs.flake8.meta.description;
extensions = ["py"];
notebook_suffix = ".py";
kernel_name = kernelName;
attrs = ["python"];
type = "stream";
args = ["${diagnostic-languageserver}/bin/diagnostic-languageserver" "--stdio" "--log-level" "1"];
# Not sure whether to do this using an environment variable or initialization option
env = {
PYTHONPATH = lib.concatStringsSep ":" [
"${python}/${python.sitePackages}"
"/home/user/.local/${python.sitePackages}"
];
};
initialization_options = {
linters = {
flake8 = {
sourceName = "flake8";
command = "${python.pkgs.flake8}/bin/flake8";
args = [
"%file"
];
formatPattern = [
# TODO: include message code somehow?
"^([^:]+):(\\d+):(\\d+): (.)(\\S+) (.*)"
{
line = 2;
column = 3;
security = 4;
message = 6;
}
];
rootPatterns = [".git" "pyproject.toml" "setup.py"];
securities = {
E = "error"; # Errors? (typically from pycodestyle)
W = "warning"; # Warnings? (typically from pycodestyle)
C = "warning"; # cyclomatic complexity (from mccabe)
F = "warning"; # flake8's own warnings
};
offsetColumn = 0;
offsetLine = 0;
formatLines = 1;
};
};
filetypes = {
py = "flake8";
md = "flake8";
ipynb = "flake8";
flake8 = "flake8";
python = "flake8";
};
formatters = {};
formatFiletypes = {};
};
language_id = "python";
}])