summaryrefslogtreecommitdiff
path: root/nvim/lua/config/lsp.lua
blob: 82a64fb3c079672147d0a1d41766525037d22982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
-- LSP diagnostic info config (erorrs, warnings, etc.)
vim.diagnostic.config({
	-- use virtual text to show diagnostic messages
  virtual_text = true,
})

-- requires vscode-json-languageserver
vim.lsp.enable('jsonls')
vim.lsp.config('jsonls', {
	settings = {
		json = {
			schemas = require('schemastore').json.schemas {
				select = {
					'tsconfig.json',
					'package.json',
					'prettierrc.json',
					'.eslintrc',
				}
			},
			validate = { enable = true },
		},
	},
})

vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
  pattern = { "api-extractor.json" },
  callback = function()
    vim.bo.filetype = "jsonc"
  end,
})

-- requires bash-language-server, shellcheck is a nice optional addition
vim.lsp.enable('bashls')

-- dymanic path to bitbucket config schema
local bb_schema_path = vim.fn.stdpath("config") .. "/bitbucket-pipelines.json"

-- requires yaml-language-server
vim.lsp.enable('yamlls')
vim.lsp.config('yamlls', {
	settings = {
		yaml = {
			schemas = require('schemastore').yaml.schemas {
				-- I can stop using that until this schema stops using $ref in root:
				-- https://api.bitbucket.org/schemas/pipelines-configuration
				replace = {
					['bitbucket-pipelines'] = {
						description = 'Patched pipelines schema',
						name = 'bitbucket-pipelines',
						fileMatch = 'bitbucket-pipelines.yml',
						url = 'file://' .. bb_schema_path,
					}
				}
			},
		}
	}
})

-- requires clang installed
vim.lsp.enable('clangd')
vim.lsp.enable('eslint')
vim.lsp.enable('cssls')
-- requires typescript-language-server
vim.lsp.enable('ts_ls')
-- requires jdtls (AUR) and mfussenegger/nvim-jdtls plugin
vim.lsp.enable('jdtls')
vim.lsp.config('jdtls', {
	settings = {
		java = {
			configuration = {
				runtimes = {
					-- java 17 for Minecraft modding
					{
						name = "JavaSE-17",
						path = "/usr/lib/jvm/java-17-temurin/",
					},
				}
			}
		}
	}
})