Structural Search Inspection on a string on HTML and Twig files

I'm trying to create a simple Structural Search Inspection that just searches for a string, but can't seem to get anything to work.

If I create a Structural Search with the variable $abc$ and set it to the Text Filter of `(\'|\")abc(\'|\")`, the regex seems to checkout but nothing is ever found in the files. If I do something similar in a PHP file, it does come up with results.

Any ideas on what I may be doing wrong? While I've tested this and have been unable to get it to work in the HTML File Type, ultimately, I'd like to be able to run it on a Twig File Type which doesn't appear as an option in the File Type menu. Is there any way to add custom File Types or Scopes that target file types that I'd like the  *.twig files? I have created a Scope which targets *.twig files, and that seems to work, but the Scope and File Type settings still don't match in the Structural Search Inspection and I don't know which of those take precedence when running an inspection.

0

I tried using your Text Filter and got Structural Search working for both HTML and Twig, but the inspection only works for HTML, I think SSR inspections just don't work for Twig.

Here's a screencast: https://drive.google.com/file/d/1V-BmNPrsN8HgXO-hUqYYpXneGADuBG2s/view?usp=drivesdk

Unfortunately, there's no way to add custom file types to Structural Search, so please submit the SSR inspection Twig issue to our tracker: https://youtrack.jetbrains.com/newIssue?project=WI

0
Avatar
Permanently deleted user

Thanks, Eugene. I'll open a ticket.

It seems another small issue I may have is that I reassigned the *.html File Type to Twig files in Editor->File Types as I primarily work with Twig files. It seems that may also be part of why I get inconsistent results using the Inspections. I I change that pattern to apply to HTML files again, I at least see the HTML results now.

 

0

请先登录再写评论。