/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * monaco-json version: 2.5.1(b4d1a1e6b28e15a0f913a6ed6f733af32cd67470) * Released under the MIT license * https://github.com/Microsoft/monaco-json/blob/master/LICENSE.md *-----------------------------------------------------------------------------*/ !function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define("vscode-languageserver-types/main",["require","exports"],e)}(function(e,t){"use strict";var a,r,n,o,i,s,c,u,f,l,d,p,h,m,g,v,y,b,x,S,C,j,k,T,O,A,E,I,P,w,N;Object.defineProperty(t,"__esModule",{value:!0}),(r=a=t.Position||(t.Position={})).create=function(e,t){return{line:e,character:t}},r.is=function(e){var t=e;return ae.objectLiteral(t)&&ae.number(t.line)&&ae.number(t.character)},(o=n=t.Range||(t.Range={})).create=function(e,t,r,n){if(ae.number(e)&&ae.number(t)&&ae.number(r)&&ae.number(n))return{start:a.create(e,t),end:a.create(r,n)};if(a.is(e)&&a.is(t))return{start:e,end:t};throw new Error("Range#create called with invalid arguments["+e+", "+t+", "+r+", "+n+"]")},o.is=function(e){var t=e;return ae.objectLiteral(t)&&a.is(t.start)&&a.is(t.end)},(s=i=t.Location||(t.Location={})).create=function(e,t){return{uri:e,range:t}},s.is=function(e){var t=e;return ae.defined(t)&&n.is(t.range)&&(ae.string(t.uri)||ae.undefined(t.uri))},(c=t.LocationLink||(t.LocationLink={})).create=function(e,t,r,n){return{targetUri:e,targetRange:t,targetSelectionRange:r,originSelectionRange:n}},c.is=function(e){var t=e;return ae.defined(t)&&n.is(t.targetRange)&&ae.string(t.targetUri)&&(n.is(t.targetSelectionRange)||ae.undefined(t.targetSelectionRange))&&(n.is(t.originSelectionRange)||ae.undefined(t.originSelectionRange))},(f=u=t.Color||(t.Color={})).create=function(e,t,r,n){return{red:e,green:t,blue:r,alpha:n}},f.is=function(e){var t=e;return ae.number(t.red)&&ae.number(t.green)&&ae.number(t.blue)&&ae.number(t.alpha)},(l=t.ColorInformation||(t.ColorInformation={})).create=function(e,t){return{range:e,color:t}},l.is=function(e){var t=e;return n.is(t.range)&&u.is(t.color)},(d=t.ColorPresentation||(t.ColorPresentation={})).create=function(e,t,r){return{label:e,textEdit:t,additionalTextEdits:r}},d.is=function(e){var t=e;return ae.string(t.label)&&(ae.undefined(t.textEdit)||C.is(t))&&(ae.undefined(t.additionalTextEdits)||ae.typedArray(t.additionalTextEdits,C.is))},(p=t.FoldingRangeKind||(t.FoldingRangeKind={})).Comment="comment",p.Imports="imports",p.Region="region",(h=t.FoldingRange||(t.FoldingRange={})).create=function(e,t,r,n,o){var i={startLine:e,endLine:t};return ae.defined(r)&&(i.startCharacter=r),ae.defined(n)&&(i.endCharacter=n),ae.defined(o)&&(i.kind=o),i},h.is=function(e){var t=e;return ae.number(t.startLine)&&ae.number(t.startLine)&&(ae.undefined(t.startCharacter)||ae.number(t.startCharacter))&&(ae.undefined(t.endCharacter)||ae.number(t.endCharacter))&&(ae.undefined(t.kind)||ae.string(t.kind))},(g=m=t.DiagnosticRelatedInformation||(t.DiagnosticRelatedInformation={})).create=function(e,t){return{location:e,message:t}},g.is=function(e){var t=e;return ae.defined(t)&&i.is(t.location)&&ae.string(t.message)},(v=t.DiagnosticSeverity||(t.DiagnosticSeverity={})).Error=1,v.Warning=2,v.Information=3,v.Hint=4,(b=y=t.Diagnostic||(t.Diagnostic={})).create=function(e,t,r,n,o,i){var a={range:e,message:t};return ae.defined(r)&&(a.severity=r),ae.defined(n)&&(a.code=n),ae.defined(o)&&(a.source=o),ae.defined(i)&&(a.relatedInformation=i),a},b.is=function(e){var t=e;return ae.defined(t)&&n.is(t.range)&&ae.string(t.message)&&(ae.number(t.severity)||ae.undefined(t.severity))&&(ae.number(t.code)||ae.string(t.code)||ae.undefined(t.code))&&(ae.string(t.source)||ae.undefined(t.source))&&(ae.undefined(t.relatedInformation)||ae.typedArray(t.relatedInformation,m.is))},(S=x=t.Command||(t.Command={})).create=function(e,t){for(var r=[],n=2;ne?n=o:r=o+1}var i=r-1;return a.create(i,e-t[i])},e.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var r=t[e.line],n=e.line+1=e.offset&&t=r.children.length)return;r=r.children[f]}}return r}},t.getNodePath=function e(t){if(!t.parent||!t.parent.children)return[];var r=e(t.parent);if("property"===t.parent.type){var n=t.parent.children[0].value;r.push(n)}else if("array"===t.parent.type){var o=t.parent.children.indexOf(t);-1!==o&&r.push(o)}return r},t.getNodeValue=function e(t){switch(t.type){case"array":return t.children.map(e);case"object":for(var r=Object.create(null),n=0,o=t.children;n"},t.format=function(e,t,r){return n.format(e,t,r)},t.modify=function(e,t,r,n){return o.setProperty(e,t,r,n.formattingOptions,n.getInsertionIndex)},t.applyEdits=function(e,t){for(var r=t.length-1;0<=r;r--)e=o.applyEdit(e,t[r]);return e}}),define("jsonc-parser",["jsonc-parser/main"],function(e){return e}),function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define("vscode-json-languageservice/utils/objects",["require","exports"],e)}(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.equals=function e(t,r){if(t===r)return!0;if(null==t||null==r)return!1;if(typeof t!=typeof r)return!1;if("object"!=typeof t)return!1;if(Array.isArray(t)!==Array.isArray(r))return!1;var n,o;if(Array.isArray(t)){if(t.length!==r.length)return!1;for(n=0;n()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,n=function(){function e(e,t,r){this.offset=t,this.length=r,this.parent=e}return Object.defineProperty(e.prototype,"children",{get:function(){return[]},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")},e}(),i=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.type="null",r.value=null,r}return __extends(e,n),e}(t.ASTNodeImpl=n);t.NullASTNodeImpl=i;var y=function(o){function e(e,t,r){var n=o.call(this,e,r)||this;return n.type="boolean",n.value=t,n}return __extends(e,o),e}(n);t.BooleanASTNodeImpl=y;var b=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.type="array",r.items=[],r}return __extends(e,n),Object.defineProperty(e.prototype,"children",{get:function(){return this.items},enumerable:!0,configurable:!0}),e}(n);t.ArrayASTNodeImpl=b;var x=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.type="number",r.isInteger=!0,r.value=Number.NaN,r}return __extends(e,n),e}(n);t.NumberASTNodeImpl=x;var S=function(o){function e(e,t,r){var n=o.call(this,e,t,r)||this;return n.type="string",n.value="",n}return __extends(e,o),e}(n);t.StringASTNodeImpl=S;var C=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.type="property",r.colonOffset=-1,r}return __extends(e,n),Object.defineProperty(e.prototype,"children",{get:function(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]},enumerable:!0,configurable:!0}),e}(n);t.PropertyASTNodeImpl=C;var a,j=function(n){function e(e,t){var r=n.call(this,e,t)||this;return r.type="object",r.properties=[],r}return __extends(e,n),Object.defineProperty(e.prototype,"children",{get:function(){return this.properties},enumerable:!0,configurable:!0}),e}(n);function B(e){return W.isBoolean(e)?e?{}:{not:{}}:e}t.ObjectASTNodeImpl=j,t.asSchema=B,(a=t.EnumMatch||(t.EnumMatch={}))[a.Key=0]="Key",a[a.Enum=1]="Enum";var f=function(){function e(e,t){void 0===e&&(e=-1),void 0===t&&(t=null),this.focusOffset=e,this.exclude=t,this.schemas=[]}return e.prototype.add=function(e){this.schemas.push(e)},e.prototype.merge=function(e){var t;(t=this.schemas).push.apply(t,e.schemas)},e.prototype.include=function(e){return(-1===this.focusOffset||l(e,this.focusOffset))&&e!==this.exclude},e.prototype.newSub=function(){return new e(-1,this.exclude)},e}(),J=function(){function e(){}return Object.defineProperty(e.prototype,"schemas",{get:function(){return[]},enumerable:!0,configurable:!0}),e.prototype.add=function(e){},e.prototype.merge=function(e){},e.prototype.include=function(e){return!0},e.prototype.newSub=function(){return this},e.instance=new e,e}(),H=function(){function e(){this.problems=[],this.propertiesMatches=0,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=null}return e.prototype.hasProblems=function(){return!!this.problems.length},e.prototype.mergeAll=function(e){for(var t=0,r=e;t=e.offset&&tt.maxProperties&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:U("MaxPropWarning","Object has more properties than limit of {0}.",t.maxProperties)});W.isNumber(t.minProperties)&&e.properties.length=o.length&&r.propertiesValueMatches++}if(e.items.length>o.length)if("object"==typeof t.additionalItems)for(var f=o.length;ft.maxItems&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:U("maxItemsWarning","Array has too many items. Expected {0} or fewer.",t.maxItems)});if(!0===t.uniqueItems){var g=I(e),v=g.some(function(e,t){return t!==g.lastIndexOf(e)});v&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:U("uniqueItemsWarning","Array has duplicate items.")})}}(k,T,O,A);break;case"string":!function(e,t,r,n){W.isNumber(t.minLength)&&e.value.lengtht.maxLength&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:U("maxLengthWarning","String is longer than the maximum length of {0}.",t.maxLength)});if(W.isString(t.pattern)){var o=new RegExp(t.pattern);o.test(e.value)||r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:t.patternErrorMessage||t.errorMessage||U("patternWarning",'String does not match the pattern of "{0}".',t.pattern)})}if(t.format)switch(t.format){case"uri":case"uri-reference":var i=void 0;if(e.value)try{var a=s.default.parse(e.value);a.scheme||"uri"!==t.format||(i=U("uriSchemeMissing","URI with a scheme is expected."))}catch(e){i=e.message}else i=U("uriEmpty","URI expected.");i&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:t.patternErrorMessage||t.errorMessage||U("uriFormatWarning","String is not a URI: {0}",i)});break;case"email":e.value.match(u)||r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:t.patternErrorMessage||t.errorMessage||U("emailFormatWarning","String is not an e-mail address.")});break;case"color-hex":e.value.match(c)||r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:t.patternErrorMessage||t.errorMessage||U("colorHexFormatWarning","Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.")})}}(k,T,O);break;case"number":!function(e,t,r,n){var o=e.value;W.isNumber(t.multipleOf)&&o%t.multipleOf!=0&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:U("multipleOfWarning","Value is not divisible by {0}.",t.multipleOf)});function i(e,t){return W.isNumber(t)?t:W.isBoolean(t)&&t?e:void 0}function a(e,t){if(!W.isBoolean(t)||!t)return e}var s=i(t.minimum,t.exclusiveMinimum);W.isNumber(s)&&o<=s&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:U("exclusiveMinimumWarning","Value is below the exclusive minimum of {0}.",s)});var c=i(t.maximum,t.exclusiveMaximum);W.isNumber(c)&&c<=o&&r.problems.push({location:{offset:e.offset,length:e.length},severity:K.DiagnosticSeverity.Warning,message:U("exclusiveMaximumWarning","Value is above the exclusive maximum of {0}.",c)});var u=a(t.minimum,t.exclusiveMinimum);W.isNumber(u)&&o>>=1;return r}}),function(e){if("object"==typeof module&&"object"==typeof module.exports){var t=e(require,exports);void 0!==t&&(module.exports=t)}else"function"==typeof define&&define.amd&&define("vscode-json-languageservice/services/jsonCompletion",["require","exports","../parser/jsonParser","jsonc-parser","../utils/json","../utils/strings","../utils/objects","vscode-languageserver-types","vscode-nls"],e)}(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var b=e("../parser/jsonParser"),s=e("jsonc-parser"),r=e("../utils/json"),c=e("../utils/strings"),g=e("../utils/objects"),x=e("vscode-languageserver-types"),n=e("vscode-nls").loadMessageBundle(),o=function(){function e(e,t,r,n){void 0===t&&(t=[]),void 0===r&&(r=Promise),void 0===n&&(n={}),this.schemaService=e,this.contributions=t,this.promiseConstructor=r,this.clientCapabilities=n,this.templateVarIdCounter=0}return e.prototype.doResolve=function(e){for(var t=this.contributions.length-1;0<=t;t--)if(this.contributions[t].resolveCompletion){var r=this.contributions[t].resolveCompletion(e);if(r)return r}return this.promiseConstructor.resolve(e)},e.prototype.doComplete=function(u,e,f){var l=this,d={items:[],isIncomplete:!1},p=u.offsetAt(e),h=f.getNodeFromOffset(p,!0);if(this.isInComment(u,h?h.offset:0,p))return Promise.resolve(d);var m=this.getCurrentWord(u,p),g=null;if(!h||"string"!==h.type&&"number"!==h.type&&"boolean"!==h.type&&"null"!==h.type){var t=p-m.length;0t.colonOffset){var u=t.valueNode;if(u&&(r>u.offset+u.length||"object"===u.type||"array"===u.type))return;var f=t.keyNode.value;e.visit(function(e){return"property"===e.type&&e.keyNode.value===f&&e.valueNode&&c(e.valueNode),!0}),"$schema"===f&&t.parent&&!t.parent.parent&&this.addDollarSchemaCompletions(s,o)}if("array"===t.type)if(t.parent&&"property"===t.parent.type){var l=t.parent.keyNode.value;e.visit(function(e){return"property"===e.type&&e.keyNode.value===l&&e.valueNode&&"array"===e.valueNode.type&&e.valueNode.items.forEach(c),!0})}else t.items.forEach(c)},e.prototype.getValueCompletions=function(e,t,n,o,i,a,s){var c=this,r=o,u=null,f=null;if(!n||"string"!==n.type&&"number"!==n.type&&"boolean"!==n.type&&"null"!==n.type||(r=n.offset+n.length,n=(f=n).parent),n){if("property"===n.type&&o>n.colonOffset){var l=n.valueNode;if(l&&o>l.offset+l.length)return;u=n.keyNode.value,n=n.parent}if(n&&(null!==u||"array"===n.type)){var d=this.evaluateSeparatorAfter(i,r);t.getMatchingSchemas(e.schema,n.offset,f).forEach(function(e){if(e.node===n&&!e.inverted&&e.schema){if("array"===n.type&&e.schema.items)if(Array.isArray(e.schema.items)){var t=c.findItemAtOffset(n,i,o);tt.colonOffset){var a=t.keyNode.value,s=t.valueNode;if(!s||r<=s.offset+s.length){var c=b.getNodePath(t.parent);this.contributions.forEach(function(e){var t=e.collectValueCompletions(n.uri,c,a,o);t&&i.push(t)})}}}else this.contributions.forEach(function(e){var t=e.collectDefaultCompletions(n.uri,o);t&&i.push(t)})},e.prototype.addSchemaValueCompletions=function(e,t,r,n){var o=this;"object"==typeof e&&(this.addEnumValueCompletions(e,t,r),this.addDefaultValueCompletions(e,t,r),this.collectTypes(e,n),Array.isArray(e.allOf)&&e.allOf.forEach(function(e){return o.addSchemaValueCompletions(e,t,r,n)}),Array.isArray(e.anyOf)&&e.anyOf.forEach(function(e){return o.addSchemaValueCompletions(e,t,r,n)}),Array.isArray(e.oneOf)&&e.oneOf.forEach(function(e){return o.addSchemaValueCompletions(e,t,r,n)}))},e.prototype.addDefaultValueCompletions=function(f,l,d,p){var h=this;void 0===p&&(p=0);var m=!1;if(g.isDefined(f.default)){for(var e=f.type,t=f.default,r=p;0a.offset+a.length)return n.setPosition(a.offset+a.length),5===n.scan()&&r>=n.getTokenOffset()+n.getTokenLength()?i+1:i;if(r>=a.offset)return i}return 0},e.prototype.isInComment=function(e,t,r){var n=s.createScanner(e.getText(),!1);n.setPosition(t);for(var o=n.scan();17!==o&&n.getTokenOffset()+n.getTokenLength()c.offset+1&&ru.startLine+1&&i!==u.startLine&&(u.endLine=l-1,c(u),i=u.startLine)}break;case 13:var d=e.positionAt(a.getTokenOffset()).line,p=e.positionAt(a.getTokenOffset()+a.getTokenLength()).line;1===a.getTokenError()&&d+1u.startLine&&i!==u.startLine&&(u.endLine=l,c(u),i=u.startLine))}}s=a.scan()}var g=t&&t.rangeLimit;if("number"!=typeof g||r.length<=g)return r;for(var v=[],y=0,b=n;y