Skip to content

Fix SyntaxError: Unexpected end of JSON input #391

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

Conversation

N1ebieski
Copy link
Contributor

Fixes #309

The result in this line > https://github.com/laravel/vs-code-extension/blob/main/src/support/parser.ts#L150 can be an empty string (we don't know why, maybe performance issues?), then JSON.parse throws the error:

2025-05-21 21:44:29.841 [error] SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at /home/.../.vscode-server/extensions/laravel.vscode-laravel-1.0.8/dist/extension.js:1573:1627

This PR adds an additional check if the result is empty, if so - JSON.parse is skipped.

Copy link
Collaborator

@joetannenbaum joetannenbaum left a comment

Choose a reason for hiding this comment

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

Thank you!

@joetannenbaum joetannenbaum merged commit 32aa3ff into laravel:main Jun 9, 2025
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

Successfully merging this pull request may close these issues.

[Bug]: SyntaxError: Unexpected end of JSON input
2 participants