vscode-edge icon indicating copy to clipboard operation
vscode-edge copied to clipboard

unmatched single quote affects syntax highlighting when using .replace(/'/g, "%27") in @set

Open andyford opened this issue 4 years ago • 0 comments

Hi,

I was using @set('share_text_encoded', urlEncode(open_graph_title)) to encode strings for later usage in links and this was fine. But I later found that single quotes were not being encoded which broke some other code.

The solution was to use replace(/'/g, "%27") to explicitly encode the single quotes @set('share_text_encoded', urlEncode(open_graph_title).replace(/'/g, "%27"))

this is also working just fine BUT it breaks syntax highlighting (presumably because the single quote in the replace method is unmatched.

The attached gif shows all subsequent text turning green when the line with .replace(/'/g, "%27") is uncommented

andyford avatar Oct 23 '20 21:10 andyford