Wrong language for syntax highlighting#312
Conversation
| StringBuilder after = readBlockUntilLine(stream, Integer.MAX_VALUE); | ||
|
|
||
| String language = selectLanguageClass(fileName); | ||
| String language = selectLanguageClass(fileName, before, marked, after); |
| final StringBuilder before, final StringBuilder marked, final StringBuilder after) { | ||
| String extension = StringUtils.substringAfterLast(fileName, "."); | ||
|
|
||
| if ("ts".equals(extension) && looksLikeMarkup(before, marked, after)) { |
There was a problem hiding this comment.
Simplify, no extra method is needed:
| if ("ts".equals(extension) && looksLikeMarkup(before, marked, after)) { | |
| if ("ts".equals(extension) && StringUtils.CS.contains(before, QT_LINGUIST_PATTERN)) { |
And QT_LINGUIST_PATTERN should be defined as "<!DOCTYPE TS>".
| "<?xml version=\"1.0\" encoding=\"utf-8\"?>", | ||
| "<TS version=\"2.1\"><context><name>MainWindow</name></context></TS>"), issue)); |
There was a problem hiding this comment.
Where did you get the example from? All my search results look like:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>MainWindow</name>
<message>
<source>Hello, world!</source>
<translation>Hello, world!</translation>
</message>
<message>
<source>File not found</source>
<translation>File not found</translation>
</message>
</context>
</TS>
☀️ Quality MonitorTests Coverage for New Code 〰️ Line Coverage: 100.00% — perfect 🎉 Coverage for Whole Project 〰️ Line Coverage: 78.57% — 90 missed lines Style Bugs Vulnerabilities🛡️ OWASP Dependency Check: 217 vulnerabilities — error: 17, high: 63, normal: 126, low: 11 Software Metrics 🌀 Cyclomatic Complexity: 156 (total) 🚦 Quality GatesOverall Status: ❗ UNSTABLE✅ Passed Gates
❌ Failed Gates
Created by Quality Monitor v4.11.0 (#484bbba). More details are shown in the GitHub Checks Result. |
|
Thanks! |
Wrong language for syntax highlighting
Fixes #280
Testing done
Submitter checklist