QUESITON: WebStorm (What do lines in editor with dark green background mean?)

I'm not sure what I did.

Dark green lines are in the editor and I am unable to remove the coloring. I tried closing the project and WebStormm, and then reopening the project in WebStorm. The green background line remain.

What do these green lines signify?

Here's what I see:

greenBackGround1.png
greenBackGround2.png



QUESTIONS:

  1. What do the dark green lines mean?
  2. Did I do something to cause these dark green lines to be displayed in the editor?
  3. How do I get rid of the dark green lines?

4 comments
Comment actions Permalink

Hi there,

What do you see if you place your caret in such "problematic green" place and invoke Quick Fix menu (Alt+Enter on Windows)?

So far it looks language Injection fragment. You can review injection settings at "Settings (Preferences on Mac) | Editor | Language Injections" -- just look for entries created by user (will have "IDE" or "Project" in "Scope" column). Just disable all such user-created suspicious entries (you may then delete offending one later) and see if it will make any difference.

0
Comment actions Permalink
invoke Quick Fix menu (Alt+Enter on Windows)?



Thanks for responding, Andriy.

Your posts have been very helpful, and I appreciate your guidance.

What is Quick Fix? When I try HELP -> SEARCH, nothing is found. Is there a menu item under a slightly different name?

I'm on a Mac, so alt is probably "option" (i.e., opt)  for me.

I placed the insertion point in a dark-green background line, and pressed opt-enter. Here's what I see:

1-opt-enter-quick-fix.png

Next I chose "Edit Apple JS Fragment" so see what got injected.

A pane opens below with a tab titled "Apple JS Fragament (index.html:759).js".

2-opt-enter-edit.png

The insertion point appears in the middle at line 11. There appear to a total of 19 lines. All lines seem to be blank.

What's going on here? What are these 19 blank lines?

I closed the tab, and then placed in insertion point back in the dark green background, and pressed opt-enter once more.

But this time a different popup menu appears. It's titled Generate.

3-opt-enter-generate.png

What's more, now I get the Generate popup menu wherever the green background line found and I press opt-enter.

Why doesn't the original popup menu re-appear?

I though I could get the original popup to appear and then choose "Un-inject Language/Reference". But that doesn't seem possible now, because that popup menu no longer appears when I press opt-enter in a dark green background line.

Here's what my Editor Preferences show for "Language Injections":

language-injections.png



QUESTIONS:

  1. What is an "injection"?
  2. What is actually being injected?
  3. Why did an "injection" appear with only blank lines?
  4. Why can't I get back the original Quick Fix popup menu?
  5. Is there a Quick Fix menu item?
  6. How does WebStorm know what lines (that is, the dark green background) lines should be colored dark green?
  7. What am I missing here?

0
Comment actions Permalink
What is Quick Fix? When I try HELP -> SEARCH, nothing is found. Is there a menu item under a slightly different name?

"Preferences | Keymap" have "Search by shortcut" action (next to search field) -- you can use it to find proper name for the action. In this particular case it's "Other | Show Intention Actions".

"Quick Fix" -- possibly that's how it was called in the past. But at least this is the name I often saw used by devs/support team. Considering the nature of what it does/has to offer .. it's rather good name as for me.

I placed the insertion point in a dark-green background line, and pressed opt-enter. Here's what I see:

That's exactly what I wanted to see. You can also get this menu when you click on Light Bulb icon (and you have used it already when downloading JS library).

Here's what my Editor Preferences show for "Language Injections":

Somehow you have injected "Apple JS" inside <body> tag .. Most likely misclick somewhere when typing (just a guess ... because I see other people having similar issue from time to time; no clue how it may happen --  I did not managed to getmyself into such situation yet (different kinds of files/file sizes?); possibly it has something to do with typing delay .. especially if you are invoking code completion popup manually (Alt+Space); ....)

Just delete 4th rule from the top (the one that has "IDE" in last column) and everything will be back to normal.

Next I chose "Edit Apple JS Fragment" so see what got injected.

If you would choose "Un-inject language/Reference" then it would disable that injection rule and it will be back to normal (rule will still be there but will not be activate).

Is there a Quick Fix menu item?


Not really -- only via shortcut or Light Bulb icon. Although on Code Inspection results window it is available as separate menu item/button (but that's different story).


-----


Two more rather PhpStorm-specific blog posts that may give you more general info:

0

Please sign in to leave a comment.