Compare commits
3 Commits
43d10533ce
...
56c6370a73
Author | SHA1 | Date |
---|---|---|
Rob Watson | 56c6370a73 | |
Rob Watson | 5443f5f067 | |
Rob Watson | 97f4f9d636 |
|
@ -1,6 +1,6 @@
|
|||
local prettier = function()
|
||||
return {
|
||||
exe = vim.fn.getcwd() .. "/node_modules/.bin/prettier",
|
||||
exe = Get_project_node_modules_path() .. "/.bin/prettier",
|
||||
args = { "--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote" },
|
||||
stdin = true,
|
||||
}
|
||||
|
@ -22,6 +22,14 @@ local goimports = function()
|
|||
}
|
||||
end
|
||||
|
||||
local rustfmt = function()
|
||||
return {
|
||||
exe = "rustfmt",
|
||||
args = { "--edition", "2021" },
|
||||
stdin = true,
|
||||
}
|
||||
end
|
||||
|
||||
require("formatter").setup({
|
||||
log_level = vim.log.levels.INFO,
|
||||
filetype = {
|
||||
|
@ -29,6 +37,7 @@ require("formatter").setup({
|
|||
typescript = { prettier },
|
||||
typescriptreact = { prettier },
|
||||
go = { goimports },
|
||||
rust = { rustfmt },
|
||||
|
||||
-- https://github.com/JohnnyMorganz/StyLua
|
||||
-- cargo install stylua --features lua54
|
||||
|
@ -43,7 +52,7 @@ vim.api.nvim_exec2(
|
|||
[[
|
||||
augroup FormatAutogroup
|
||||
autocmd!
|
||||
autocmd BufWritePost *.js,*.ts,*.tsx,*.go,*.lua silent FormatWrite
|
||||
autocmd BufWritePost *.js,*.ts,*.tsx,*.go,*.lua,*.rs silent FormatWrite
|
||||
augroup END
|
||||
]],
|
||||
{ output = true }
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
-- Return the node_modules path for this project. If the project root contains a
|
||||
-- frontend/ directory, assume node_modules lives there.
|
||||
function Get_project_node_modules_path()
|
||||
local root_path = vim.fn.getcwd()
|
||||
local frontend_path = root_path .. "/frontend"
|
||||
local is_frontend = vim.fn.isdirectory(frontend_path) ~= 0
|
||||
local base_path = root_path
|
||||
if is_frontend then
|
||||
base_path = frontend_path
|
||||
end
|
||||
return base_path .. "/node_modules"
|
||||
end
|
||||
|
||||
-- Return the project's go module path from go.mod, or an empty string if the file cannot be read.
|
||||
function Get_project_go_module_path()
|
||||
local root_path = vim.fn.getcwd()
|
||||
|
|
|
@ -41,7 +41,7 @@ end
|
|||
-- Go
|
||||
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = false
|
||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
|
|
Loading…
Reference in New Issue