forked from b0o/SchemaStore.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschemastore.txt
176 lines (148 loc) · 5.53 KB
/
schemastore.txt
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
*schemastore.txt* Access the SchemaStore catalog from Neovim *schemastore* *schemastore.nvim*
Author: Maddison Hellstrom <https://github.com/b0o/>
Licence: MIT
Homepage: https://github.com/b0o/schemastore.nvim
Version: 0.1.0
==============================================================================
CONTENTS *schemastore-contents*
1. Intro ................................ |schemastore-intro|
2. Changelog ............................ |schemastore-changelog|
3. License .............................. |schemastore-license|
==============================================================================
1. Intro *schemastore-intro*
SchemaStore.nvim is a Neovim Lua plugin providing access to the
SchemaStore catalog (https://github.com/SchemaStore/schemastore).
==============================================================================
2. Usage *schemastore-usage*
To use all of the SchemaStore JSON schemas with lspconfig + jsonls:
>
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.jsonls.setup {
capabilities = capabilities,
settings = {
json = {
schemas = require('schemastore').json.schemas(),
validate = { enable = true },
},
},
-- The rest of your jslonls settings
}
<
For an explanation of why the `validate = { enable = true }` option is recommended,
see https://github.com/b0o/SchemaStore.nvim/issues/8.
You can select a subset of schemas with the `select` option:
>
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.jsonls.setup {
capabilities = capabilities,
settings = {
json = {
schemas = require('schemastore').json.schemas {
select = {
'.eslintrc',
'package.json',
},
},
validate = { enable = true },
},
},
-- The rest of your jslonls settings
}
<
Or, you can ignore a list of schemas with the `ignore` option:
>
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.jsonls.setup {
capabilities = capabilities,
settings = {
json = {
schemas = require('schemastore').json.schemas {
ignore = {
'JSON Feed',
},
},
validate = { enable = true },
},
},
-- The rest of your jslonls settings
}
<
Note that the `select` and `ignore` options are mutually exclusive and
attempting to use them together will throw an error.
You can replace a schema with your own:
>
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.jsonls.setup {
capabilities = capabilities,
settings = {
json = {
schemas = require('schemastore').json.schemas {
replace = {
['.eslintrc'] = {
description = "Custom JSON schema for ESLint configuration files",
fileMatch = { ".eslintrc", ".eslintrc.json", ".eslintrc.yml", ".eslintrc.yaml" },
name = ".eslintrc",
url = "https://example.com/schema/eslintrc.json"
},
},
},
validate = { enable = true },
},
},
-- The rest of your jslonls settings
}
<
The `select` and `replace` options can be used simultaneously:
>
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
require'lspconfig'.jsonls.setup {
capabilities = capabilities,
settings = {
json = {
schemas = require('schemastore').json.schemas {
select = {
'.eslintrc',
'package.json',
},
replace = {
['.eslintrc'] = {
description = "Custom JSON schema for ESLint configuration files",
fileMatch = { ".eslintrc", ".eslintrc.json", ".eslintrc.yml", ".eslintrc.yaml" },
name = ".eslintrc",
url = "https://example.com/schema/eslintrc.json"
},
},
},
validate = { enable = true },
},
},
-- The rest of your jslonls settings
}
==============================================================================
3. Changelog *schemastore-changelog*
21 Dec 2021 v0.1.0
Perf: Add lookup table from schema name to schema index
Note that select & ignore are mutually exclusive
Exit with non-zero code if generate script fails
Update docs
Update NOTICE
Clean up formatting
Update tests
Fix example in README
Feat: Add option to ignore schemas by name
15 Oct 2021 v0.0.1
Initial Release
==============================================================================
4. License *schemastore-license*
>
Apache License, Version 2.0
© 2021 Maddison Hellstrom <github.com/b0o>
Full license information is available in the LICENSE and NOTICE files at the
root of this repository.
<
vim:tw=78:ts=8:ft=help:norl: