Skip to content

Commit 396e6db

Browse files
committed
(chore) disable auto-detect for properties
Properties is leaving :common in v11 and honestly there are no narrow rules here to give us real relevance. Since we are now widening the key rule even further this problem would become even worse. Therefore, we will disable auto-detect.
1 parent f81ebe1 commit 396e6db

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Version next
22

3-
- fix(properties) fix incorrect handling of non-alphanumeric keys [Egor Rogov][]
3+
- chore(properties) disable auto-detection #3102 [Josh Goebel][]
4+
- fix(properties) fix incorrect handling of non-alphanumeric keys #3102 [Egor Rogov][]
45
- enh(parser) Detect comments based on english like text, rather than keyword list [Josh Goebel][]
56
- enh(shell) add alias ShellSession [Ryan Mulligan][]
67
- enh(shell) consider one space after prompt as part of prompt [Ryan Mulligan][]

src/languages/properties.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Website: https://en.wikipedia.org/wiki/.properties
55
Category: common, config
66
*/
77

8+
/** @type LanguageFn */
89
export default function(hljs) {
910
// whitespaces: space, tab, formfeed
1011
const WS0 = '[ \\t\\f]*';
@@ -37,6 +38,7 @@ export default function(hljs) {
3738

3839
return {
3940
name: '.properties',
41+
disableAutodetect: true,
4042
case_insensitive: true,
4143
illegal: /\S/,
4244
contains: [
@@ -47,28 +49,24 @@ export default function(hljs) {
4749
returnBegin: true,
4850
variants: [
4951
{
50-
begin: KEY + EQUAL_DELIM,
51-
relevance: 1
52+
begin: KEY + EQUAL_DELIM
5253
},
5354
{
54-
begin: KEY + WS_DELIM,
55-
relevance: 0
55+
begin: KEY + WS_DELIM
5656
}
5757
],
5858
contains: [
5959
{
6060
className: 'attr',
6161
begin: KEY,
62-
endsParent: true,
63-
relevance: 0
62+
endsParent: true
6463
}
6564
],
6665
starts: DELIM_AND_VALUE
6766
},
6867
// case of an empty key
6968
{
7069
className: 'attr',
71-
relevance: 0,
7270
begin: KEY + WS0 + '$'
7371
}
7472
]

0 commit comments

Comments
 (0)