Compare commits

..

9 Commits

Author SHA1 Message Date
andrzej d3c45857eb require lsp setup 2024-03-13 00:25:39 +01:00
andrzej 9867549b3b add node installs 2024-03-13 00:25:13 +01:00
andrzej de26f551c5 ignore node modules 2024-03-13 00:24:23 +01:00
andrzej 770406ad70 undo 2024-03-13 00:23:58 +01:00
andrzej 37ec569937 add samples to test linting and lsps 2024-03-13 00:23:48 +01:00
andrzej b735ff2b36 add linters 2024-03-13 00:23:17 +01:00
andrzej d3ff6d853a make lsp setup more programmatic 2024-03-13 00:23:05 +01:00
andrzej 8017c3fa3d add autotagging 2024-03-13 00:21:50 +01:00
andrzej 5b66c7c5fa separate install and config 2024-03-13 00:21:33 +01:00
24 changed files with 1123 additions and 80 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

View File

@ -9,11 +9,10 @@ if not vim.loop.fs_stat(lazypath) then
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
lazypath, })
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({ { import = "plugins" }, { import = "plugins.lsp" }, { import = "plugins.themes" } })
require("lsp_setup")
vim.cmd("colorscheme rose-pine")

51
lua/lsp_setup.lua Normal file
View File

@ -0,0 +1,51 @@
-- enable mason and configure icons
require("mason").setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
require("mason-tool-installer").setup({
ensure_installed = {
"prettier", -- prettier formatter
-- "stylua", -- lua formatter
"isort", -- python formatter
"black", -- python formatter
"pylint", -- python linter
"eslint_d", -- js linter
},
})
--#################################################################################
--##### THESE ARE THE LANGUAGE SERVERS WE WANT
--#################################################################################
local lsps_for_install = { "eslint", "html", "cssls", "bashls", "grammarly" }
--make this table 2d to add configs
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup {
ensure_installed = lsps_for_install
}
local lspconfig = require("lspconfig")
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
for _, lsp in pairs(lsps_for_install) do
lspconfig[lsp].setup {
capabilities = lsp_capabilities,
}
end
lspconfig.lua_ls.setup {
capabilities = lsp_capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
},
},
}

6
lua/plugins/autotag.lua Normal file
View File

@ -0,0 +1,6 @@
return {
"https://github.com/windwp/nvim-ts-autotag",
config = function()
require('nvim-ts-autotag').setup()
end
}

View File

@ -7,7 +7,6 @@ return {
},
config = function()
local lint = require("lint")
lint.linters_by_ft = {
javascript = { "eslint_d" },
typescript = { "eslint_d" },

View File

@ -0,0 +1,13 @@
return {
{
"williamboman/mason.nvim",
dependencies = { "WhoIsSethDaniel/mason-tool-installer.nvim" },
},
{
"williamboman/mason-lspconfig.nvim",
},
{
"neovim/nvim-lspconfig",
},
}

View File

@ -1,35 +0,0 @@
return {"neovim/nvim-lspconfig",
config = function()
local lsp_capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require('lspconfig')
lspconfig.lua_ls.setup {
capabilities = lsp_capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
},
},
}
-- lspconfig.ltex.setup {
-- capabilities = lsp_capabilities,
-- }
-- lspconfig.grammarly.setup {
-- capabilities = lsp_capabilities,
-- filetypes = { "markdown", "tex", "text", },
-- init_options = {
-- clientId = "client_"
-- },
-- root_dir = function(fname)
-- return require'lspconfig'.util.find_git_ancestor(fname) or vim.loop.os_homedir()
-- end,
-- }
-- lspconfig.marksman.setup {
-- capabilities = lsp_capabilities,
-- }
end
}

View File

@ -1,41 +0,0 @@
return {
{
"williamboman/mason.nvim",
dependencies = { "WhoIsSethDaniel/mason-tool-installer.nvim" },
config = function()
-- import mason
local mason = require("mason")
local mason_tool_installer = require("mason-tool-installer")
-- enable mason and configure icons
mason.setup({
ui = {
icons = {
package_installed = "",
package_pending = "",
package_uninstalled = "",
},
},
})
mason_tool_installer.setup({
ensure_installed = {
"prettier", -- prettier formatter
"stylua", -- lua formatter
"isort", -- python formatter
"black", -- python formatter
"pylint", -- python linter
"eslint_d", -- js linter
},
})
end,
},
-- {"williamboman/mason-lspconfig.nvim",
-- config = function()
-- local mason_lspconfig = require("mason-lspconfig")
-- mason_lspconfig.setup {
-- ensure_installed = { "grammarly", "ltex" },
-- }
-- end
-- }
}

1032
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"eslint": "^8.57.0"
}
}

7
samples/sample.html Normal file
View File

@ -0,0 +1,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>HTML 5 Boilerplate</title>
<link rel="stylesheet" href="style.css" />
</head>

3
samples/sample.js Normal file
View File

@ -0,0 +1,3 @@
function(){
}

3
samples/sample.md Normal file
View File

@ -0,0 +1,3 @@
#This is a markdown file
There are many like it, but this is mine.