This repository was archived by the owner on Feb 28, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjsonls.lua
More file actions
64 lines (62 loc) · 1.82 KB
/
Copy pathjsonls.lua
File metadata and controls
64 lines (62 loc) · 1.82 KB
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
local function get_json_schemas()
return {
{
description = 'NPM configuration file',
fileMatch = { 'package.json' },
name = 'package.json',
url = 'https://json.schemastore.org/package.json',
},
{
name = 'GraphQL Config',
description = 'GraphQL Config config file',
fileMatch = {
'graphql.config.json',
'.graphqlrc',
'.graphqlrc.json',
},
url = 'https://unpkg.com/graphql-config/config-schema.json',
},
{
description = 'ESLint configuration files',
fileMatch = { '.eslintrc', '.eslintrc.json' },
name = '.eslintrc',
url = 'https://json.schemastore.org/eslintrc.json',
},
{
description = '.prettierrc configuration file',
fileMatch = { '.prettierrc', '.prettierrc.json' },
name = 'prettierrc.json',
url = 'https://json.schemastore.org/prettierrc.json',
versions = {
['1.8.2'] = 'https://json.schemastore.org/prettierrc-1.8.2.json',
['2.8.8'] = 'https://json.schemastore.org/prettierrc-2.8.8.json',
['3.0.0'] = 'https://json.schemastore.org/prettierrc.json',
},
},
{
description = 'TypeScript compiler configuration file',
fileMatch = { 'tsconfig*.json' },
name = 'tsconfig.json',
url = 'https://json.schemastore.org/tsconfig.json',
},
}
end
---@type vim.lsp.Config
return {
cmd = { 'vscode-json-language-server', '--stdio' },
filetypes = { 'json', 'jsonc' },
init_options = {
provideFormatter = true,
},
root_markers = { '.git' },
on_init = function(client)
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end,
settings = {
json = {
schemas = get_json_schemas(),
validate = { enable = true },
},
},
}