You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This allows for exclusion of specific subdirs or files under the dirs
specified via `yangPath`.
Also added github ci checks markdown files to fix markdownlint issues.
This addresses #232
Signed-off-by: Siddharth Sharma <[email protected]>
Copy file name to clipboardexpand all lines: docs/Processing_Files.md
+10-3
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,13 @@
1
1
# Processing YANG files
2
2
3
-
As yang-lsp contains all the tools to parse, link and validate YANG models. If you want to further process the YANG files you authored with yang-lsp it makes sense to make reuse of the existing functionality.
3
+
As yang-lsp contains all the tools to parse, link and validate YANG models. If
4
+
you want to further process the YANG files you authored with yang-lsp it makes
5
+
sense to make reuse of the existing functionality.
4
6
5
-
Here is some example code in Xtend for an application that reads in all YANG files from a given directory. The files are parsed into our YANG EMF model, all cross-references are resolved and all files are validated. If there are no errors, the method `generate()` is called for all resources:
7
+
Here is some example code in Xtend for an application that reads in all YANG
8
+
files from a given directory. The files are parsed into our YANG EMF model, all
9
+
cross-references are resolved and all files are validated. If there are no
10
+
errors, the method `generate()` is called for all resources:
6
11
7
12
```xtend
8
13
package io.typefox.yang.example
@@ -66,7 +71,7 @@ class StandaloneExample {
66
71
}
67
72
```
68
73
69
-
A number of useful helper methods can be found in the [utils package](https://github.com/TypeFox/yang-lsp/tree/master/yang-lsp/io.typefox.yang/src/main/java/io/typefox/yang/utils)
74
+
A number of useful helper methods can be found in the [utils package][1]
70
75
71
76
Here is sample `build.gradle` to build the above class:
Copy file name to clipboardexpand all lines: docs/Settings.md
+75-31
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,18 @@
1
1
# Settings
2
2
3
-
The yang-lsp allows users to configure various settings, through settings files.
3
+
The yang-lsp allows users to configure various settings, through setting files.
4
4
The settings file has the name `yang.settings` and can be located
5
5
6
6
- at the root of a project
7
7
- in the user's directory under `~/.yang/yang.settings`.
8
8
9
9
The file syntax is a [JSON with Comments][1], and its [JSON Schema][2] can be
10
-
found [here](../schema/yang-lsp-settings-schema.json).
10
+
found [here][3].
11
11
12
12
## Disable Code Lens
13
13
14
-
If you don't want to see the code lenses you can turn it of with the following property:
14
+
If you don't want to see the code lenses you can turn it of with the following
15
+
property:
15
16
16
17
```json
17
18
{
@@ -21,41 +22,64 @@ If you don't want to see the code lenses you can turn it of with the following p
21
22
22
23
## Excluded Paths
23
24
24
-
Many IDEs and tools copy YANG files into another folder within the same project. As the YANG LSP treats all files within a project the same, this usually infers issues about duplicate elements. To avoid that, you can exclude several directories in the project setting `excludePath`, e.g.
25
+
Many IDEs and tools copy YANG files into another folder within the same
26
+
project. As the YANG LSP treats all files within a project the same, this
27
+
usually informs issues about duplicate elements. To avoid that, you can exclude
28
+
several directories in the project setting `excludePath`, e.g.
25
29
26
30
```json
27
31
{
28
32
"excludePath": "build:bin"
29
33
}
30
34
```
31
35
32
-
exludes the default output folder of Maven/Gradle and Eclipse JDT. The path elements are project relative directory names. You can specify multiple elements separated with a colon. The file separator is always `/` independent from the OS.
36
+
exludes the default output folder of Maven/Gradle and Eclipse JDT. The path
37
+
elements are project relative directory names. You can specify multiple elements
38
+
separated with a colon. The file separator is always `/` independent from the
39
+
OS.
33
40
34
41
## YANG Libraries
35
42
36
-
Often you don't specify a self contained set of YANG models but rely on existing standard libs instead, e.g. from the IETF. Thes don't necessarily reside in your workspace. To specify such libraries, use `yangPath`
43
+
Often you don't specify a self contained set of YANG models but rely on existing
44
+
standard libs instead, e.g. from the IETF. These don't necessarily reside in
45
+
your workspace. To specify such libraries, use `yangPath`
37
46
38
47
```json
39
48
{
40
49
"yangPath": "/my/home/yang/libs/rift.zip"
41
50
}
42
51
```
43
52
44
-
You can specify individual files, directories (contents will be added recursively) or ZIP files. The file name format is OS specific, and so is the path separator (`;` on Windows, `:` elsewhere).
53
+
If `yangPath` is provided to refer to an SDK location which includes a version
54
+
of the project's YANG models that need to be ignored, following approach can be
55
+
used.
56
+
57
+
```json
58
+
{
59
+
"yangPath": "/path/to/sdk/yang/dir",
60
+
"yangPathIgnore": "/path/to/sdk/yang/dir/project"
61
+
}
62
+
```
63
+
64
+
You can specify individual files, directories (contents will be added
65
+
recursively) or ZIP files. The file name format is OS specific, and so is the
66
+
path separator (`;` on Windows, `:` elsewhere).
45
67
46
68
## Extensions
47
69
48
-
The settings is used to register an extension. Please find the details [here](Extensions.md).
70
+
The settings is used to register an extension. Please find the details [here][4].
49
71
50
72
## Diagnostics
51
73
52
-
The user can change the severity of diagnostics, by setting the value of a diagnostic preference key to either
74
+
The user can change the severity of diagnostics, by setting the value of a
75
+
diagnostic preference key to either
53
76
54
77
-`"error"`
55
78
-`"warning"`
56
79
-`"ignore"`
57
80
58
-
The settings contains a `diagnostics` section in which the serverioties for the below diagnostics can be adjusted.
81
+
The settings contains a `diagnostics` section in which the serverioties for the
82
+
below diagnostics can be adjusted.
59
83
An example :
60
84
61
85
```json
@@ -66,23 +90,26 @@ An example :
66
90
}
67
91
```
68
92
69
-
### Diagnostic Codes
93
+
### Diagnostic Issue Codes
70
94
71
95
#### `substatement-cardinality`
72
96
73
-
Issue code that are entangled with cardinality problems of container statement's sub-statements.
97
+
Issue code that are entangled with cardinality problems of container statement's
98
+
sub-statements.
74
99
75
100
(default severity: error)
76
101
77
102
#### `unexpected-statement`
78
103
79
-
Issue code indicating an invalid sub-statement inside its parent statement container.
104
+
Issue code indicating an invalid sub-statement inside its parent statement
105
+
container.
80
106
81
107
(default severity: error)
82
108
83
109
#### `substatement-ordering`
84
110
85
-
Issue code for cases when a sub-statement incorrectly precedes another sub-statement.
111
+
Issue code for cases when a sub-statement incorrectly precedes another
112
+
sub-statement.
86
113
87
114
(default severity: error)
88
115
@@ -94,7 +121,8 @@ Issue code that is used when a module has anything but {@code '1.1'} version.
94
121
95
122
#### `type-error`
96
123
97
-
Errors for types. Such as invalid type restriction, range error, fraction-digits issue.
124
+
Errors for types. Such as invalid type restriction, range error, fraction-digits
125
+
issue.
98
126
99
127
(default severity: error)
100
128
@@ -110,7 +138,8 @@ A duplicate local name.
110
138
111
139
#### `missing-revision`
112
140
113
-
Diagnostic that indicates a module is available in multiple revisions when no revision is provided on an import.
141
+
Diagnostic that indicates a module is available in multiple revisions when no
142
+
revision is provided on an import.
114
143
115
144
(default severity: warning)
116
145
@@ -140,26 +169,30 @@ Issue code when the revision date does not conform the "YYYY-MM-DD" format.
140
169
141
170
#### `revision-order`
142
171
143
-
Issue code that applies on a revision if that is not in a reverse chronological order.
172
+
Issue code that applies on a revision if that is not in a reverse chronological
173
+
order.
144
174
145
175
(default severity: warning)
146
176
147
177
#### `bad-type-name`
148
178
149
-
Issue code when the name of a type does not conform with the existing constraints.
150
-
For instance; the name contains any invalid characters, or equals to any YANG built-in type name.
179
+
Issue code when the name of a type does not conform with the existing
180
+
constraints. For instance, the name contains any invalid characters, or equals
181
+
to any YANG built-in type name.
151
182
152
183
(default severity: error)
153
184
154
185
#### `bad-include-yang-version`
155
186
156
-
Issue code when there is an inconsistency between a module's version and the version of the included modules.
187
+
Issues code when there is an inconsistency between a module's version and the
188
+
version of the included modules.
157
189
158
190
(fixed severity: error)
159
191
160
192
#### `bad-import-yang-version`
161
193
162
-
Issue code when there is an inconsistency between a module's version and the version of the included modules.
194
+
Issues code when there is an inconsistency between a module's version and the
195
+
version of the included modules.
163
196
164
197
(fixed severity: error)
165
198
@@ -177,13 +210,15 @@ Issue code indicating that all assigned values in an enumerable must be unique.
177
210
178
211
#### `enumerable-restriction-name`
179
212
180
-
Issue code indicating that an enumerable introduces a new name that is not declared among the parent restriction.
213
+
Issue code indicating that an enumerable introduces a new name that is not
214
+
declared among the parent restriction.
181
215
182
216
(default severity: error)
183
217
184
218
#### `enumerable-restriction-value`
185
219
186
-
Issue code indicating that an enumerable introduces a new value that is not declared among the parent restriction.
220
+
Issue code indicating that an enumerable introduces a new value that is not
221
+
declared among the parent restriction.
187
222
188
223
(default severity: error)
189
224
@@ -207,44 +242,51 @@ Controls the indentation string when formatting or serializing yang files.
207
242
208
243
#### `invalid-config`
209
244
210
-
Issue code when a `config=true` is a child of a `config=false` (see <https://tools.ietf.org/html/rfc7950#section-7.21.1>)
245
+
Issue code when a `config=true` is a child of a `config=false`
246
+
(see <https://tools.ietf.org/html/rfc7950#section-7.21.1>)
211
247
212
248
(default severity: error)
213
249
214
250
#### `invalid-augmentation`
215
251
216
-
Issue code when an augmented node declares invalid sub-statements. For instance when an augmented leaf node has leaf nodes.
252
+
Issue code when an augmented node declares invalid sub-statements. For instance,
253
+
when an augmented leaf node has leaf nodes.
217
254
218
255
(default severity: error)
219
256
220
257
#### `invalid-default`
221
258
222
-
Issue code for cases when the a choice has default value and the mandatory sub-statement is "true".
259
+
Issue code for cases when the a choice has default value and the mandatory
260
+
sub-statement is "true".
223
261
224
262
(default severity: error)
225
263
226
264
#### `mandatory-after-default-case`
227
265
228
-
Issue code when any mandatory nodes are declared after the default case in a "choice".
266
+
Issue code when any mandatory nodes are declared after the default case in a
267
+
"choice".
229
268
230
269
(default severity: error)
231
270
232
271
#### `invalid-action-ancestor`
233
272
234
-
Issue code when an action (or notification) has a "list" ancestor node without a "key" statement.
235
-
Also applies, when an action (or notification) is declared within another action, rpc or notification.
273
+
Issue code when an action (or notification) has a "list" ancestor node without a
274
+
"key" statement. Also applies, when an action (or notification) is declared
275
+
within another action, rpc or notification.
236
276
237
277
(default severity: error)
238
278
239
279
#### `identity-cycle`
240
280
241
-
Issue code when an identity references itself, either directly or indirectly through a chain of other identities.
281
+
Issue code when an identity references itself, either directly or indirectly
282
+
through a chain of other identities.
242
283
243
284
(default severity: error)
244
285
245
286
#### `leaf-key-with-if-feature`
246
287
247
-
This issue code is used when a leaf node is declared as a list key and have any "if-feature" statements.
288
+
This issue code is used when a leaf node is declared as a list key and have any
289
+
"if-feature" statements.
248
290
249
291
(default severity: error)
250
292
@@ -280,3 +322,5 @@ Diagnostic for unresolvable Xpath expressions.
Copy file name to clipboardexpand all lines: schema/yang-lsp-settings-schema.json
+9-2
Original file line number
Diff line number
Diff line change
@@ -16,11 +16,18 @@
16
16
},
17
17
"excludePath": {
18
18
"description": "The path elements are project relative directory names.\nYou can specify multiple elements separated with a colon ':'.\nThe file separator is always '/' independent from the OS",
19
-
"type": "string"
19
+
"type": "string",
20
+
"default": ""
20
21
},
21
22
"yangPath": {
22
23
"description": "You can specify individual files, directories (contents will be added recursively) or ZIP files.\nThe file name format is OS specific, and so is the path separator (';' on Windows, ':' elsewhere).",
23
-
"type": "string"
24
+
"type": "string",
25
+
"default": ""
26
+
},
27
+
"yangPathIgnore": {
28
+
"description": "You can specify individual files or directories to be ignored from `yangPath`.\nThe file name format is OS specific, and so is the path separator (';' on Windows, ':' elsewhere).",
0 commit comments