Skip to content

Commit e09a8cb

Browse files
committed
Validate settings.yaml.format before setting
1 parent 5718b49 commit e09a8cb

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/server.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,15 @@ connection.onDidChangeConfiguration((change) => {
224224
yamlShouldHover = settings.yaml.hover;
225225
yamlShouldCompletion = settings.yaml.completion;
226226
customTags = settings.yaml.customTags ? settings.yaml.customTags : [];
227-
yamlFormatterSettings = {
228-
singleQuote: settings.yaml.format.singleQuote || false,
229-
proseWrap: settings.yaml.format.proseWrap || "preserve"
230-
};
231-
if (settings.yaml.format.bracketSpacing === false) {
232-
yamlFormatterSettings.bracketSpacing = false;
233-
}
227+
if (settings.yaml.format) {
228+
yamlFormatterSettings = {
229+
singleQuote: settings.yaml.format.singleQuote || false,
230+
proseWrap: settings.yaml.format.proseWrap || "preserve"
231+
};
232+
if (settings.yaml.format.bracketSpacing === false) {
233+
yamlFormatterSettings.bracketSpacing = false;
234+
}
235+
}
234236
}
235237
schemaConfigurationSettings = [];
236238

0 commit comments

Comments
 (0)