vim-matchup icon indicating copy to clipboard operation
vim-matchup copied to clipboard

Javascript/ES6: Tagged Template Literals support

Open thekaganugur opened this issue 6 years ago • 6 comments

`

should work the same way ( In the second line

// These are equivalent:
fn`some string here`
fn(['some string here'])

MDN Doc on Tagged Template Literal

thekaganugur avatar Apr 08 '19 07:04 thekaganugur

Does the fn part matter at all? Are you suggesting that % should move between the two backticks?

andymass avatar Apr 08 '19 16:04 andymass

Yes

thekaganugur avatar Apr 08 '19 20:04 thekaganugur

Is this working? I have in my after/ftplugin/javascript.vim:

set matchpairs+=`:`
"set matchpairs? -> matchpairs=(:),{:},[:],<:>,`:`

inside a javascript file:

`foo`

`bar`

The first foo backtick doesnt work, the second foo backtick goes to the first foo backtick, the first bar backtick goes to the second foo backtick and the second bar backtick goes to the first bar backtick:

+---+
|   |
v   |
`foo`
    ^
    |
+---+
|
`bar`
^   |
|   |
+---+

Thanks

davidsierradz avatar May 24 '19 15:05 davidsierradz

No, it's not currently supported. Unfortunately, it's difficult to accomplish, since there's no way to tell what is the start and what is the end. I think it would either need to rely on syntax highlighting, or count backticks on a single line.

Can tagged template literals span lines?

andymass avatar May 24 '19 15:05 andymass

Can tagged template literals span lines?

Yeah, all template literals, not only tagged ones.

I think if the implementation is difficult and/or performance is impacted, then this is not worth it (a nice to have at least)

davidsierradz avatar May 24 '19 20:05 davidsierradz

No, it's not currently supported. Unfortunately, it's difficult to accomplish, since there's no way to tell what is the start and what is the end.

Why? If the index of ` is even, it's the start, if it's odd it's the end. Only thing important is to not confuse ``` with `` or `

ashnur avatar Jul 29 '19 13:07 ashnur