Medalink / laravel-blade

This package adds syntax definitions for the Laravel Blade engine.
http://www.laravel.com
MIT License
420 stars 105 forks source link

Tag expansion prompt showing unexpectedly #203

Open taylorotwell opened 1 year ago

taylorotwell commented 1 year ago

Sometimes when closing an HTML tag, I am prompted for tax expansion unexpectedly. This does not happen on Sublime's HTML syntax - only when using the HTML (Blade) syntax. It seems related to putting colons in attributes and then closing the tag.

Any help solving this extremely appreciated.

Below is a minimal HTML snippet to reproduce the problem.

CleanShot 2023-07-16 at 13 57 48@2x
Medalink commented 1 year ago

@deathaxe do you have any thoughts on why this is happening and how to prevent it?

deathaxe commented 1 year ago

The only special thing of this package is a syntax specific auto_completion_selector, which intents to enable autocompletions within template tags. It would require a nonwhitespace character to be typed, to open the panel.

see: https://github.com/Medalink/laravel-blade/blob/fe4961837f6c08424eeb7850e9ca0f57a2aacb50/Syntaxes/HTML%20(Blade).sublime-settings#L2

  1. What ST version is it?
  2. What's the output of
    • view.settings().get("auto_complete_selector")
    • view.settings().get("auto_complete_triggers")
  3. Is any language server involved?
  4. Any other completion plugins?

Is completion panel directly opened by typing >? Maybe > was added to auto_complete_triggers by a plugin (or user customization)? _I am aware of LSP manipulating view-specific auto_complete_triggers setting based on what it gets from a language servers._

I get this state only by hitting ctrl+space after the tag.

taylorotwell commented 1 year ago

@deathaxe

  1. Build 4143

CleanShot 2023-07-24 at 10 34 29@2x
  1. No LSP.

  2. Other maybe relevant plugins I have installed: ECMAScript Syntax, PHP Companion, Vue Syntax Highlight

deathaxe commented 1 year ago

Did you set syntax to "HTML (Blade)" before calling view.settings().get(...)?

I'd expect

>>> view.settings().get("auto_complete_selector")
'( meta.tag | meta.embedded.directive ) - comment'

>>> view.settings().get("auto_complete_triggers")
[{'characters': '<', 'selector': 'text.html, text.xml'}, {'rhs_empty': True, 'selector': 'punctuation.accessor'}]

Listed syntaxes seem unrelated. Their code doesn't contain hints and I can't reproduce the issue, if they are installed.

You could try to log commands, to see whether anything is triggering auto_complete command when closing tags.

>>> sublime.log_commands()

Trying that I've not seen any command when typing >.

taylorotwell commented 1 year ago

Sorry, my settings match yours - forgot I had modified them trying to resolve the issue.

Logging commands doesn't show any commands being fired when the auto-complete window shows up.

So weird. 🙃

deathaxe commented 1 year ago

Indeed.

Blade is just inherits from ST's PHP and HTML re-using most syntax stuff and the html completion plugin. It extends core syntaxes in the same way as Vue and other packages.

Did you try to setup a completely vanilla ST with only Blade installed? Does it happen then, too?

taylorotwell commented 1 year ago

I have been able to narrow it down to something within Livewire 3's legacy_tests/Browser directory. When that directory is removed it does not happen. It also does not happen if I tell Sublime to not index "vendor" files (this file I mentioned is in my vendor directory).

Does the Blade plugin attempt to do anything intelligent based on the Blade declarations / components in other files in the application?

deathaxe commented 1 year ago

This package provide plain syntax definitions and a handful of completions. There's no plugin or any other kind of black magic provided.