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

associate blade files with html #7

Open
lordsteve opened this issue Dec 5, 2021 · 6 comments
Open

associate blade files with html #7

lordsteve opened this issue Dec 5, 2021 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@lordsteve
Copy link

It looks like the extension breaks if you associate blade.php files with HTML in settings. I do this so the markup is color-coded like HTML in the components.

@Naoray
Copy link
Owner

Naoray commented Dec 5, 2021 via email

@lordsteve
Copy link
Author

Sure thing, it's right in settings.json

"files.associations": {"*blade.php": "html"}

When it's there, the HTML inside my Blade component is colored to match HTML markup, but I can't click any of the <x-component> tags. When it's not, I can click them, but the HTML is all plain white text.

@Naoray
Copy link
Owner

Naoray commented Dec 5, 2021 via email

@lordsteve
Copy link
Author

So I comment it out
Screen Shot 2021-12-05 at 1 49 48 PM
and it looks like this
Screen Shot 2021-12-05 at 1 50 23 PM
I put it back in
Screen Shot 2021-12-05 at 1 49 33 PM
and it looks like this
Screen Shot 2021-12-05 at 1 49 59 PM
structure looks like this
Screen Shot 2021-12-05 at 2 05 06 PM
And I'm currently looking at resources/views/components/setting.blade.php

@Naoray Naoray added bug Something isn't working help wanted Extra attention is needed labels Dec 6, 2021
@Naoray
Copy link
Owner

Naoray commented Dec 6, 2021

@lordsteve I was able to reproduce the bug, but couldn't figure out why exactly this is happening.

As I said before, I don't have this files.assotiations setting for blade files and my IDE still shows the html code colored properly

image

As a workaround I'd highly recommend installing the following blade highlighting extension. While you are at it, you should also consider using Laravel Blade Formatter extension.

Hope that helps for now. If you want and have the time to look into the cause of this issue I'd highly appreciate it. Otherwise I'd probably sit it here for a bit until more ppl complain.

@igorgaming
Copy link
Contributor

igorgaming commented Dec 18, 2021

This error is related to this lines:

let hover = languages.registerHoverProvider("blade", new HoverProvider());
let link = languages.registerDocumentLinkProvider(
"blade",

This is where the Hover and Link provider are registered for blade files. Because in the settings we associate blade files with html, these providers are not registered for them I believe.

But I do not know how to fix it. Most likely, there should be a way to determine the association of the blade file with html in order to register these providers for html files, or even an association of files by extension.

A "quick" solution may be to register providers for both blade and html files, but I think this is a bad solution.

Because these methods take the first parameter DocumentSelector which can be DocumentFilter, we can try to use it and pass an object of the object:

 let hover = languages.registerHoverProvider(['blade', { language: 'html', pattern: '*.blade.php' }], new HoverProvider());

But I do not know if it will work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants