-
Bug
-
Resolution: Fixed
-
Low
-
6.10.0
-
None
-
Severity 3 - Minor
-
Issue Summary
For certain use cases of JavaScript, the syntax highlighting that is used when displaying the source of .js files is incorrect.
Steps to Reproduce
- Have a .js file with the following content
public something(callback: callback, options?: ConsumerOptions): Promise<Consumer> { console.info(`[${this.constructor.name}] Consumer creating.`); this.consumer = Consumer.create({ ...options, queueUrl: await this.getUrl(), handleMessage: message => { if (message.Body){ message.Body = JSON.parse(message.Body); } } }) }
- View the file in source view
Expected Results
The syntax is highlighted consistently, something like this way:
Actual Results
The syntax is highlighted incorrectly:
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available
Form Name |
---|
[BSERV-12857] Syntax highlighting is incorrect for certain JavaScript use cases
Remote Link | New: This issue links to "Page (Confluence)" [ 555799 ] |
Fix Version/s | New: 7.13.0 [ 95001 ] | |
Fix Version/s | New: 7.12.0 [ 94823 ] |
Resolution | Original: Not a bug [ 12 ] | New: Fixed [ 1 ] |
Status | Original: Closed [ 6 ] | New: Closed [ 6 ] |
Affects Version/s | Original: 7.13.0 [ 95001 ] |
Remote Link | New: This issue links to "Page (Confluence)" [ 553901 ] |
Resolution | New: Not a bug [ 12 ] | |
Status | Original: Needs Triage [ 10030 ] | New: Closed [ 6 ] |
Attachment | New: ts-highlighting-in-js.png [ 403924 ] |
Attachment | New: typescript-mode-highlighting.png [ 403923 ] |
Remote Link | New: This issue links to "SSP-49030 (Atlassian Support System)" [ 552631 ] |
The primary issue that is causing the syntax highlighting problem is that the source is highlighted with the JavaScript mode and the code is TypeScript. If the same content is passed through the TypeScript highlighter (and with a class around it to make it valid code) then we can see that the highlighting is correct:

There are two resolutions that can be taken here:
Regards,
John van der Loo
Developer, Bitbucket Server