Working with backticks in PhpStorm / WebStorm

We recently changed our project templates to use single quotes to use backlinks. Working with backticks in * Storm on OSX is not as convenient as working with single quotes, so we tried to come up with some solutions that still have no convenience. We are looking for further ideas to find the best solutions.

How single quotes work in * Storm on OSX

  • entering one single quote result in two single quotation marks with the cursor between ('|')
  • entering text results in text between single quotes ("what was printed")
  • if the "choice of environment when entering a quote or parenthesis" is correct, selecting the text and entering single quotation results into text enclosed in single quotes ("some text")

How backticks work in * Storm on OSX

  • entering one return result leads to one result (`), when you press the spacebar, you get two backticks with the cursor between (` | `)
  • when entering a letter, you get two inverse elements with the cursor between them (`|`), except that the letter a, e, o, u, i, then you get (Γ , Γ¨, Γ², ΓΉ, Γ¬), which is quite disturbing.
  • when you press the spacebar, you get two inverse elements with the cursor between (`|`)
  • selecting text and entering the results of the reverse output in the opposite direction (`), which is also not what we would like to have
+5
source share
2 answers

Since the flip side is the default dead key , I am struggling with the same problem.

Living template

Currently, I have created a live template called -- (double-dash) to quickly create a subscript line. Below you can find the settings that I used for the template:


Abbreviation: --

Description: Backticks

Template text:

 `$0$`$END$ 

Apply: JavaScript


Unfortunately, PHPStorm / Webstorm does not provide a way to switch the quote style. Like case toggler (Edit -> Toggle Case)

+3
source

Regarding input

Just enter <backtick><space>a text and you will get `text '.

As for the surrounding

Create a Live Template called backticks with the contents of `$ SELECTION $` $ END $, set the context in Javascript. Go to the layout and find "Surround with Live Template". Assign a keyboard shortcut. Return to the editor, select the text, press the just assigned one and press 'ENTER' to confirm the selection of the 'backticks' template. This will close your text in backticks.

+2
source

Source: https://habr.com/ru/post/1263196/


All Articles