fix styling issues (#811)

This commit is contained in:
Abouzar Parvan 2021-07-09 16:37:25 +04:30 committed by GitHub
parent a9e7b6ff8c
commit 2866ba528c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 170 additions and 176 deletions

View file

@ -17,7 +17,7 @@ vim.api.nvim_set_keymap("t", "<Esc>", "<C-\\><C-n>", {silent = true, noremap = t
-- TODO fix this -- TODO fix this
-- resize with arrows -- resize with arrows
if vim.fn.has("mac") == 1 then if vim.fn.has "mac" == 1 then
vim.api.nvim_set_keymap("n", "<A-Up>", ":resize -2<CR>", { silent = true }) vim.api.nvim_set_keymap("n", "<A-Up>", ":resize -2<CR>", { silent = true })
vim.api.nvim_set_keymap("n", "<A-Down>", ":resize +2<CR>", { silent = true }) vim.api.nvim_set_keymap("n", "<A-Down>", ":resize +2<CR>", { silent = true })
vim.api.nvim_set_keymap("n", "<A-Left>", ":vertical resize -2<CR>", { silent = true }) vim.api.nvim_set_keymap("n", "<A-Left>", ":vertical resize -2<CR>", { silent = true })

View file

@ -1,6 +1,6 @@
-- TODO find correct root filetype -- TODO find correct root filetype
-- :LspInstall angular -- :LspInstall angular
require'lspconfig'.angularls.setup { require("lspconfig").angularls.setup {
cmd = { DATA_PATH .. "/lspinstall/angular/node_modules/@angular/language-server/bin/ngserver", "--stdio" }, cmd = { DATA_PATH .. "/lspinstall/angular/node_modules/@angular/language-server/bin/ngserver", "--stdio" },
on_attach = require'lsp'.common_on_attach, on_attach = require("lsp").common_on_attach,
} }

View file

@ -2,20 +2,20 @@
-- return -- return
-- end -- end
local nvim_lsp = require'lspconfig' local nvim_lsp = require "lspconfig"
local configs = require'lspconfig/configs' local configs = require "lspconfig/configs"
local capabilities = vim.lsp.protocol.make_client_capabilities() local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.snippetSupport = true
configs.emmet_ls = { configs.emmet_ls = {
default_config = { default_config = {
cmd = {'emmet-ls', '--stdio'}; cmd = { "emmet-ls", "--stdio" },
filetypes = {'html', 'css', 'javascript', 'typescript'}; filetypes = { "html", "css", "javascript", "typescript" },
root_dir = function() root_dir = function()
return vim.loop.cwd() return vim.loop.cwd()
end; end,
settings = {}; settings = {},
}; },
} }
nvim_lsp.emmet_ls.setup { nvim_lsp.emmet_ls.setup {

View file

@ -16,42 +16,36 @@ vim.fn.sign_define(
{ texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation" } { texthl = "LspDiagnosticsSignInformation", text = "", numhl = "LspDiagnosticsSignInformation" }
) )
vim.cmd("nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>") vim.cmd "nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>"
vim.cmd("nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>") vim.cmd "nnoremap <silent> gD <cmd>lua vim.lsp.buf.declaration()<CR>"
vim.cmd("nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>") vim.cmd "nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>"
vim.cmd("nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>") vim.cmd "nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>"
vim.cmd("nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>") vim.cmd "nnoremap <silent> K :lua vim.lsp.buf.hover()<CR>"
-- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>') -- vim.cmd('nnoremap <silent> <C-k> <cmd>lua vim.lsp.buf.signature_help()<CR>')
vim.cmd("nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<CR>") vim.cmd "nnoremap <silent> <C-p> :lua vim.lsp.diagnostic.goto_prev({popup_opts = {border = O.lsp.popup_border}})<CR>"
vim.cmd("nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<CR>") vim.cmd "nnoremap <silent> <C-n> :lua vim.lsp.diagnostic.goto_next({popup_opts = {border = O.lsp.popup_border}})<CR>"
-- scroll down hover doc or scroll in definition preview -- scroll down hover doc or scroll in definition preview
-- scroll up hover doc -- scroll up hover doc
vim.cmd('command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()') vim.cmd 'command! -nargs=0 LspVirtualTextToggle lua require("lsp/virtual_text").toggle()'
-- Set Default Prefix. -- Set Default Prefix.
-- Note: You can set a prefix per lsp server in the lv-globals.lua file -- Note: You can set a prefix per lsp server in the lv-globals.lua file
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
vim.lsp.diagnostic.on_publish_diagnostics, {
virtual_text = { virtual_text = {
prefix = "", prefix = "",
spacing = 0, spacing = 0,
}, },
signs = true, signs = true,
underline = true, underline = true,
} })
)
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
vim.lsp.handlers.hover, { border = O.lsp.popup_border,
border = O.lsp.popup_border })
}
)
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
vim.lsp.handlers.signature_help, { border = O.lsp.popup_border,
border = O.lsp.popup_border })
}
)
-- symbols for autocomplete -- symbols for autocomplete
vim.lsp.protocol.CompletionItemKind = { vim.lsp.protocol.CompletionItemKind = {
@ -79,7 +73,7 @@ vim.lsp.protocol.CompletionItemKind = {
" ﳤ (Struct)", " ﳤ (Struct)",
"  (Event)", "  (Event)",
"  (Operator)", "  (Operator)",
"  (TypeParameter)" "  (TypeParameter)",
} }
--[[ " autoformat --[[ " autoformat
@ -119,7 +113,7 @@ function lsp_config.tsserver_on_attach(client, bufnr)
-- lsp_config.common_on_attach(client, bufnr) -- lsp_config.common_on_attach(client, bufnr)
client.resolved_capabilities.document_formatting = false client.resolved_capabilities.document_formatting = false
local ts_utils = require("nvim-lsp-ts-utils") local ts_utils = require "nvim-lsp-ts-utils"
-- defaults -- defaults
ts_utils.setup { ts_utils.setup {
@ -160,12 +154,11 @@ function lsp_config.tsserver_on_attach(client, bufnr)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", {silent = true}) -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", ":TSLspImportAll<CR>", {silent = true})
end end
require("lv-utils").define_augroups {
require('lv-utils').define_augroups({
_general_lsp = { _general_lsp = {
{'FileType', 'lspinfo', 'nnoremap <silent> <buffer> q :q<CR>'}, { "FileType", "lspinfo", "nnoremap <silent> <buffer> q :q<CR>" },
},
} }
})
-- Use a loop to conveniently both setup defined servers -- Use a loop to conveniently both setup defined servers
-- and map buffer local keybindings when the language server attaches -- and map buffer local keybindings when the language server attaches

View file

@ -1,5 +1,5 @@
-- TODO what is a svelte filetype -- TODO what is a svelte filetype
require'lspconfig'.svelte.setup { require("lspconfig").svelte.setup {
cmd = { DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", "--stdio" }, cmd = { DATA_PATH .. "/lspinstall/svelte/node_modules/.bin/svelteserver", "--stdio" },
on_attach = require'lsp'.common_on_attach on_attach = require("lsp").common_on_attach,
} }

View file

@ -1,12 +1,13 @@
-- TODO what is a tailwindcss filetype -- TODO what is a tailwindcss filetype
local lspconfig = require 'lspconfig' local lspconfig = require "lspconfig"
lspconfig.tailwindcss.setup { lspconfig.tailwindcss.setup {
cmd = { cmd = {
"node", DATA_PATH .. "/lspinstall/tailwindcss/tailwindcss-intellisense/extension/dist/server/tailwindServer.js", "node",
"--stdio" DATA_PATH .. "/lspinstall/tailwindcss/tailwindcss-intellisense/extension/dist/server/tailwindServer.js",
"--stdio",
}, },
filetypes = O.lang.tailwindcss.filetypes, filetypes = O.lang.tailwindcss.filetypes,
root_dir = require("lspconfig/util").root_pattern("tailwind.config.js", "postcss.config.ts", ".postcssrc"), root_dir = require("lspconfig/util").root_pattern("tailwind.config.js", "postcss.config.ts", ".postcssrc"),
on_attach = require'lsp'.common_on_attach on_attach = require("lsp").common_on_attach,
} }

View file

@ -7,17 +7,17 @@ M.setup = function()
local prettier = { local prettier = {
formatCommand = "prettier --stdin-filepath ${INPUT}", formatCommand = "prettier --stdin-filepath ${INPUT}",
formatStdin = true formatStdin = true,
} }
if vim.fn.glob("node_modules/.bin/prettier") ~= "" then if vim.fn.glob "node_modules/.bin/prettier" ~= "" then
prettier = { prettier = {
formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}",
formatStdin = true formatStdin = true,
} }
end end
require"lspconfig".efm.setup { require("lspconfig").efm.setup {
-- init_options = {initializationOptions}, -- init_options = {initializationOptions},
cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" }, cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
init_options = { documentFormatting = true, codeAction = false }, init_options = { documentFormatting = true, codeAction = false },
@ -28,9 +28,9 @@ M.setup = function()
html = { prettier }, html = { prettier },
css = { prettier }, css = { prettier },
json = { prettier }, json = { prettier },
yaml = {prettier} yaml = { prettier },
} },
} },
} }
end end