vscode-json-languageservice
Advanced tools
Comparing version 3.8.1 to 3.8.2
@@ -526,4 +526,31 @@ /*--------------------------------------------------------------------------------------------- | ||
var val = node.value; | ||
function normalizeFloats(float) { | ||
var _a; | ||
var parts = /^(-?\d+)(?:\.(\d+))?(?:e([-+]\d+))?$/.exec(float.toString()); | ||
return parts && { | ||
value: Number(parts[1] + (parts[2] || '')), | ||
multiplier: (((_a = parts[2]) === null || _a === void 0 ? void 0 : _a.length) || 0) - (parseInt(parts[3]) || 0) | ||
}; | ||
} | ||
; | ||
if (isNumber(schema.multipleOf)) { | ||
if (val % schema.multipleOf !== 0) { | ||
var remainder = -1; | ||
if (Number.isInteger(schema.multipleOf)) { | ||
remainder = val % schema.multipleOf; | ||
} | ||
else { | ||
var normMultipleOf = normalizeFloats(schema.multipleOf); | ||
var normValue = normalizeFloats(val); | ||
if (normMultipleOf && normValue) { | ||
var multiplier = Math.pow(10, Math.abs(normValue.multiplier - normMultipleOf.multiplier)); | ||
if (normValue.multiplier < normMultipleOf.multiplier) { | ||
normValue.value *= multiplier; | ||
} | ||
else { | ||
normMultipleOf.value *= multiplier; | ||
} | ||
remainder = normValue.value % normMultipleOf.value; | ||
} | ||
} | ||
if (remainder !== 0) { | ||
validationResult.problems.push({ | ||
@@ -530,0 +557,0 @@ location: { offset: node.offset, length: node.length }, |
@@ -290,3 +290,3 @@ /*--------------------------------------------------------------------------------------------- | ||
else if (id === 'https://json-schema.org/draft/2019-09/schema') { | ||
schemaToResolve.errors.push(localize('json.schema.draft201909.notsupported', "Draft 2019-09 schemas are not yet fully supported.")); | ||
resolveErrors.push(localize('json.schema.draft201909.notsupported', "Draft 2019-09 schemas are not yet fully supported.")); | ||
} | ||
@@ -293,0 +293,0 @@ } |
@@ -302,3 +302,3 @@ /*--------------------------------------------------------------------------------------------- | ||
else if (id === 'https://json-schema.org/draft/2019-09/schema') { | ||
schemaToResolve.errors.push(localize('json.schema.draft201909.notsupported', "Draft 2019-09 schemas are not yet fully supported.")); | ||
resolveErrors.push(localize('json.schema.draft201909.notsupported', "Draft 2019-09 schemas are not yet fully supported.")); | ||
} | ||
@@ -305,0 +305,0 @@ } |
{ | ||
"name": "vscode-json-languageservice", | ||
"version": "3.8.1", | ||
"version": "3.8.2", | ||
"description": "Language service for JSON", | ||
@@ -5,0 +5,0 @@ "main": "./lib/umd/jsonLanguageService.js", |
Sorry, the diff of this file is too big to display
474714
9683