Mark the code item with color

Can I mark $store the some color and remove underline?

 

 

0
25 comments

Hi there,

You can try Better Highlights plugin, the Paid version says it can highlight anything using RegEx.

https://plugins.jetbrains.com/plugin/12895-better-highlights

  • [PAID] Highlight keywords, methods and functions (syntax highlight).
  • [PAID] Highlight anything by RegExp.
  • [PAID] Define highlight severity for comment/tokens/regexp.
0

I tried to make this using inspections but no success

0
Hello,
As far as I see, in the screenshot the $store property is highlighted as a warning. Could you please share the complete code snippet so we can better understand your requirements?
0

Yes, as warning, I added $root as example also 

if (typeof existentGetNumber === 'number' && event === this.mode) {
    const root = this.$root;
    this.$store.category.pageNumber = 1; // Reset page number to 1 because load more items removed
    this.$dispatch('reset-load-more-counter', {message: `Switch the other list length`});
}

0
Hello Max,
Could you please clarify if you want to apply special styling to this particular member? Or do you want to change the style of the warning(the underline, color)? What warning is it? Could you please share a screenshot of the Problems tool window? Unfortunately, the code snippet outside the project context does not allow us to reproduce the current behavior. It would be of great help if you could share a small example so we can test it locally. 
0

Hello Natalia,

I want just to color ApineJS “magic values” such as $root, $watch, $dispatch, $el (the short stable list) with yellow, for example.

That is the “screenshot of the Problems tool window” you need?

 

 

0

Hello Max, 

As far as I understand, you use a structural search to highlight specific keywords. However, the underlining can be displayed if the default IDE highlighting is applied. For example, in this case, my custom highlighting is applied together with the JSUnresolvedReference inspection's highlighting:

In this case, I can suppress the default JSUnresolvedReference inspection to get rid of the ​underlining.

So, you need to understand whether any other inspections are applied in your code. If this is not the case, I will need to test your example together with the IDE style preferences(you can export them to the  Project.xml file in Settings | Editor | Inspections).  

Also, here is what I mean by the Problems tool window:

0

Hello Natalia,

Tried to di the same but didn't get the result but anyway I  just want to apply mark color in  same cases like $root. $store, $ dispatch. I tried to use structural  search but no success

0
Hello Max, the solution with the structural search inspection worked on my side(see the screenshots in my previous reply). Could you please share your example and project style settings as I requested above so I can test your approach on my side? With this information, I will be in a better position to determine why this approach did not work out for you.
0

Hello Natalia,

Ok, let's go step by step:

1. Add this.$store.category.pageNumber = 1; this.root = this.$root; in some method.

2. Go to Settings → Editor → Inspections

3. Add Structural Search Inspection

4. Draft template → search template: this.root → ok. Language: Javascript. File: php + HTML + AlpineJs, extension: phtml

5. Add this.$store template, clone

6. Add severity and select it in “Hightlight in editor” 

7. Ok and nothing 

0

Ah, I got

Restart, just opened setting and tried to save ad again ….

0

UPD: sudo chmod a+w -R .idea/* was the fix but the same

0
Hello Max, 
Yes, the process looks similar to me. However, it is not completely clear where you specify 'File' and 'extension' in point 4. Could you please share a screenhsot? Also, I tested .js files. Please clarify in what files you wish to see the highlighting?
0

Hello Natalia,

1. I adder draft template

2.  Search template: this.$root

3. Language: Javascript

File details:

1; Extension: phtml

2. Used languages inside: php, html, Alpine (js)

 

0
Hello,
Thank you for the clarification. I tested this functionality in a JS file. Please share the complete file or an example that I could use for testing. Also, please specify what IDE version you are using.
0
Hello,
Thank you for the clarification. I tested this functionality in a JS file. Please share the complete file or an example that I could use for testing. Also, please specify what IDE version you are using.
0

Hello Natalia,

PhpStorm 2025.1
Build #PS-251.23774.436, built on April 14, 2025


File: basic-forms-03.zip

0
Thanks, but you mentioned that you test this functionality in a .phtml file. Could you share it?
0

Shared above as zip. I checked, shared well

0
Thank you, Max. 
I think I found the cause of the issue. I tested this functionality in PhpStorm 2025.1, Build #PS-251.23774.436, and it did not work. However, after updating to PhpStorm 2025.1, Build #PS-251.23774.436, the same project works correctly. Please refer to the attached screenshots. Could you please try upgrading the IDE? 

0

My build is

PhpStorm 2025.1.0.1
Build #PS-251.23774.466, built on April 24, 2025

 

0
Could you please go to Settings | Editor | Inspections, click on the gear icon -> Export.... And share the resulting file with me?
0

OMG, suddenly it started to work. Only one question, how to remove underscore from store?

0
This underlying must be coming from some other inspection. You can disable, suppress it, or modify the highlighting. Please refer to the attached video. If you can't find the required inspection, please share a screenshot of the Problems tool window fr the file.
0

Please sign in to leave a comment.