#!/bin/bash
# Use this script to read diagnostics text from stdin and parse into JSON
# format. You can change the hashbang above to use another interpreter. The
# JSON output should have the following structure:
# [
# 	{
# 		"file": "/path/to/my/file", (optional, defaults to current file)
# 		"location": {
# 			"offset": absolute-char-offset,
# 			"length": length
# 				...or...
# 			"line": line,
# 			"column": column,
# 			"endLine": end-line, (optional)
# 			"endColumn": end-column (optional)
# 		},
# 		"message": "Something is wrong with this code...",
# 		"type": one of the following values: (optional)
# 			"error", "warning", "notice", "runtime_error", "runtime_warning"
# 		"messageID": (optional)
# 			Identifier for this particular message, used to ignore the message
# 		"fixes": [ (optional)
# 			{
# 				"location": { ...same location properties as above... },
# 				"replacement": "string that replaces characters in location",
# 				"title": button text (optional, Default: "Fix")
# 				"description": "description of fix" (optional),
# 			},
# 			...
# 		],
# 		"matchedLocations": [ (optional, only applicable for console text)
# 			Used for highlighting and producing links in output displayed in the
# 			console. Specifies the matched portion of the parsed diagnostics
# 			text producing this diagnostics message.
# 			{
# 				"location": { ...same location properties as above... },
# 					(The location within the parsed text to be highlighted)
# 				"link": Adds a link to the text. Use an empty string to use an
# 						automatically generated link to this diagnostic message.
# 				"scopes": [
# 					One or more scope names used to semantically and visually
# 					highlight the text. Recommended scopes are of the form:
# 					  console.error.optional-subtypes.language-name
# 					  console.warning.optional-subtypes.language-name
# 					  console.notice.optional-subtypes.language-name
# 				]
# 			},
# 			...
# 		],
# 		"children": [ (optional)
# 			Allows nesting of diagnostic messages. Child messages are displayed
# 			when their parent is clicked. They may be located in other files.
# 		]
# 	},
# 	...
# ]

echo "Please edit the file at $0 or disable this diagnostic in CodeRunner Preferences."
