diff --git a/src/languageservice/services/yamlSchemaService.ts b/src/languageservice/services/yamlSchemaService.ts index edca6708c..cf39361e1 100644 --- a/src/languageservice/services/yamlSchemaService.ts +++ b/src/languageservice/services/yamlSchemaService.ts @@ -305,7 +305,7 @@ export class YAMLSchemaService extends JSONSchemaService { if (yamlLanguageServerModeline != undefined) { const schemaKey = '$schema='; const indexOfJsonSchemaParameter = yamlLanguageServerModeline.indexOf(schemaKey); - if (yamlLanguageServerModeline.indexOf(schemaKey) != -1) { + if (indexOfJsonSchemaParameter !== -1) { const startIndex = indexOfJsonSchemaParameter + schemaKey.length; const indexOfNextSpace = yamlLanguageServerModeline.indexOf(' ', startIndex); const endIndex = indexOfNextSpace !== -1 ? indexOfNextSpace : yamlLanguageServerModeline.length;