* The scanner object, representing a JSON scanner at a position in the input string.
*/
exportinterfaceJSONScanner{
/**
* Sets the scan position to a new offset. A call to 'scan' is needed to get the first token.
*/
setPosition(pos:number);
/**
* Read the next token. Returns the tolen code.
*/
scan():SyntaxKind;
/**
* Returns the current scan position, which is after the last read token.
*/
getPosition():number;
/**
* Returns the last read token.
*/
getToken():SyntaxKind;
/**
* Returns the last read token value. The value for strings is the decoded string content. For numbers its of type number, for boolean it's true or false.
*/
getTokenValue():string;
/**
* The start offset of the last read token.
*/
getTokenOffset():number;
/**
* The length of the last read token.
*/
getTokenLength():number;
/**
* An error code of the last scan.
*/
getTokenError():ScanError;
}
/**
* Creates a JSON scanner on the given text.
* If ignoreTrivia is set, whitespaces or comments are ignored.
* Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault lolerant as possible, but still return a result.
* Therefore always check the errors list to find out if the input was valid.
@@ -342,9 +342,9 @@ export class JSONSchemaService implements IJSONSchemaService {
}
varschemaContent:IJSONSchema={};
varjsonErrors=[];
schemaContent=Json.parse(content,errors);
varerrors=jsonErrors.length?[nls.localize('json.schema.invalidFormat','Unable to parse content from \'{0}\': {1}.',toDisplayString(url),jsonErrors[0])]:[];
varjsonErrors:Json.ParseError[]=[];
schemaContent=Json.parse(content,jsonErrors);
varerrors=jsonErrors.length?[nls.localize('json.schema.invalidFormat','Unable to parse content from \'{0}\': {1}.',toDisplayString(url),Json.getParseErrorMessage(jsonErrors[0].error))]:[];
this._collector.error(this._absoluteFolderPath,nls.localize('jsonParseFail',"Failed to parse {0}: {1}.",this._absoluteManifestPath,error));
this._collector.error(this._absoluteFolderPath,nls.localize('jsonParseFail',"Failed to parse {0}: {1}.",this._absoluteManifestPath,json.getParseErrorMessage(error.error)));
});
returnnull;
}
...
...
@@ -114,11 +114,11 @@ class ExtensionManifestNLSReplacer extends ExtensionManifestHandler {
this._collector.error(this._absoluteFolderPath,nls.localize('jsonParseFail',"Failed to parse {0}: {1}.",messageBundle,error));
this._collector.error(this._absoluteFolderPath,nls.localize('jsonParseFail',"Failed to parse {0}: {1}.",messageBundle,json.getParseErrorMessage(error.error)));