Skip to content

Commit 07ccecf

Browse files
committed
Improve error handling
1 parent b29c101 commit 07ccecf

File tree

4 files changed

+53
-59
lines changed

4 files changed

+53
-59
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ Highlights scope names with their own themed colour in realtime:
7272

7373
### Todo
7474
* Support unicode character insertions `\u00b0`
75-
* Unify ways of displaying errors
7675
* Improve performance: [Github Issue - Capturing and applying a pattern causes performance loss](https://github.com/microsoft/vscode-textmate/issues/167)
7776
* Finish ctrl+click definitions and references
7877
* Add hovers

src/Providers/CodeActionsProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const CodeActionsProvider: vscode.CodeActionProvider = {
4343
};
4444
break;
4545
case 'missing':
46-
const missing = message.split("'")[3];
46+
const missing = message.split("'")[3] || "'";
4747

4848
edit.insert(document.uri, diagnostic.range.end, missing);
4949
codeAction = {

src/tree-sitter/tree-sitter-json/grammar.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ module.exports = grammar({
503503
"true",
504504
"false",
505505
),
506-
null: $ => /null/,
506+
null: $ => "null",
507507
integer: $ => /-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/,
508508
_string: $ => token(
509509
prec(-1,
@@ -615,17 +615,13 @@ function pair($, key, value) {
615615
),
616616
),
617617
),
618+
$._colon,
619+
repeat($._whitespace),
618620
optional(
619-
seq(
620-
$._colon,
621-
repeat($._whitespace),
622-
optional( // TS bad at error recovery
623-
choice(
624-
value ?? blank(),
625-
prec(-2,
626-
$._value,
627-
),
628-
),
621+
choice(
622+
value ?? blank(),
623+
prec(-2,
624+
$._value,
629625
),
630626
),
631627
),

0 commit comments

Comments
 (0)