Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
RedCMD committed Oct 8, 2024
1 parent b29c101 commit 07ccecf
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 59 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ Highlights scope names with their own themed colour in realtime:

### Todo
* Support unicode character insertions `\u00b0`
* Unify ways of displaying errors
* Improve performance: [Github Issue - Capturing and applying a pattern causes performance loss](https://github.com/microsoft/vscode-textmate/issues/167)
* Finish ctrl+click definitions and references
* Add hovers
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/CodeActionsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const CodeActionsProvider: vscode.CodeActionProvider = {
};
break;
case 'missing':
const missing = message.split("'")[3];
const missing = message.split("'")[3] || "'";

edit.insert(document.uri, diagnostic.range.end, missing);
codeAction = {
Expand Down
18 changes: 7 additions & 11 deletions src/tree-sitter/tree-sitter-json/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ module.exports = grammar({
"true",
"false",
),
null: $ => /null/,
null: $ => "null",
integer: $ => /-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?/,
_string: $ => token(
prec(-1,
Expand Down Expand Up @@ -615,17 +615,13 @@ function pair($, key, value) {
),
),
),
$._colon,
repeat($._whitespace),
optional(
seq(
$._colon,
repeat($._whitespace),
optional( // TS bad at error recovery
choice(
value ?? blank(),
prec(-2,
$._value,
),
),
choice(
value ?? blank(),
prec(-2,
$._value,
),
),
),
Expand Down
Loading

1 comment on commit 07ccecf

@RedCMD
Copy link
Owner Author

@RedCMD RedCMD commented on 07ccecf Oct 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.