Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 493848

Summary: [es6] backtick strings should be shown using the string color
Product: [ECD] Orion Reporter: Olivier Thomann <Olivier_Thomann>
Component: EditorAssignee: Grant Gayed <grant_gayed>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, grant_gayed, Michael_Rennie
Version: 11.0   
Target Milestone: 12.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed patch
none
Proposed patch
none
The multiline string doesn't seem to work for single or double quotes either.
none
Proposed patch none

Description Olivier Thomann CLA 2016-05-17 16:39:23 EDT
In ecma6, the back tick is a valid string delimeter. Same as single or double quotes.
Right now we do support the parsing of these new string literals, but it is not shown using the string color.
Comment 1 Olivier Thomann CLA 2016-05-17 16:41:50 EDT
Created attachment 261810 [details]
Proposed patch

Once the environment is restarted with that patch, the backtick strings are shown in blue (the default string color)
Comment 2 Olivier Thomann CLA 2016-05-17 16:43:38 EDT
Created attachment 261811 [details]
Proposed patch

I forgot to update the copyrights
Comment 3 Grant Gayed CLA 2016-05-17 16:54:43 EDT
The single-line rule can just live in the javascript syntax.js rather than lib/syntax.js since it's not shared with any other languages.

It looks like the multi-line rule has a problem (though I haven't tried the patch), as it still starts with a double quote rather than a backtick.
Comment 4 Olivier Thomann CLA 2016-05-17 17:07:31 EDT
Ok, I'll provide a fix for it.
Comment 5 Olivier Thomann CLA 2016-05-17 17:24:06 EDT
Created attachment 261812 [details]
The multiline string doesn't seem to work for single or double quotes either.

Should not we have the whole multi-line string in the string color?
Comment 6 Grant Gayed CLA 2016-05-17 17:37:43 EDT
(In reply to Olivier Thomann from comment #5)

Yes, something's changed here, I've logged bug 493852.
Comment 7 Olivier Thomann CLA 2016-05-17 17:40:29 EDT
OK, I need more work there as the backtick strings can be multilined without using \.
I'll see what that means for the regex pattern.
Comment 8 Michael Rennie CLA 2016-05-18 10:48:57 EDT
For template literals (backtick strings), one thing to keep in mind while updating the syntax colouration, is that the string can contain expressions.

For example:

var a = 5;
var b = 10;
console.log(`Fifteen is ${a + b} and\nnot ${2 * a + b}.`);

so I would expect the stuff inside the ${} sections to be coloured as it would be outside of the template.
Comment 9 Olivier Thomann CLA 2016-05-18 11:01:04 EDT
Created attachment 261828 [details]
Proposed patch

This patch would make backtick strings looking like other string literals for single line template. I don't think this is what Michael expects.
I didn't try to add multiline highlighting as it doesn't work for normal string literals.
Comment 10 Grant Gayed CLA 2016-06-06 15:26:57 EDT
Released, with string interpolation, commit: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=6953343accfe2cfe01c54631174b1c7d5169ce9e .