mirror of
https://github.com/enso-org/enso.git
synced 2024-12-24 19:03:27 +03:00
Fix Component Browser aliases (#9163)
- Fix #9107 - Allow matching initials of aliases - Allow matching spaces instead of underscores (aliases use spaces, not underscores) - Fix only the first alias being detected. This is due to incorrect docs parsing keeping the leading space - `foo, bar` turns into `["foo", " bar"]` # Important Notes None
This commit is contained in:
parent
c69ba4ee70
commit
fecdd534b1
@ -59,7 +59,9 @@ class FilteringWithPattern {
|
||||
// - The unmatched rest of the word, up to, but excluding, the next underscore
|
||||
// - The unmatched words before the next matched word, including any underscores
|
||||
this.wordMatchRegex = new RegExp(
|
||||
'(^|.*?_)(' + escapeStringRegexp(pattern).replace(/_/g, ')([^_]*)(.*?)(_') + ')([^_]*)(.*)',
|
||||
'(^|.*?_)(' +
|
||||
escapeStringRegexp(pattern).replace(/_/g, ')([^_]*)(.*?)([_ ]') +
|
||||
')([^_]*)(.*)',
|
||||
'i',
|
||||
)
|
||||
if (pattern.length > 1 && !/_/.test(pattern)) {
|
||||
@ -72,7 +74,7 @@ class FilteringWithPattern {
|
||||
const regex = pattern
|
||||
.split('')
|
||||
.map((c) => `(${c})`)
|
||||
.join('([^_]*?_)')
|
||||
.join('([^_]*?[_ ])')
|
||||
this.initialsMatchRegex = new RegExp('(^|.*?_)' + regex + '(.*)', 'i')
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,10 @@ export function documentationData(
|
||||
documentation: parsed,
|
||||
...(iconName != null ? { iconName } : {}),
|
||||
...(groupIndex != null ? { groupIndex } : {}),
|
||||
aliases: tagValue(parsed, 'Alias')?.split(',') ?? [],
|
||||
aliases:
|
||||
tagValue(parsed, 'Alias')
|
||||
?.trim()
|
||||
.split(/\s*,\s*/g) ?? [],
|
||||
isPrivate: isSome(tagValue(parsed, 'Private')),
|
||||
isUnstable: isSome(tagValue(parsed, 'Unstable')) || isSome(tagValue(parsed, 'Advanced')),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user