Added node support

This commit is contained in:
Fred Drake
2024-10-05 21:45:06 -04:00
parent ee5b6054c1
commit 3034aa64aa
6 changed files with 222 additions and 129 deletions
+2 -1
View File
@@ -31,7 +31,7 @@ The default configuration performs editing without settings for any particular l
## Technology Support
| Technology | Formatter | Language Server | Debugger | Nix Configuration |
| ---------- | ------------ | ---------------------------------- | ---------- | ----------------- |
| ---------- | ------------ | ---------------------------------- | --------------- | ----------------- |
| Nix | alejandra | nil-ls, nixd | | default |
| Just | just | | | default |
| SQL | sqlformat | | | default |
@@ -50,3 +50,4 @@ The default configuration performs editing without settings for any particular l
| Go | golines | gopls | delve | golang |
| Python | black, isort | flake8, jedi, pylint, rope, mccabe | dap-python | python |
| Rust | rustfmt | clippy | lldb | rust |
| Node | prettier | tsserver | vscode-js-debug | javascript |
+28
View File
@@ -0,0 +1,28 @@
{pkgs, ...}: {
plugins = {
dap = {
enable = true;
adapters.servers = {
"pwa-node" = {
host = "localhost";
port = 8123;
executable = {
command = "${pkgs.vscode-js-debug}/bin/js-debug";
};
};
};
};
};
extraConfigLua = ''
require("dap").configurations.javascript = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "''${file}",
cwd = "''${workspaceFolder}",
},
}
'';
}
+16
View File
@@ -0,0 +1,16 @@
let
# Read all files in the current directory
files = builtins.readDir ./.;
# Filter out default.nix and non-.nix files
nixFiles = builtins.filter
(name: name != "default.nix" && builtins.match ".*\\.nix" name != null)
(builtins.attrNames files);
# Create a list of import statements
imports = map (name: ./. + "/${name}") nixFiles;
in {
# Import all configuration modules automatically
imports = imports;
}
+52
View File
@@ -0,0 +1,52 @@
{
plugins = {
conform-nvim = {
settings = {
formatters_by_ft.javascript = ["prettier"];
formatters_by_ft.typescript = ["prettier"];
formatters_by_ft.javascriptreact = ["prettier"];
formatters_by_ft.typescriptreact = ["prettier"];
};
};
lsp.servers.ts-ls = {
enable = true;
filetypes = [
"javascript"
"javascriptreact"
"typescript"
"typescriptreact"
];
extraOptions = {
settings = {
javascript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
typescript = {
inlayHints = {
includeInlayEnumMemberValueHints = true;
includeInlayFunctionLikeReturnTypeHints = true;
includeInlayFunctionParameterTypeHints = true;
includeInlayParameterNameHints = "all";
includeInlayParameterNameHintsWhenArgumentMatchesName = true;
includeInlayPropertyDeclarationTypeHints = true;
includeInlayVariableTypeHints = true;
};
};
};
};
};
lsp.servers.eslint.enable = true;
none-ls.sources.formatting.prettier = {
enable = true;
disableTsServerFormatter = false;
};
};
}
-4
View File
@@ -175,8 +175,6 @@ in
formatters_by_ft = {
css = ["prettier"];
html = ["prettier"];
javascript = ["prettier"];
javascriptreact = ["prettier"];
json = ["prettier"];
just = ["just"];
lua = ["stylua"];
@@ -185,8 +183,6 @@ in
ruby = ["rubyfmt"];
terraform = ["tofu_fmt"];
tf = ["tofu_fmt"];
typescript = ["prettier"];
typescriptreact = ["prettier"];
yaml = ["yamlfmt"];
};
};
+22 -22
View File
@@ -6,8 +6,7 @@
flake-parts.url = "github:hercules-ci/flake-parts";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs =
{
outputs = {
nixvim,
flake-parts,
rust-overlay,
@@ -20,17 +19,13 @@
"x86_64-darwin"
"aarch64-darwin"
];
perSystem =
{ system, ... }:
let
perSystem = {system, ...}: let
overlays = [(import rust-overlay)];
nixvimLib = nixvim.lib.${system};
nixvim' = nixvim.legacyPackages.${system};
baseNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
module = {pkgs, ...}: {
imports = [./config];
extraPackages = with pkgs; [sops];
};
@@ -38,9 +33,7 @@
};
rustNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
module = {pkgs, ...}: {
imports = [
./config
./config/rust
@@ -54,9 +47,7 @@
};
csharpNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
module = {pkgs, ...}: {
imports = [
./config
./config/csharp
@@ -67,9 +58,7 @@
};
goNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
module = {pkgs, ...}: {
imports = [
./config
./config/golang
@@ -80,9 +69,7 @@
};
pythonNixvimModule = {
inherit pkgs;
module =
{ pkgs, ... }:
{
module = {pkgs, ...}: {
imports = [
./config
./config/python
@@ -91,6 +78,17 @@
};
extraSpecialArgs = {};
};
javascriptNixvimModule = {
inherit pkgs;
module = {pkgs, ...}: {
imports = [
./config
./config/javascript
];
extraPackages = with pkgs; [sops];
};
extraSpecialArgs = {};
};
pkgs = import inputs.nixpkgs {
inherit system overlays;
config.allowUnfree = true;
@@ -100,8 +98,8 @@
csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule;
goNvim = nixvim'.makeNixvimWithModule goNixvimModule;
pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule;
in
{
javascriptNvim = nixvim'.makeNixvimWithModule javascriptNixvimModule;
in {
checks = {
# Run `nix flake check .` to verify that your config is not broken
default = nixvimLib.check.mkTestDerivationFromNixvimModule baseNixvimModule;
@@ -117,6 +115,8 @@
golang = goNvim;
# Lets you run `nix run .#python` to start nixvim with Python configuration
python = pythonNvim;
# Lets you run `nix run .#javascript` to start nixvim with JS/TS configuration
javascript = javascriptNvim;
};
};
};