Skip to content

Commit

Permalink
fix: prisma
Browse files Browse the repository at this point in the history
  • Loading branch information
willruggiano committed Jul 21, 2023
1 parent 13be388 commit d5acd93
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 14 deletions.
7 changes: 1 addition & 6 deletions neovim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
# Environment variables to bake into the neovim environment.
# If an environment variable is already defined, the existing definition will take precedence.
env = {
PRISMA_MIGRATION_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/migration-engine";
PRISMA_QUERY_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/query-engine";
PRISMA_QUERY_ENGINE_LIBRARY = "${pkgs.prisma-engines}/lib/libquery_engine.node";
PRISMA_INTROSPECTION_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/introspection-engine";
PRISMA_FMT_BINARY = "${pkgs.prisma-engines}/bin/prisma-fmt";
DEVENV_PROFILE = "foobar";
# Nothing to see here.
};

# Tools to bake into the neovim environment.
Expand Down
21 changes: 16 additions & 5 deletions plugins/bombadil/lua/bombadil/lsp/null-ls/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
return {
alejandra = require "bombadil.lsp.null-ls.alejandra",
jsonnet = require "bombadil.lsp.null-ls.jsonnet",
man = require "bombadil.lsp.null-ls.man",
statix = require "bombadil.lsp.null-ls.statix",
local custom_sources = { "alejandra", "jsonnet", "man", "prisma", "statix" }

local sources = {
code_actions = {},
diagnostics = {},
formatting = {},
hover = {},
}

for _, name in ipairs(custom_sources) do
local custom_source = require("bombadil.lsp.null-ls." .. name)
for action, source in pairs(custom_source) do
sources[action][name] = source
end
end

return sources
23 changes: 23 additions & 0 deletions plugins/bombadil/lua/bombadil/lsp/null-ls/prisma.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
local h = require "null-ls.helpers"
local methods = require "null-ls.methods"
local FORMATTING = methods.internal.FORMATTING

local sources = {}

sources.formatting = h.make_builtin {
name = "prismaFmt",
meta = {
url = "https://github.com/prisma/prisma-engines",
description = "Formatter for the prisma filetype.",
},
method = FORMATTING,
filetypes = { "prisma" },
generator_opts = {
command = "prisma-fmt",
args = { "format" },
to_stdin = true,
},
factory = h.formatter_factory,
}

return sources
4 changes: 2 additions & 2 deletions plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ return function()
debug = true,
on_attach = on_attach,
sources = {
custom_sources.jsonnet.formatting,
null_ls.builtins.code_actions.eslint_d,
null_ls.builtins.code_actions.gitsigns,
-- null_ls.builtins.code_actions.ltrs,
Expand All @@ -232,9 +231,10 @@ return function()
null_ls.builtins.formatting.clang_format.with { extra_args = { "--style=file" } },
null_ls.builtins.formatting.cmake_format,
null_ls.builtins.formatting.eslint_d,
custom_sources.formatting.jsonnet,
-- null_ls.builtins.formatting.pg_format,
null_ls.builtins.formatting.prettierd,
null_ls.builtins.formatting.prismaFmt,
custom_sources.formatting.prisma,
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.shellharden.with { filetypes = { "bash", "sh" } },
null_ls.builtins.formatting.shfmt.with { filetypes = { "bash", "sh" } },
Expand Down
1 change: 0 additions & 1 deletion plugins/spec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ in rec {
nodePackages.jsonlint
nodePackages.prettier
# nodePackages.pretterd
nodePackages.prisma
pgformatter
rustfmt
shellcheck
Expand Down

0 comments on commit d5acd93

Please sign in to comment.