Searching for Live Template in PhpStorm, from abbreviation (wrong expansion?)

Viewed 37

In PhpStorm, inside of a blade-file (some-view.blade.php) when I write this:

@php

Then my code completion-box pops up and suggests this:

@php
@endphp

If I click Enter or Tab, then it expands to this:

pphp()

... Which I don't want. I don't know if this is a bug or what it is, but based on the code completion suggestions, I can't make out, why that is the result of this.

Screenshots

HTML-expansion before (to show context)

HTML expansion before, PhpStorm Live Templates

When I hit Tab, then it expands to this:

HTML expansion after, PhpStorm live template

But if I try to add a blade-tag, like this:

PHP blade expansion before

then if I press either Tab or Enter, it expands to this:

PHP blade expansion after

Question 1 - Finding the live template

How do I find that live template that makes this expansion? I can't see it from the list of my 'Live Templates' in settings (see appendix 1 in the bottom).

Question 2 - Make new-line without accepting the suggestion

When the code completion-box is open, how do I make a new line, without accepting the top-suggestions?

In other words: How do I only accept code completion suggestions with tab (and not enter)?

I tried looking at the Code Completion documentation, but I couldn't find the answer.
I obviously also looked around the settings in PhpStorm.

Quickfix

As LazyOne pointed out in the comments, then a QuickFix is to remove the action from Enter, in the Keymap, for this action: Editor Actions | Choose Lookup Item.

I got that working and it's nice. But it's not the ideal solution, I'd say.

Solution attempt: Search Live templates

LazyOne linked to a way to search for Live Templates. But when I do that, I don't find anything:

Search for live template


Appendix 1 - All live templates

Live templates in settings, PhpStorm

Appendix 2 - Version and installed plugins

  • I have the Blade-plugin installed (bundled with PhpStorm).
  • PhpStorm version: 2022.1 (PS-221.5080.224, built on April 13, 2022)
  • I'm on a MacBook Pro (2020)

Answers to comments

HTML Live templates

Good point, about the context being HTML. Here are my HTML live templates:

HTML live templates

I did check them as well before the update of PhpStorm, and they didn't change - and doesn't explain the weird pphp()-thingy.


Ctrl + Space

I'm on a Mac.

  • If I press Ctrl + Space, then the keyboard-toggler opens (OS-functionality).
  • If I press CMD + Space, then Spotlight (or Alfred) opens up (OS-functionality).

I can't invoke this suggestion you're hinting at here.

UPDATE: I got it working, by disabling the MacOs-shortcut. But this shortcut gives me this:

Basic Code completion

How does this help me? :-)


Ctrl+Enter and Shift+Enter

While this is amazing! I was hoping to be able to change it so I never code complete with Enter (but always and only can do it with Tab). Since, when you're coding fastly, I don't want a new-line to be conditional to if PhpStorm suggests something or not. Can this be done?


LazyOne's comment about what happens for her/him upon @php + Tab

Thanks for the thorough testing! Maybe it's something in my setup. Hmm.

But are there a way, where I can search my Live Templates for, which of them have been invokes/used, so I can deactivate/delete them?


Updated PhpStorm (this is where it gets weird!!)

Okay... So I updated PhpStorm to version 2022.2.1. When I opened PhpStorm again and tried writing @php and press Tab and hurray, it expanded to...

@php

@endphp

So I wrote the comment you can see in the comment section.

HOWEVER!! PhpStorm was still indexing. And when it was finished indexing (which took a real long time, like 10-15 minutes), then @php + Tab was back to expanding to:

phpp()

So that must mean that this is somewhere in a file that is being indexed?!

0 Answers
Related