refactor: remove unused plugins
This commit is contained in:
parent
76534ab4cb
commit
96db7b0430
22 changed files with 53 additions and 1150 deletions
|
|
@ -6,7 +6,6 @@ require("settings.devicons")
|
||||||
require("settings.treesitter")
|
require("settings.treesitter")
|
||||||
require("settings.nvim-tree")
|
require("settings.nvim-tree")
|
||||||
require("settings.pairs")
|
require("settings.pairs")
|
||||||
--require("settings.comment")
|
|
||||||
require("settings.indentline")
|
require("settings.indentline")
|
||||||
require("settings.project")
|
require("settings.project")
|
||||||
require("settings.dashboard")
|
require("settings.dashboard")
|
||||||
|
|
@ -26,3 +25,4 @@ require("telescope").load_extension("fzy_native")
|
||||||
require("impatient").enable_profile()
|
require("impatient").enable_profile()
|
||||||
require("nightfox")
|
require("nightfox")
|
||||||
require('Comment').setup()
|
require('Comment').setup()
|
||||||
|
require('vgit').setup()
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
local status_ok, comment = pcall(require, "Comment")
|
|
||||||
if not status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
comment.setup {
|
|
||||||
pre_hook = function(ctx)
|
|
||||||
local U = require "Comment.utils"
|
|
||||||
|
|
||||||
local location = nil
|
|
||||||
if ctx.ctype == U.ctype.block then
|
|
||||||
location = require("ts_context_commentstring.utils").get_cursor_location()
|
|
||||||
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
|
|
||||||
location = require("ts_context_commentstring.utils").get_visual_start_location()
|
|
||||||
end
|
|
||||||
|
|
||||||
return require("ts_context_commentstring.internal").calculate_commentstring {
|
|
||||||
key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
|
|
||||||
location = location,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
vim.cmd([[highlight TabLineSel guifg=#192330 guibg=112e54]])
|
|
||||||
vim.cmd([[highlight BufferDefaultCurrent guifg=#192330 guibg=112e54]])
|
|
||||||
|
|
@ -25,8 +25,12 @@ vim.g.indent_blankline_context_patterns = {
|
||||||
"class",
|
"class",
|
||||||
"return",
|
"return",
|
||||||
"function",
|
"function",
|
||||||
|
"def",
|
||||||
"method",
|
"method",
|
||||||
"^if",
|
"^if",
|
||||||
|
"^else",
|
||||||
|
"^else if",
|
||||||
|
"^elif",
|
||||||
"^while",
|
"^while",
|
||||||
"jsx_element",
|
"jsx_element",
|
||||||
"^for",
|
"^for",
|
||||||
|
|
|
||||||
|
|
@ -111,46 +111,3 @@ require("lspconfig")["hls"].setup({
|
||||||
--on_attach = on_attach,
|
--on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
|
||||||
--local status_ok2, lsp_installer = pcall(require, "mason")
|
|
||||||
--if not status_ok2 then
|
|
||||||
-- return
|
|
||||||
--end
|
|
||||||
--
|
|
||||||
--local servers = {"jdtls" , "sumneko_lua" , "texlab", "pyright" , "eslint_d" , "html" , "cssls" , "rust_analyzer" , "bashls" , "csharp_ls" , "sqls" , "clangd" }
|
|
||||||
--
|
|
||||||
--lsp_installer.setup {
|
|
||||||
-- ensure_installed = servers
|
|
||||||
--}
|
|
||||||
--
|
|
||||||
--for _, server in pairs(servers) do
|
|
||||||
-- local opts = {
|
|
||||||
-- on_attach = require("settings.lsp_config.handlers").on_attach,
|
|
||||||
-- capabilities = require("settings.lsp_config.handlers").capabilities,
|
|
||||||
-- }
|
|
||||||
-- local has_custom_opts, server_custom_opts = pcall(require, "settings.lsp_config." .. server)
|
|
||||||
-- if has_custom_opts then
|
|
||||||
-- opts = vim.tbl_deep_extend("force", server_custom_opts, opts)
|
|
||||||
-- end
|
|
||||||
-- lspconfig[server].setup(opts)
|
|
||||||
--end
|
|
||||||
--
|
|
||||||
--
|
|
||||||
--local null_ls_status_ok, null_ls = pcall(require, "null-ls")
|
|
||||||
--if not null_ls_status_ok then
|
|
||||||
-- return
|
|
||||||
--end
|
|
||||||
--
|
|
||||||
---- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
|
||||||
--local formatting = null_ls.builtins.formatting
|
|
||||||
---- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
|
||||||
--local diagnostics = null_ls.builtins.diagnostics
|
|
||||||
--
|
|
||||||
--null_ls.setup({
|
|
||||||
-- debug = false,
|
|
||||||
-- sources = {
|
|
||||||
-- formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
|
|
||||||
-- formatting.black.with({ extra_args = { "--fast" } }),
|
|
||||||
-- formatting.stylua,
|
|
||||||
-- -- diagnostics.flake8
|
|
||||||
-- },
|
|
||||||
--})
|
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
local bin_name = 'bash-language-server'
|
|
||||||
local cmd = { bin_name, 'start' }
|
|
||||||
|
|
||||||
if vim.fn.has 'win32' == 1 then
|
|
||||||
cmd = { 'cmd.exe', '/C', bin_name, 'start' }
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = cmd,
|
|
||||||
cmd_env = {
|
|
||||||
-- Prevent recursive scanning which will cause issues when opening a file
|
|
||||||
-- directly in the home directory (e.g. ~/foo.sh).
|
|
||||||
--
|
|
||||||
-- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
|
|
||||||
GLOB_PATTERN = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
|
|
||||||
},
|
|
||||||
filetypes = { 'sh' },
|
|
||||||
root_dir = util.find_git_ancestor,
|
|
||||||
single_file_support = true,
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/mads-hartmann/bash-language-server
|
|
||||||
`bash-language-server` can be installed via `npm`:
|
|
||||||
```sh
|
|
||||||
npm i -g bash-language-server
|
|
||||||
```
|
|
||||||
Language server for bash, written using tree sitter in typescript.
|
|
||||||
]],
|
|
||||||
default_config = {
|
|
||||||
root_dir = [[util.find_git_ancestor]],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
-- https://clangd.llvm.org/extensions.html#switch-between-sourceheader
|
|
||||||
local function switch_source_header(bufnr)
|
|
||||||
bufnr = util.validate_bufnr(bufnr)
|
|
||||||
local clangd_client = util.get_active_client_by_name(bufnr, 'clangd')
|
|
||||||
local params = { uri = vim.uri_from_bufnr(bufnr) }
|
|
||||||
if clangd_client then
|
|
||||||
clangd_client.request('textDocument/switchSourceHeader', params, function(err, result)
|
|
||||||
if err then
|
|
||||||
error(tostring(err))
|
|
||||||
end
|
|
||||||
if not result then
|
|
||||||
print 'Corresponding file cannot be determined'
|
|
||||||
return
|
|
||||||
end
|
|
||||||
vim.api.nvim_command('edit ' .. vim.uri_to_fname(result))
|
|
||||||
end, bufnr)
|
|
||||||
else
|
|
||||||
print 'method textDocument/switchSourceHeader is not supported by any servers active on the current buffer'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local root_files = {
|
|
||||||
'.clangd',
|
|
||||||
'.clang-tidy',
|
|
||||||
'.clang-format',
|
|
||||||
'compile_commands.json',
|
|
||||||
'compile_flags.txt',
|
|
||||||
'configure.ac', -- AutoTools
|
|
||||||
}
|
|
||||||
|
|
||||||
local default_capabilities = {
|
|
||||||
textDocument = {
|
|
||||||
completion = {
|
|
||||||
editsNearCursor = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
offsetEncoding = { 'utf-8', 'utf-16' },
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = { 'clangd' },
|
|
||||||
filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto' },
|
|
||||||
root_dir = function(fname)
|
|
||||||
return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname)
|
|
||||||
end,
|
|
||||||
single_file_support = true,
|
|
||||||
capabilities = default_capabilities,
|
|
||||||
},
|
|
||||||
commands = {
|
|
||||||
ClangdSwitchSourceHeader = {
|
|
||||||
function()
|
|
||||||
switch_source_header(0)
|
|
||||||
end,
|
|
||||||
description = 'Switch between source/header',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://clangd.llvm.org/installation.html
|
|
||||||
- **NOTE:** Clang >= 11 is recommended! See [#23](https://github.com/neovim/nvim-lsp/issues/23).
|
|
||||||
- If `compile_commands.json` lives in a build directory, you should
|
|
||||||
symlink it to the root of your source tree.
|
|
||||||
```
|
|
||||||
ln -s /path/to/myproject/build/compile_commands.json /path/to/myproject/
|
|
||||||
```
|
|
||||||
- clangd relies on a [JSON compilation database](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
|
||||||
specified as compile_commands.json, see https://clangd.llvm.org/installation#compile_commandsjson
|
|
||||||
]],
|
|
||||||
default_config = {
|
|
||||||
root_dir = [[
|
|
||||||
root_pattern(
|
|
||||||
'.clangd',
|
|
||||||
'.clang-tidy',
|
|
||||||
'.clang-format',
|
|
||||||
'compile_commands.json',
|
|
||||||
'compile_flags.txt',
|
|
||||||
'configure.ac',
|
|
||||||
'.git'
|
|
||||||
)
|
|
||||||
]],
|
|
||||||
capabilities = [[default capabilities, with offsetEncoding utf-8]],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = { 'csharp-ls' },
|
|
||||||
root_dir = util.root_pattern('*.sln', '*.csproj', '*.fsproj', '.git'),
|
|
||||||
filetypes = { 'cs' },
|
|
||||||
init_options = {
|
|
||||||
AutomaticWorkspaceInit = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/razzmatazz/csharp-language-server
|
|
||||||
Language Server for C#.
|
|
||||||
csharp-ls requires the [dotnet-sdk](https://dotnet.microsoft.com/download) to be installed.
|
|
||||||
The preferred way to install csharp-ls is with `dotnet tool install --global csharp-ls`.
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
local bin_name = 'vscode-css-language-server'
|
|
||||||
local cmd = { bin_name, '--stdio' }
|
|
||||||
|
|
||||||
if vim.fn.has 'win32' == 1 then
|
|
||||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = cmd,
|
|
||||||
filetypes = { 'css', 'scss', 'less' },
|
|
||||||
root_dir = util.root_pattern('package.json', '.git'),
|
|
||||||
single_file_support = true,
|
|
||||||
settings = {
|
|
||||||
css = { validate = true },
|
|
||||||
scss = { validate = true },
|
|
||||||
less = { validate = true },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
|
||||||
`css-languageserver` can be installed via `npm`:
|
|
||||||
```sh
|
|
||||||
npm i -g vscode-langservers-extracted
|
|
||||||
```
|
|
||||||
Neovim does not currently include built-in snippets. `vscode-css-language-server` only provides completions when snippet support is enabled. To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup.
|
|
||||||
```lua
|
|
||||||
--Enable (broadcasting) snippet capability for completion
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
||||||
require'lspconfig'.cssls.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
]],
|
|
||||||
default_config = {
|
|
||||||
root_dir = [[root_pattern("package.json", ".git") or bufdir]],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,165 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
local lsp = vim.lsp
|
|
||||||
|
|
||||||
local function fix_all(opts)
|
|
||||||
opts = opts or {}
|
|
||||||
|
|
||||||
local eslint_lsp_client = util.get_active_client_by_name(opts.bufnr, 'eslint')
|
|
||||||
if eslint_lsp_client == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local request
|
|
||||||
if opts.sync then
|
|
||||||
request = function(bufnr, method, params)
|
|
||||||
eslint_lsp_client.request_sync(method, params, nil, bufnr)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
request = function(bufnr, method, params)
|
|
||||||
eslint_lsp_client.request(method, params, nil, bufnr)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local bufnr = util.validate_bufnr(opts.bufnr or 0)
|
|
||||||
request(0, 'workspace/executeCommand', {
|
|
||||||
command = 'eslint.applyAllFixes',
|
|
||||||
arguments = {
|
|
||||||
{
|
|
||||||
uri = vim.uri_from_bufnr(bufnr),
|
|
||||||
version = lsp.util.buf_versions[bufnr],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local bin_name = 'vscode-eslint-language-server'
|
|
||||||
local cmd = { bin_name, '--stdio' }
|
|
||||||
|
|
||||||
if vim.fn.has 'win32' == 1 then
|
|
||||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = cmd,
|
|
||||||
filetypes = {
|
|
||||||
'javascript',
|
|
||||||
'javascriptreact',
|
|
||||||
'javascript.jsx',
|
|
||||||
'typescript',
|
|
||||||
'typescriptreact',
|
|
||||||
'typescript.tsx',
|
|
||||||
'vue',
|
|
||||||
},
|
|
||||||
-- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats
|
|
||||||
root_dir = util.root_pattern(
|
|
||||||
'.eslintrc',
|
|
||||||
'.eslintrc.js',
|
|
||||||
'.eslintrc.cjs',
|
|
||||||
'.eslintrc.yaml',
|
|
||||||
'.eslintrc.yml',
|
|
||||||
'.eslintrc.json',
|
|
||||||
'package.json'
|
|
||||||
),
|
|
||||||
-- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
|
|
||||||
settings = {
|
|
||||||
validate = 'on',
|
|
||||||
packageManager = 'npm',
|
|
||||||
useESLintClass = false,
|
|
||||||
codeActionOnSave = {
|
|
||||||
enable = false,
|
|
||||||
mode = 'all',
|
|
||||||
},
|
|
||||||
format = true,
|
|
||||||
quiet = false,
|
|
||||||
onIgnoredFiles = 'off',
|
|
||||||
rulesCustomizations = {},
|
|
||||||
run = 'onType',
|
|
||||||
-- nodePath configures the directory in which the eslint server should start its node_modules resolution.
|
|
||||||
-- This path is relative to the workspace folder (root dir) of the server instance.
|
|
||||||
nodePath = '',
|
|
||||||
-- use the workspace folder location or the file location (if no workspace folder is open) as the working directory
|
|
||||||
workingDirectory = { mode = 'location' },
|
|
||||||
codeAction = {
|
|
||||||
disableRuleComment = {
|
|
||||||
enable = true,
|
|
||||||
location = 'separateLine',
|
|
||||||
},
|
|
||||||
showDocumentation = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
on_new_config = function(config, new_root_dir)
|
|
||||||
-- The "workspaceFolder" is a VSCode concept. It limits how far the
|
|
||||||
-- server will traverse the file system when locating the ESLint config
|
|
||||||
-- file (e.g., .eslintrc).
|
|
||||||
config.settings.workspaceFolder = {
|
|
||||||
uri = new_root_dir,
|
|
||||||
name = vim.fn.fnamemodify(new_root_dir, ':t'),
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Support Yarn2 (PnP) projects
|
|
||||||
local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs')
|
|
||||||
local pnp_js = util.path.join(new_root_dir, '.pnp.js')
|
|
||||||
if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then
|
|
||||||
config.cmd = vim.list_extend({ 'yarn', 'exec' }, cmd)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
handlers = {
|
|
||||||
['eslint/openDoc'] = function(_, result)
|
|
||||||
if not result then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local sysname = vim.loop.os_uname().sysname
|
|
||||||
if sysname:match 'Windows' then
|
|
||||||
os.execute(string.format('start %q', result.url))
|
|
||||||
elseif sysname:match 'Linux' then
|
|
||||||
os.execute(string.format('xdg-open %q', result.url))
|
|
||||||
else
|
|
||||||
os.execute(string.format('open %q', result.url))
|
|
||||||
end
|
|
||||||
return {}
|
|
||||||
end,
|
|
||||||
['eslint/confirmESLintExecution'] = function(_, result)
|
|
||||||
if not result then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return 4 -- approved
|
|
||||||
end,
|
|
||||||
['eslint/probeFailed'] = function()
|
|
||||||
vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN)
|
|
||||||
return {}
|
|
||||||
end,
|
|
||||||
['eslint/noLibrary'] = function()
|
|
||||||
vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN)
|
|
||||||
return {}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
commands = {
|
|
||||||
EslintFixAll = {
|
|
||||||
function()
|
|
||||||
fix_all { sync = true, bufnr = 0 }
|
|
||||||
end,
|
|
||||||
description = 'Fix all eslint problems for this buffer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
|
||||||
`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript.
|
|
||||||
It can be installed via `npm`:
|
|
||||||
```sh
|
|
||||||
npm i -g vscode-langservers-extracted
|
|
||||||
```
|
|
||||||
`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save:
|
|
||||||
```vim
|
|
||||||
autocmd BufWritePre *.tsx,*.ts,*.jsx,*.js EslintFixAll
|
|
||||||
```
|
|
||||||
See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options.
|
|
||||||
Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary`
|
|
||||||
Additional messages you can handle: `eslint/noConfig`
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,165 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
local lsp = vim.lsp
|
|
||||||
|
|
||||||
local function fix_all(opts)
|
|
||||||
opts = opts or {}
|
|
||||||
|
|
||||||
local eslint_lsp_client = util.get_active_client_by_name(opts.bufnr, 'eslint')
|
|
||||||
if eslint_lsp_client == nil then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local request
|
|
||||||
if opts.sync then
|
|
||||||
request = function(bufnr, method, params)
|
|
||||||
eslint_lsp_client.request_sync(method, params, nil, bufnr)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
request = function(bufnr, method, params)
|
|
||||||
eslint_lsp_client.request(method, params, nil, bufnr)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local bufnr = util.validate_bufnr(opts.bufnr or 0)
|
|
||||||
request(0, 'workspace/executeCommand', {
|
|
||||||
command = 'eslint.applyAllFixes',
|
|
||||||
arguments = {
|
|
||||||
{
|
|
||||||
uri = vim.uri_from_bufnr(bufnr),
|
|
||||||
version = lsp.util.buf_versions[bufnr],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local bin_name = 'vscode-eslint-language-server'
|
|
||||||
local cmd = { bin_name, '--stdio' }
|
|
||||||
|
|
||||||
if vim.fn.has 'win32' == 1 then
|
|
||||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = cmd,
|
|
||||||
filetypes = {
|
|
||||||
'javascript',
|
|
||||||
'javascriptreact',
|
|
||||||
'javascript.jsx',
|
|
||||||
'typescript',
|
|
||||||
'typescriptreact',
|
|
||||||
'typescript.tsx',
|
|
||||||
'vue',
|
|
||||||
},
|
|
||||||
-- https://eslint.org/docs/user-guide/configuring/configuration-files#configuration-file-formats
|
|
||||||
root_dir = util.root_pattern(
|
|
||||||
'.eslintrc',
|
|
||||||
'.eslintrc.js',
|
|
||||||
'.eslintrc.cjs',
|
|
||||||
'.eslintrc.yaml',
|
|
||||||
'.eslintrc.yml',
|
|
||||||
'.eslintrc.json',
|
|
||||||
'package.json'
|
|
||||||
),
|
|
||||||
-- Refer to https://github.com/Microsoft/vscode-eslint#settings-options for documentation.
|
|
||||||
settings = {
|
|
||||||
validate = 'on',
|
|
||||||
packageManager = 'npm',
|
|
||||||
useESLintClass = false,
|
|
||||||
codeActionOnSave = {
|
|
||||||
enable = false,
|
|
||||||
mode = 'all',
|
|
||||||
},
|
|
||||||
format = true,
|
|
||||||
quiet = false,
|
|
||||||
onIgnoredFiles = 'off',
|
|
||||||
rulesCustomizations = {},
|
|
||||||
run = 'onType',
|
|
||||||
-- nodePath configures the directory in which the eslint server should start its node_modules resolution.
|
|
||||||
-- This path is relative to the workspace folder (root dir) of the server instance.
|
|
||||||
nodePath = '',
|
|
||||||
-- use the workspace folder location or the file location (if no workspace folder is open) as the working directory
|
|
||||||
workingDirectory = { mode = 'location' },
|
|
||||||
codeAction = {
|
|
||||||
disableRuleComment = {
|
|
||||||
enable = true,
|
|
||||||
location = 'separateLine',
|
|
||||||
},
|
|
||||||
showDocumentation = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
on_new_config = function(config, new_root_dir)
|
|
||||||
-- The "workspaceFolder" is a VSCode concept. It limits how far the
|
|
||||||
-- server will traverse the file system when locating the ESLint config
|
|
||||||
-- file (e.g., .eslintrc).
|
|
||||||
config.settings.workspaceFolder = {
|
|
||||||
uri = new_root_dir,
|
|
||||||
name = vim.fn.fnamemodify(new_root_dir, ':t'),
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Support Yarn2 (PnP) projects
|
|
||||||
local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs')
|
|
||||||
local pnp_js = util.path.join(new_root_dir, '.pnp.js')
|
|
||||||
if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then
|
|
||||||
config.cmd = vim.list_extend({ 'yarn', 'exec' }, cmd)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
handlers = {
|
|
||||||
['eslint/openDoc'] = function(_, result)
|
|
||||||
if not result then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local sysname = vim.loop.os_uname().sysname
|
|
||||||
if sysname:match 'Windows' then
|
|
||||||
os.execute(string.format('start %q', result.url))
|
|
||||||
elseif sysname:match 'Linux' then
|
|
||||||
os.execute(string.format('xdg-open %q', result.url))
|
|
||||||
else
|
|
||||||
os.execute(string.format('open %q', result.url))
|
|
||||||
end
|
|
||||||
return {}
|
|
||||||
end,
|
|
||||||
['eslint/confirmESLintExecution'] = function(_, result)
|
|
||||||
if not result then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
return 4 -- approved
|
|
||||||
end,
|
|
||||||
['eslint/probeFailed'] = function()
|
|
||||||
vim.notify('[lspconfig] ESLint probe failed.', vim.log.levels.WARN)
|
|
||||||
return {}
|
|
||||||
end,
|
|
||||||
['eslint/noLibrary'] = function()
|
|
||||||
vim.notify('[lspconfig] Unable to find ESLint library.', vim.log.levels.WARN)
|
|
||||||
return {}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
commands = {
|
|
||||||
EslintFixAll = {
|
|
||||||
function()
|
|
||||||
fix_all { sync = true, bufnr = 0 }
|
|
||||||
end,
|
|
||||||
description = 'Fix all eslint problems for this buffer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
|
||||||
`vscode-eslint-language-server` is a linting engine for JavaScript / Typescript.
|
|
||||||
It can be installed via `npm`:
|
|
||||||
```sh
|
|
||||||
npm i -g vscode-langservers-extracted
|
|
||||||
```
|
|
||||||
`vscode-eslint-language-server` provides an `EslintFixAll` command that can be used to format a document on save:
|
|
||||||
```vim
|
|
||||||
autocmd BufWritePre *.tsx,*.ts,*.jsx,*.js EslintFixAll
|
|
||||||
```
|
|
||||||
See [vscode-eslint](https://github.com/microsoft/vscode-eslint/blob/55871979d7af184bf09af491b6ea35ebd56822cf/server/src/eslintServer.ts#L216-L229) for configuration options.
|
|
||||||
Messages handled in lspconfig: `eslint/openDoc`, `eslint/confirmESLintExecution`, `eslint/probeFailed`, `eslint/noLibrary`
|
|
||||||
Additional messages you can handle: `eslint/noConfig`
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
local M = {}
|
|
||||||
|
|
||||||
-- TODO: backfill this to template
|
|
||||||
M.setup = function()
|
|
||||||
local signs = {
|
|
||||||
{ name = "DiagnosticSignError", text = "" },
|
|
||||||
{ name = "DiagnosticSignWarn", text = "" },
|
|
||||||
{ name = "DiagnosticSignHint", text = "" },
|
|
||||||
{ name = "DiagnosticSignInfo", text = "" },
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, sign in ipairs(signs) do
|
|
||||||
vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
|
|
||||||
end
|
|
||||||
|
|
||||||
local config = {
|
|
||||||
-- disable virtual text
|
|
||||||
virtual_text = false,
|
|
||||||
-- show signs
|
|
||||||
signs = {
|
|
||||||
active = signs,
|
|
||||||
},
|
|
||||||
update_in_insert = true,
|
|
||||||
underline = true,
|
|
||||||
severity_sort = true,
|
|
||||||
float = {
|
|
||||||
focusable = false,
|
|
||||||
style = "minimal",
|
|
||||||
border = "rounded",
|
|
||||||
source = "always",
|
|
||||||
header = "",
|
|
||||||
prefix = "",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.diagnostic.config(config)
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
|
||||||
border = "rounded",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
|
||||||
border = "rounded",
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local function lsp_highlight_document(client)
|
|
||||||
-- Set autocommands conditional on server_capabilities
|
|
||||||
local status_ok, illuminate = pcall(require, "illuminate")
|
|
||||||
if not status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
illuminate.on_attach(client)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function lsp_keymaps(bufnr)
|
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(
|
|
||||||
bufnr,
|
|
||||||
"n",
|
|
||||||
"gl",
|
|
||||||
'<cmd>lua vim.diagnostic.open_float({ border = "rounded" })<CR>',
|
|
||||||
opts
|
|
||||||
)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
|
|
||||||
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.format { async = true }' ]]
|
|
||||||
end
|
|
||||||
|
|
||||||
M.on_attach = function(client, bufnr)
|
|
||||||
-- vim.notify(client.name .. " starting...")
|
|
||||||
-- TODO: refactor this into a method that checks if string in list
|
|
||||||
if client.name == "tsserver" then
|
|
||||||
client.resolved_capabilities.document_formatting = false
|
|
||||||
end
|
|
||||||
lsp_keymaps(bufnr)
|
|
||||||
lsp_highlight_document(client)
|
|
||||||
end
|
|
||||||
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
|
|
||||||
local status_ok, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
|
|
||||||
if not status_ok then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
M.capabilities = cmp_nvim_lsp.update_capabilities(capabilities)
|
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
local bin_name = 'vscode-html-language-server'
|
|
||||||
local cmd = { bin_name, '--stdio' }
|
|
||||||
|
|
||||||
if vim.fn.has 'win32' == 1 then
|
|
||||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = cmd,
|
|
||||||
filetypes = { 'html' },
|
|
||||||
root_dir = util.root_pattern('package.json', '.git'),
|
|
||||||
single_file_support = true,
|
|
||||||
settings = {},
|
|
||||||
init_options = {
|
|
||||||
provideFormatter = true,
|
|
||||||
embeddedLanguages = { css = true, javascript = true },
|
|
||||||
configurationSection = { 'html', 'css', 'javascript' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/hrsh7th/vscode-langservers-extracted
|
|
||||||
`vscode-html-language-server` can be installed via `npm`:
|
|
||||||
```sh
|
|
||||||
npm i -g vscode-langservers-extracted
|
|
||||||
```
|
|
||||||
Neovim does not currently include built-in snippets. `vscode-html-language-server` only provides completions when snippet support is enabled.
|
|
||||||
To enable completion, install a snippet plugin and add the following override to your language client capabilities during setup.
|
|
||||||
The code-formatting feature of the lsp can be controlled with the `provideFormatter` option.
|
|
||||||
```lua
|
|
||||||
--Enable (broadcasting) snippet capability for completion
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
||||||
require'lspconfig'.html.setup {
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
return {
|
|
||||||
settings = {
|
|
||||||
|
|
||||||
java = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
library = {
|
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
||||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
local bin_name = 'pyright-langserver'
|
|
||||||
local cmd = { bin_name, '--stdio' }
|
|
||||||
|
|
||||||
if vim.fn.has 'win32' == 1 then
|
|
||||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
|
||||||
end
|
|
||||||
|
|
||||||
local root_files = {
|
|
||||||
'pyproject.toml',
|
|
||||||
'setup.py',
|
|
||||||
'setup.cfg',
|
|
||||||
'requirements.txt',
|
|
||||||
'Pipfile',
|
|
||||||
'pyrightconfig.json',
|
|
||||||
}
|
|
||||||
|
|
||||||
local function organize_imports()
|
|
||||||
local params = {
|
|
||||||
command = 'pyright.organizeimports',
|
|
||||||
arguments = { vim.uri_from_bufnr(0) },
|
|
||||||
}
|
|
||||||
vim.lsp.buf.execute_command(params)
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = cmd,
|
|
||||||
filetypes = { 'python' },
|
|
||||||
root_dir = util.root_pattern(unpack(root_files)),
|
|
||||||
single_file_support = true,
|
|
||||||
settings = {
|
|
||||||
python = {
|
|
||||||
analysis = {
|
|
||||||
autoSearchPaths = true,
|
|
||||||
useLibraryCodeForTypes = true,
|
|
||||||
diagnosticMode = 'workspace',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
commands = {
|
|
||||||
PyrightOrganizeImports = {
|
|
||||||
organize_imports,
|
|
||||||
description = 'Organize Imports',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/microsoft/pyright
|
|
||||||
`pyright`, a static type checker and language server for python
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
local function reload_workspace(bufnr)
|
|
||||||
bufnr = util.validate_bufnr(bufnr)
|
|
||||||
vim.lsp.buf_request(bufnr, 'rust-analyzer/reloadWorkspace', nil, function(err)
|
|
||||||
if err then
|
|
||||||
error(tostring(err))
|
|
||||||
end
|
|
||||||
vim.notify 'Cargo workspace reloaded'
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = { 'rust-analyzer' },
|
|
||||||
filetypes = { 'rust' },
|
|
||||||
root_dir = function(fname)
|
|
||||||
local cargo_crate_dir = util.root_pattern 'Cargo.toml'(fname)
|
|
||||||
local cmd = { 'cargo', 'metadata', '--no-deps', '--format-version', '1' }
|
|
||||||
if cargo_crate_dir ~= nil then
|
|
||||||
cmd[#cmd + 1] = '--manifest-path'
|
|
||||||
cmd[#cmd + 1] = util.path.join(cargo_crate_dir, 'Cargo.toml')
|
|
||||||
end
|
|
||||||
local cargo_metadata = ''
|
|
||||||
local cargo_metadata_err = ''
|
|
||||||
local cm = vim.fn.jobstart(cmd, {
|
|
||||||
on_stdout = function(_, d, _)
|
|
||||||
cargo_metadata = table.concat(d, '\n')
|
|
||||||
end,
|
|
||||||
on_stderr = function(_, d, _)
|
|
||||||
cargo_metadata_err = table.concat(d, '\n')
|
|
||||||
end,
|
|
||||||
stdout_buffered = true,
|
|
||||||
stderr_buffered = true,
|
|
||||||
})
|
|
||||||
if cm > 0 then
|
|
||||||
cm = vim.fn.jobwait({ cm })[1]
|
|
||||||
else
|
|
||||||
cm = -1
|
|
||||||
end
|
|
||||||
local cargo_workspace_dir = nil
|
|
||||||
if cm == 0 then
|
|
||||||
cargo_workspace_dir = vim.json.decode(cargo_metadata)['workspace_root']
|
|
||||||
else
|
|
||||||
vim.notify(
|
|
||||||
string.format('[lspconfig] cmd (%q) failed:\n%s', table.concat(cmd, ' '), cargo_metadata_err),
|
|
||||||
vim.log.levels.WARN
|
|
||||||
)
|
|
||||||
end
|
|
||||||
return util.path.sanitize(cargo_workspace_dir)
|
|
||||||
or cargo_crate_dir
|
|
||||||
or util.root_pattern 'rust-project.json'(fname)
|
|
||||||
or util.find_git_ancestor(fname)
|
|
||||||
end,
|
|
||||||
settings = {
|
|
||||||
['rust-analyzer'] = {},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
commands = {
|
|
||||||
CargoReload = {
|
|
||||||
function()
|
|
||||||
reload_workspace(0)
|
|
||||||
end,
|
|
||||||
description = 'Reload current cargo workspace',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/rust-analyzer/rust-analyzer
|
|
||||||
rust-analyzer (aka rls 2.0), a language server for Rust
|
|
||||||
See [docs](https://github.com/rust-analyzer/rust-analyzer/tree/master/docs/user#settings) for extra settings.
|
|
||||||
]],
|
|
||||||
default_config = {
|
|
||||||
root_dir = [[root_pattern("Cargo.toml", "rust-project.json")]],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
cmd = { 'sqls' },
|
|
||||||
filetypes = { 'sql', 'mysql' },
|
|
||||||
root_dir = util.root_pattern 'config.yml',
|
|
||||||
single_file_support = true,
|
|
||||||
settings = {},
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/lighttiger2505/sqls
|
|
||||||
```lua
|
|
||||||
require'lspconfig'.sqls.setup{
|
|
||||||
cmd = {"path/to/command", "-config", "path/to/config.yml"};
|
|
||||||
...
|
|
||||||
}
|
|
||||||
```
|
|
||||||
Sqls can be installed via `go get github.com/lighttiger2505/sqls`. Instructions for compiling Sqls from the source can be found at [lighttiger2505/sqls](https://github.com/lighttiger2505/sqls).
|
|
||||||
]],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
return {
|
|
||||||
settings = {
|
|
||||||
|
|
||||||
Lua = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
library = {
|
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
||||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
return {
|
|
||||||
settings = {
|
|
||||||
|
|
||||||
latex = {
|
|
||||||
diagnostics = {
|
|
||||||
globals = { "vim" },
|
|
||||||
},
|
|
||||||
workspace = {
|
|
||||||
library = {
|
|
||||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
|
||||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
local util = require 'lspconfig.util'
|
|
||||||
|
|
||||||
local bin_name = 'typescript-language-server'
|
|
||||||
local cmd = { bin_name, '--stdio' }
|
|
||||||
|
|
||||||
if vim.fn.has 'win32' == 1 then
|
|
||||||
cmd = { 'cmd.exe', '/C', bin_name, '--stdio' }
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
|
||||||
default_config = {
|
|
||||||
init_options = { hostInfo = 'neovim' },
|
|
||||||
cmd = cmd,
|
|
||||||
filetypes = {
|
|
||||||
'javascript',
|
|
||||||
'javascriptreact',
|
|
||||||
'javascript.jsx',
|
|
||||||
'typescript',
|
|
||||||
'typescriptreact',
|
|
||||||
'typescript.tsx',
|
|
||||||
},
|
|
||||||
root_dir = function(fname)
|
|
||||||
return util.root_pattern 'tsconfig.json'(fname)
|
|
||||||
or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
docs = {
|
|
||||||
description = [[
|
|
||||||
https://github.com/theia-ide/typescript-language-server
|
|
||||||
`typescript-language-server` depends on `typescript`. Both packages can be installed via `npm`:
|
|
||||||
```sh
|
|
||||||
npm install -g typescript typescript-language-server
|
|
||||||
```
|
|
||||||
To configure typescript language server, add a
|
|
||||||
[`tsconfig.json`](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) or
|
|
||||||
[`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your
|
|
||||||
project.
|
|
||||||
Here's an example that disables type checking in JavaScript files.
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es6",
|
|
||||||
"checkJs": false
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
]],
|
|
||||||
default_config = {
|
|
||||||
root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +1,52 @@
|
||||||
local Plug = vim.fn["plug#"]
|
local Plug = vim.fn["plug#"]
|
||||||
vim.call("plug#begin", "~/.config/nvim/plugged")
|
vim.call("plug#begin", "~/.config/nvim/plugged")
|
||||||
Plug("folke/twilight.nvim")
|
|
||||||
Plug("nvim-lua/popup.nvim") -- An implementation of the Popup API from vim in Neovim
|
Plug("nvim-lua/popup.nvim") -- An implementation of the Popup API from vim in Neovim
|
||||||
Plug("nvim-lua/plenary.nvim") -- Useful lua functions used ny lots of plugins
|
Plug("nvim-lua/plenary.nvim") -- Useful lua functions used ny lots of plugins
|
||||||
Plug("EdenEast/nightfox.nvim")
|
Plug("EdenEast/nightfox.nvim") -- dark theme
|
||||||
Plug("kyazdani42/nvim-web-devicons")
|
Plug("kyazdani42/nvim-web-devicons") -- icons
|
||||||
Plug("feline-nvim/feline.nvim")
|
Plug("feline-nvim/feline.nvim") -- bottom bar
|
||||||
Plug("lewis6991/gitsigns.nvim")
|
Plug("lewis6991/gitsigns.nvim") -- git signs on the bar and on the left
|
||||||
Plug("tanvirtin/vgit.nvim")
|
Plug("tanvirtin/vgit.nvim") -- git plugin
|
||||||
Plug("nvim-lua/plenary.nvim")
|
Plug("nvim-lua/plenary.nvim") -- library, don't delete
|
||||||
Plug("antoinemadec/FixCursorHold.nvim")
|
Plug("williamboman/mason.nvim") -- lsp and dap
|
||||||
Plug("lambdalisue/fern.vim")
|
Plug("williamboman/mason-lspconfig.nvim") -- lsp to mason bridge
|
||||||
Plug("williamboman/mason.nvim")
|
Plug("neovim/nvim-lspconfig") -- nvim lsp
|
||||||
Plug("williamboman/mason-lspconfig.nvim")
|
Plug("jose-elias-alvarez/null-ls.nvim") -- enables formatters
|
||||||
Plug("neovim/nvim-lspconfig")
|
Plug("jayp0521/mason-null-ls.nvim") -- mason to formatter
|
||||||
Plug("jose-elias-alvarez/null-ls.nvim")
|
Plug("mfussenegger/nvim-dap") -- debugging capabilities
|
||||||
Plug("jayp0521/mason-null-ls.nvim")
|
Plug("rcarriga/nvim-dap-ui") -- debug ui
|
||||||
Plug("mfussenegger/nvim-dap")
|
Plug("theHamsta/nvim-dap-virtual-text") -- more debug ui
|
||||||
Plug("rcarriga/nvim-dap-ui")
|
Plug("jayp0521/mason-nvim-dap.nvim") -- debug mason bridge
|
||||||
Plug("theHamsta/nvim-dap-virtual-text")
|
Plug("nvim-treesitter/nvim-treesitter",
|
||||||
Plug("jayp0521/mason-nvim-dap.nvim")
|
{ ["do"] = vim.fn[":TSUpdate"] }) -- syntax colors
|
||||||
Plug("nvim-treesitter/nvim-treesitter", { ["do"] = vim.fn[":TSUpdate"] })
|
Plug("hrsh7th/nvim-cmp") -- completions
|
||||||
Plug("hrsh7th/nvim-cmp")
|
Plug("hrsh7th/cmp-nvim-lsp") -- lsp integration with completions
|
||||||
Plug("hrsh7th/cmp-nvim-lsp")
|
Plug("hrsh7th/cmp-buffer") -- buffer completion
|
||||||
Plug("hrsh7th/cmp-buffer")
|
Plug("hrsh7th/cmp-path") -- path completion
|
||||||
Plug("hrsh7th/cmp-path")
|
Plug("hrsh7th/cmp-cmdline") -- command completion
|
||||||
Plug("hrsh7th/cmp-cmdline")
|
Plug("f3fora/cmp-spell") -- spelling completion
|
||||||
Plug("f3fora/cmp-spell")
|
Plug("saadparwaiz1/cmp_luasnip") -- snip completion
|
||||||
Plug("saadparwaiz1/cmp_luasnip")
|
Plug("L3MON4D3/LuaSnip") -- snippet plugin
|
||||||
Plug("L3MON4D3/LuaSnip")
|
Plug("kyazdani42/nvim-tree.lua") -- file viewer on the right
|
||||||
Plug("MarcWeber/vim-addon-mw-utils")
|
Plug("windwp/nvim-autopairs") -- autopairs
|
||||||
Plug("tomtom/tlib_vim")
|
Plug("romgrk/barbar.nvim") -- bar on the top
|
||||||
Plug("garbas/vim-snipmate")
|
Plug("numToStr/Comment.nvim") -- fast comments
|
||||||
Plug("kyazdani42/nvim-tree.lua")
|
Plug("lukas-reineke/indent-blankline.nvim") -- indicators for indentation (needs config)
|
||||||
Plug("windwp/nvim-autopairs")
|
Plug("lewis6991/impatient.nvim") -- speedup startup
|
||||||
Plug("romgrk/barbar.nvim")
|
Plug("nvim-telescope/telescope.nvim") -- file/text search
|
||||||
Plug("numToStr/Comment.nvim")
|
Plug("ahmedkhalf/project.nvim") -- project management -> switch projects
|
||||||
Plug("lukas-reineke/indent-blankline.nvim")
|
Plug("goolord/alpha-nvim") -- dashboard
|
||||||
Plug("lewis6991/impatient.nvim")
|
Plug("lervag/vimtex") -- latex plugin
|
||||||
Plug("lewis6991/spellsitter.nvim")
|
Plug("weilbith/nvim-code-action-menu") -- code action menu
|
||||||
Plug("moll/vim-bbye")
|
Plug("rafamadriz/friendly-snippets") -- some provided snippets
|
||||||
Plug("nvim-telescope/telescope.nvim")
|
Plug("p00f/nvim-ts-rainbow") -- colors brackets
|
||||||
Plug("ahmedkhalf/project.nvim")
|
Plug("nvim-telescope/telescope-ui-select.nvim") -- telescope ui
|
||||||
Plug("goolord/alpha-nvim")
|
Plug("nvim-telescope/telescope-file-browser.nvim") -- telescope file browser
|
||||||
Plug("lervag/vimtex")
|
Plug("nvim-telescope/telescope-fzy-native.nvim") -- telescope fuzzy search
|
||||||
Plug("weilbith/nvim-code-action-menu")
|
Plug 'folke/trouble.nvim' -- provides warning/error explanation tab
|
||||||
Plug("rafamadriz/friendly-snippets")
|
--Plug("folke/twilight.nvim") --twilight dims code not being edited right now ? useless ?
|
||||||
Plug("p00f/nvim-ts-rainbow")
|
--Plug("lambdalisue/fern.vim") -- likely not needed?
|
||||||
Plug("nvim-telescope/telescope-ui-select.nvim")
|
--Plug("MarcWeber/vim-addon-mw-utils") -- wtf?
|
||||||
Plug("nvim-telescope/telescope-file-browser.nvim")
|
--Plug("tomtom/tlib_vim") --wtf2?
|
||||||
Plug("nvim-telescope/telescope-fzy-native.nvim")
|
|
||||||
Plug 'folke/trouble.nvim'
|
|
||||||
vim.call("plug#end")
|
vim.call("plug#end")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
**
|
|
||||||
(test.tex
|
|
||||||
LaTeX2e <2020-10-01> patch level 4
|
|
||||||
L3 programming layer <2021-02-18> (article.cls
|
|
||||||
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
|
|
||||||
(size10.clo
|
|
||||||
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
|
|
||||||
)
|
|
||||||
\c@part=\count175
|
|
||||||
\c@section=\count176
|
|
||||||
\c@subsection=\count177
|
|
||||||
\c@subsubsection=\count178
|
|
||||||
\c@paragraph=\count179
|
|
||||||
\c@subparagraph=\count180
|
|
||||||
\c@figure=\count181
|
|
||||||
\c@table=\count182
|
|
||||||
\abovecaptionskip=\skip47
|
|
||||||
\belowcaptionskip=\skip48
|
|
||||||
\bibindent=\dimen138
|
|
||||||
) (l3backend-xetex.def
|
|
||||||
File: l3backend-xetex.def 2021-03-18 L3 backend support: XeTeX
|
|
||||||
\c__kernel_sys_dvipdfmx_version_int=\count183
|
|
||||||
\l__color_backend_stack_int=\count184
|
|
||||||
\g__color_backend_stack_int=\count185
|
|
||||||
\g__graphics_track_int=\count186
|
|
||||||
\l__pdf_internal_box=\box47
|
|
||||||
\g__pdf_backend_object_int=\count187
|
|
||||||
\g__pdf_backend_annotation_int=\count188
|
|
||||||
\g__pdf_backend_link_int=\count189
|
|
||||||
) (test.aux)
|
|
||||||
\openout1 = `test.aux'.
|
|
||||||
|
|
||||||
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 2.
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 2.
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 2.
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 2.
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 2.
|
|
||||||
LaTeX Font Info: Trying to load font information for TS1+cmr on input line 2
|
|
||||||
.
|
|
||||||
(ts1cmr.fd
|
|
||||||
File: ts1cmr.fd 2019/12/16 v2.5j Standard LaTeX font definitions
|
|
||||||
)
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 2.
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 2.
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 2.
|
|
||||||
LaTeX Font Info: ... okay on input line 2.
|
|
||||||
[1
|
|
||||||
|
|
||||||
] (test.aux) )
|
|
||||||
Output written on test.xdv (1 page, 624 bytes).
|
|
||||||
|
|
@ -1,54 +0,0 @@
|
||||||
|
|
||||||
snippet mini \minipg{}{}[]
|
|
||||||
\\minipg{
|
|
||||||
$1
|
|
||||||
}
|
|
||||||
{${2}}[${3}]
|
|
||||||
|
|
||||||
snippet code "code"
|
|
||||||
\\begin{lstlisting}
|
|
||||||
$1
|
|
||||||
\\end{lstlisting}
|
|
||||||
|
|
||||||
snippet list "list"
|
|
||||||
\\begin{itemize}
|
|
||||||
\\item $1
|
|
||||||
\\item $2
|
|
||||||
\\item $3
|
|
||||||
\\item $4
|
|
||||||
\\item $5
|
|
||||||
\\vspace{-3mm}
|
|
||||||
\\end{itemize}
|
|
||||||
|
|
||||||
snippet enum "enumerate"
|
|
||||||
\\begin{enumerate}
|
|
||||||
\\item $1
|
|
||||||
\\item $2
|
|
||||||
\\item $3
|
|
||||||
\\item $4
|
|
||||||
\\item $5
|
|
||||||
\\vspace{-3mm}
|
|
||||||
\\end{enumerate}
|
|
||||||
|
|
||||||
snippet table "table"
|
|
||||||
\\begin{table}[ht!]
|
|
||||||
\\section{${1}}
|
|
||||||
\\begin{tabular}{|m{0.2\linewidth}|m{0.755\linewidth}|}
|
|
||||||
\hline
|
|
||||||
$2
|
|
||||||
\hline
|
|
||||||
\\end{tabular}
|
|
||||||
\\end{table}
|
|
||||||
|
|
||||||
snippet tabular "tabular"
|
|
||||||
\\begin{tabular}{|m{0.2\linewidth}|m{0.755\linewidth}|}
|
|
||||||
\hline
|
|
||||||
$1
|
|
||||||
\hline
|
|
||||||
\\end{tabular}
|
|
||||||
|
|
||||||
snippet tx "textcolor"
|
|
||||||
\\textcolor{${1}}{${2}}
|
|
||||||
|
|
||||||
snippet bm "vectormatrix"
|
|
||||||
\\begin{bmatrix} $1 \\ $2 \\ $3 \end{bmatrix}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue