fix google formatters

This commit is contained in:
Christian Nieves
2024-01-16 22:43:27 +00:00
parent 80b8c0e214
commit c19d01dc21
2 changed files with 37 additions and 29 deletions

View File

@ -27,7 +27,10 @@ function M.setup(capabilities)
"bzl",
"typescript",
},
root_dir = lspconfig.util.root_pattern("BUILD"),
-- root_dir = lspconfig.util.root_pattern("BUILD"),
root_dir = function(fname)
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
end,
settings = {},
},
}
@ -55,7 +58,9 @@ function M.setup(capabilities)
"typescript",
"javascript",
},
root_dir = lspconfig.util.root_pattern("BUILD"),
root_dir = function(fname)
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
end,
settings = {},
},
}
@ -83,6 +88,9 @@ function M.setup(capabilities)
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
}),
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
focusable = false,
}),
}
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)

View File

@ -19,7 +19,7 @@ return {
{ import = "nvgoog.google.misc" },
-- maktaba is required by all google plugins
glug("maktaba", {
lazy = true,
lazy = false,
dependencies = {},
config = function() -- init?
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
@ -109,43 +109,43 @@ return {
{ "junegunn/fzf.vim", dependencies = { "junegunn/fzf" } },
-- Format google code
glug("codefmt-google", {
lazy = false,
dependencies = {
glug("codefmt", {
-- TODO: remove prettier when http://cl/549024543 is submitted and deployed
-- - remove prettier from the plugin options
-- - set js/ts to use prettier instead of clang-format
-- autocmd FileType javascript,typescript,javascriptreact,typescriptreact,css,scss,html,json AutoFormatBuffer prettier
lazy = false,
opts = {
clang_format_executable = "/usr/bin/clang-format",
clang_format_style = "function('codefmtgoogle#GetClangFormatStyle')",
gofmt_executable = "/usr/lib/google-golang/bin/gofmt",
prettier_executable = "/google/data/ro/teams/prettier/prettier",
ktfmt_executable = { "/google/bin/releases/kotlin-google-eng/ktfmt/ktfmt", "--google-style" },
auto_format = {
["borg"] = "gclfmt",
["gcl"] = "gclfmt",
["patchpanel"] = "gclfmt",
["bzl"] = "buildifier",
["c"] = "clang-format",
["cpp"] = "clang-format",
["javascript"] = "clang-format",
["typescript"] = "clang-format",
["dart"] = "dartfmt",
["go"] = "gofmt",
["java"] = "google-java-format",
["kotlin"] = "ktfmt",
["jslayout"] = "jslfmt",
["markdown"] = "mdformat",
["ncl"] = "nclfmt",
["python,piccolo"] = "pyformat",
["soy"] = "soyfmt",
["textpb"] = "text-proto-format",
["proto"] = "protofmt",
["sql"] = "format_sql",
},
},
}),
},
opts = {
auto_format = {
["borg"] = "gclfmt",
["gcl"] = "gclfmt",
["patchpanel"] = "gclfmt",
["bzl"] = "buildifier",
["c"] = "clang-format",
["cpp"] = "clang-format",
["javascript"] = "clang-format",
["typescript"] = "clang-format",
["dart"] = "dartfmt",
["go"] = "gofmt",
["java"] = "google-java-format",
["kotlin"] = "ktfmt",
["jslayout"] = "jslfmt",
["markdown"] = "mdformat",
["ncl"] = "nclfmt",
["python,piccolo"] = "pyformat",
["soy"] = "soyfmt",
["textpb"] = "text-proto-format",
["proto"] = "protofmt",
["sql"] = "format_sql",
},
},
cmd = { "FormatLines", "FormatCode", "AutoFormatBuffer" },
event = "BufWritePre",
-- Setting up autocmds in init allows deferring loading the plugin until