Repository navigation
Support blade files - #158
Open
SanderRonde wants to merge 2 commits into
Open
SanderRonde wants to merge 2 commits into
SanderRonde wants to merge 2 commits into
Conversation
Blade templates get the `blade` language ID from Laravel syntax extensions, so PHPStan checks never triggered for them even though Bladestan can analyze them. Activate on `blade` too and share the list of supported language IDs between client and server. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Blade templates are never analyzed automatically today. Laravel syntax extensions reassign
.blade.phpfiles to thebladelanguage ID, and every trigger path in the extension gated strictly onphp, so the extension neither activated nor synced those documents — even for setups where PHPStan itself can analyze them (e.g. via Bladestan).This adds
bladealongsidephpeverywhere a language gate exists, and pulls the list intoshared/languages.tsso the client and server share one definition:package.json—onLanguage:bladeactivation eventclient/src/extension.ts—documentSelectorbuilt from the shared listclient/src/notificationSenders/documentManager.ts—_shouldSyncDocument, which gated open/change/save/active/closeserver/src/lib/documentManager.ts— the fivelanguageId !== 'php'handler gatesclient/src/lib/commands.ts— scan-file and reload commandsclient/src/notificationReceivers/configResolveLanguageStatus.ts— status item selectorTwo things that aren't plain gate swaps:
_checkValidnow skips non-PHP languages.php-parsercan't parse Blade directives, and a file marked invalid blocks all project checks (checkManager._checkProject). Without this, opening a blade file withphpstan.checkValidityenabled would wedge every check.providerUtil.tspasses the document's real language ID instead of a hardcoded'php'for the hover check. Behavior-neutral as far as I can tell —languageIdisn't read downstream ofcheckIfChangedbeyond the gates above — but it was the one place still fabricating the value.Deliberately left alone:
registerCodeActionsProvider('php')inerrorManager.ts. The quick fix inserts@phpstan-ignore-next-line/ docblock comments, which would corrupt template markup outside a@phpblock. Blade needs different ignore syntax, so it seemed better to leave the quick fix PHP-only than to emit bad edits.*.phpfile system watcher, which already matches.blade.php.Notes / open questions
phpstan.singleFileMode: true. In that mode a blade save now triggers a single-file check on the template path; I didn't verify what PHPStan does with an explicit.blade.phpargument. Previously blade files simply did nothing. If that turns out to be noisy, the fix is a language condition on theshouldCheckProjectdecisions incheckManager.ts— I left it out rather than guard against an unconfirmed failure mode.activationEventsis a hand-maintained duplicate ofSUPPORTED_LANGUAGE_IDS;generate-package-jsononly covers commands and config. There's a comment inshared/languages.tsnoting this.bladeis added, not other Blade-flavored language IDs some extensions register.Test plan
bun run compile,bun run lint,bun run buildall pass.blade.phpfile with a Laravel Blade extension installed triggers a project check.phpworkflow is unchanged🤖 Generated with Claude Code