fix google formatters
This commit is contained in:
@ -27,7 +27,10 @@ function M.setup(capabilities)
|
|||||||
"bzl",
|
"bzl",
|
||||||
"typescript",
|
"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 = {},
|
settings = {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -55,7 +58,9 @@ function M.setup(capabilities)
|
|||||||
"typescript",
|
"typescript",
|
||||||
"javascript",
|
"javascript",
|
||||||
},
|
},
|
||||||
root_dir = lspconfig.util.root_pattern("BUILD"),
|
root_dir = function(fname)
|
||||||
|
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
|
||||||
|
end,
|
||||||
settings = {},
|
settings = {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -83,6 +88,9 @@ function M.setup(capabilities)
|
|||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
underline = true,
|
underline = true,
|
||||||
}),
|
}),
|
||||||
|
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||||
|
focusable = false,
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
||||||
|
@ -19,7 +19,7 @@ return {
|
|||||||
{ import = "nvgoog.google.misc" },
|
{ import = "nvgoog.google.misc" },
|
||||||
-- maktaba is required by all google plugins
|
-- maktaba is required by all google plugins
|
||||||
glug("maktaba", {
|
glug("maktaba", {
|
||||||
lazy = true,
|
lazy = false,
|
||||||
dependencies = {},
|
dependencies = {},
|
||||||
config = function() -- init?
|
config = function() -- init?
|
||||||
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
|
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
|
||||||
@ -109,43 +109,43 @@ return {
|
|||||||
{ "junegunn/fzf.vim", dependencies = { "junegunn/fzf" } },
|
{ "junegunn/fzf.vim", dependencies = { "junegunn/fzf" } },
|
||||||
-- Format google code
|
-- Format google code
|
||||||
glug("codefmt-google", {
|
glug("codefmt-google", {
|
||||||
|
lazy = false,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
glug("codefmt", {
|
glug("codefmt", {
|
||||||
-- TODO: remove prettier when http://cl/549024543 is submitted and deployed
|
lazy = false,
|
||||||
-- - 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
|
|
||||||
opts = {
|
opts = {
|
||||||
clang_format_executable = "/usr/bin/clang-format",
|
clang_format_executable = "/usr/bin/clang-format",
|
||||||
clang_format_style = "function('codefmtgoogle#GetClangFormatStyle')",
|
clang_format_style = "function('codefmtgoogle#GetClangFormatStyle')",
|
||||||
gofmt_executable = "/usr/lib/google-golang/bin/gofmt",
|
gofmt_executable = "/usr/lib/google-golang/bin/gofmt",
|
||||||
prettier_executable = "/google/data/ro/teams/prettier/prettier",
|
prettier_executable = "/google/data/ro/teams/prettier/prettier",
|
||||||
ktfmt_executable = { "/google/bin/releases/kotlin-google-eng/ktfmt/ktfmt", "--google-style" },
|
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" },
|
cmd = { "FormatLines", "FormatCode", "AutoFormatBuffer" },
|
||||||
event = "BufWritePre",
|
event = "BufWritePre",
|
||||||
-- Setting up autocmds in init allows deferring loading the plugin until
|
-- Setting up autocmds in init allows deferring loading the plugin until
|
||||||
|
Reference in New Issue
Block a user