Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unterminated strings don't provide error recovery #397

Open
wojciech-kulik opened this issue Mar 24, 2024 · 3 comments
Open

Unterminated strings don't provide error recovery #397

wojciech-kulik opened this issue Mar 24, 2024 · 3 comments

Comments

@wojciech-kulik
Copy link

I'm not sure if it's possible in case of Swift, but tree-sitter is often advertised by its error recovery and as one of examples it is shown that unterminated String doesn't break highlighting. That's not the case with Swift, if I leave open String the rest of the file is considered as String.

Would it be possible to handle this case. It should be possible because multiline Strings have its own syntax: """

Xcode handles this case correctly.

Example:

func foo() {
  let myLet = "abcd
  someObj.call()
}
@wojciech-kulik wojciech-kulik changed the title Unterminated strings don't introduce error recovery Unterminated strings don't provide error recovery Mar 24, 2024
@alex-pinkus
Copy link
Owner

Hmm, this is odd. My first assumption was that this came from the custom scanner, but then I remembered that single-line non-raw strings are part of the JS grammar, not the custom scanner.

@wojciech-kulik
Copy link
Author

I'm not sure if I understood your comment :D. Is there any chance to fix it?

@alex-pinkus
Copy link
Owner

I'm sure it is possible to fix. My earlier comment is saying that I don't have any pointers on where you might look to start to fix it, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants