Skip to content

Conversation

@N1ebieski
Copy link
Contributor

Currently the QuickFix option doesn't work for me:

obraz

This is because vscode.Diagnostic.code can be one of the following:

/**
* A code or identifier for this diagnostic.
* Should be used for later processing, e.g. when providing {@link CodeActionContext code actions}.
*/
code?: string | number | {
	/**
		* A code or identifier for this diagnostic.
		* Should be used for later processing, e.g. when providing {@link CodeActionContext code actions}.
		*/
	value: string | number;

	/**
		* A target URI to open with more information about the diagnostic error.
		*/
	target: Uri;
};

However, the extension currently checks only for a string value (and not a number or an object): https://github.com/laravel/vs-code-extension/blob/main/src/features/env.ts#L200-L202

This PR fixes the issue for the env, view and inertia helpers.

@N1ebieski N1ebieski changed the title Fix for quick fix for vscode.Diagnostic,code Fix for QuickFix for vscode.Diagnostic.code Dec 20, 2025
@TitasGailius
Copy link
Collaborator

@N1ebieski thanks for reporting this - this totally makes sense.

What linter or setup are you using that causes it to send a number or an object?
I'd like to try to reproduce the issue.

@N1ebieski
Copy link
Contributor Author

Hi @TitasGailius, I'm using WSL Linux with Docker and working with the extension in dev container mode. For me, it's only an object, not a number.

@TitasGailius
Copy link
Collaborator

@N1ebieski There must be another extension, a special rule in .vscode/tasks.json, or something else providing diagnostics for environment variables.

An easy way to check where this is coming from is by inspecting the diagnostic.source value.
If it's coming from the extension, it should be Laravel Extension.

The reason I'm asking is that it doesn't seem to be provided by the Laravel Extension itself, and I'd like to understand the actual source.

@N1ebieski
Copy link
Contributor Author

@TitasGailius

obraz

@TitasGailius
Copy link
Collaborator

@N1ebieski interesting. Thanks for checking.

@TitasGailius
Copy link
Collaborator

@N1ebieski, your version of the extension includes these changes:

https://github.com/laravel/vs-code-extension/pull/443/changes#diff-cba9592099e8717965c26e4a4fbf5f49ec33850cb90f8750e555ed4ddf35cd15R94-R97

The main branch does not have them yet, so code is always a string.

@N1ebieski
Copy link
Contributor Author

@TitasGailius You're right. On the main branch I have a string, but when working on N1ebieski:Improvements-for-linked-parameter-vscodeDiagnosticcode-for-diagnosticProvider-#55, I get an object.

@N1ebieski
Copy link
Contributor Author

@TitasGailius OK this is why > https://github.com/laravel/vs-code-extension/pull/443/files#diff-cba9592099e8717965c26e4a4fbf5f49ec33850cb90f8750e555ed4ddf35cd15R94-R97

Please let me know whether I should remove these links and keep only the Quick Fix option:

obraz

If so, this PR can be closed.

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.

2 participants