JSONVisitor.onObjectBegin
andJSONVisitor.onArrayBegin
can now returnfalse
to instruct the visitor that no children should be visited.
- update the version of the bundled Javascript files to
es2020
. - include all
const enum
values in the bundled JavaScript files (ScanError
,SyntaxKind
,ParseErrorCode
).
- added new API
FormattingOptions.keepLines
: It leaves the initial line positions in the formatting.
- fixed API spec for
parseTree
. Can returnundefine
for empty input. - added new API
FormattingOptions.insertFinalNewline
.
- new API
ModificationOptions.isArrayInsertion
: IfJSONPath
refers to an index of an array andisArrayInsertion
istrue
, thenmodify
will insert a new item at that location instead of overwriting its contents. ModificationOptions.formattingOptions
is now optional. If not set, newly inserted content will not be formatted.
- added
ParseOptions.allowEmptyContent
. Default isfalse
. - new API
getNodeType
: Returns the type of a value returned by parse. parse
: Fix issue with empty property name
JSONScanner
andJSONVisitor
return lineNumber / character.
- renamed
Node.columnOffset
toNode.colonOffset
- new API
getNodePath
: Gets the JSON path of the given JSON DOM node - new API
findNodeAtOffset
: Finds the most inner node at the given offset. IfincludeRightBound
is set, also finds nodes that end at the given offset.
- provide ems modules
- added the
visit.onComment
API, reported when comments are allowed. - added the
ParseErrorCode.InvalidCommentToken
enum value, reported when comments are disallowed.
- added the
format
API: computes edits to format a JSON document. - added the
modify
API: computes edits to insert, remove or replace a property or value in a JSON document. - added the
allyEdits
API: applies edits to a document
- remove nls dependency (remove
getParseErrorMessage
)
- added
ParseError.offset
&ParseError.length
- added
ParseOptions.allowTrailingComma
- fix for
getLocation
. NowgetLocation
inside an object will always return a property from inside that property. Can be empty string if the object has no properties or if the offset is before a actual property{ "a": { | }} will return location ['a', ' ']
- Updating to typescript 2.0