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

Unexpected End of JSON Input in Laravel Intellisense Extension #59

Open
felixhaeberle opened this issue Feb 8, 2024 · 1 comment
Open

Comments

@felixhaeberle
Copy link

felixhaeberle commented Feb 8, 2024

Description

Encountered a SyntaxError due to an unexpected end of JSON input within the Laravel Intellisense extension for Visual Studio Code. This error arises during the parsing process, potentially indicating an issue with malformed or incomplete JSON data being supplied to JSON.parse.

Error Details

  • Type: SyntaxError
  • Message: Unexpected end of JSON input
  • Location: JSON.parse within ViewItemProvider.ts at line 63:30
  • Handled: No

Stack Trace

  • JSON.parse invocation leading to error
  • In c:\Users\plusg\.vscode\extensions\mohamedbenhida.laravel-intellisense-0.2.0\src\ViewItemProvider.ts at line 63:30
  • Followed by internal Node.js processes for task queues and timers management.

Potential Issue

The error suggests that JSON.parse is called with a string that does not form a valid JSON structure, possibly due to an incomplete or improperly formatted JSON data source.

Steps to Reproduce

  1. Use the Laravel Intellisense extension (version 0.2.0) in a project within VSCode on Windows.
  2. Trigger an action that involves parsing JSON data through the extension's ViewItemProvider.ts.
  3. The error occurs if the JSON data being parsed is incomplete or improperly formatted.

Expected Behavior

The Laravel Intellisense extension should correctly parse valid JSON input without throwing syntax errors, facilitating the expected intellisense features for Laravel projects.

Actual Behavior

The extension throws a syntax error during JSON parsing due to unexpected end of input, indicating an issue with the JSON data being processed.

Suggested Fix

  • Ensure that all JSON data sources used by the extension are valid and complete before attempting to parse them with JSON.parse.
  • Implement error handling for JSON.parse to catch and manage syntax errors gracefully, possibly logging an informative error message or providing a fallback mechanism.
  • Validate JSON data for completeness and proper format before it is consumed by the extension's features.

Environment

  • Node Version: v18.17.1
  • Windows Version: 10.0.22631
  • Architecture: x64
  • Environment: production
  • Error Level: error
  • Error Mechanism: onunhandledrejection
  • OS: Windows 10.0.22631
  • Runtime: Node v18.17.1
Bildschirmfoto 2024-02-08 um 10 43 04
@vet-hub
Copy link

vet-hub commented Sep 28, 2024

Windows - WSL:Ubuntu - Dev Container

Same mistake

ERR Unexpected end of JSON input: SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at v.syncModel (/home/sail/.vscode-server/extensions/mohamedbenhida.laravel-intellisense-0.2.0/dist/extension.js:1:129008)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async v.provideCompletionItems (/home/sail/.vscode-server/extensions/mohamedbenhida.laravel-intellisense-0.2.0/dist/extension.js:1:128573)
at async me.provideCompletionItems (/vscode/vscode-server/bin/linux-x64/38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40/out/vs/workbench/api/node/extensionHostProcess.js:161:118589)

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