smartparens icon indicating copy to clipboard operation
smartparens copied to clipboard

Nested string inside `` in javascript

Open Fuco1 opened this issue 7 years ago • 1 comments

If we have a string in backquotes like so

const a = `foo "bar" baz`

The parsing of the inner "bar" is broken. This seems to be because both the backtick AND quote has string syntax. I have no idea how this is even possible in Emacs... syntax-ppss always reports to be inside the backtick-quoted string even if inside the quote-string (it probably ignores nested delimiters and only looks for the one that is marked in the beginning).

This is not covered in sp-get-string and related logic.

Expected behavior

The inner string should be parsed as sexp

Actual behavior

The inner string is not parsed as sexp

Environment & version information

  • smartparens version: 20171021.718
  • Active major-mode: js2-mode
  • Emacs version (M-x emacs-version): GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu) of 2017-10-25
  • Spacemacs/Evil/Other starterkit (specify which)/Vanilla: vanilla
  • OS: gnu/linux

Fuco1 avatar Nov 29 '17 12:11 Fuco1

This works fine now, we just need to add a test case.

Fuco1 avatar Mar 23 '24 17:03 Fuco1