mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-23 07:10:41 +00:00
Sort string completions alphabetically
This commit is contained in:
@@ -180,9 +180,11 @@ function StringHead({ type, optional, excludeStrings, node, ctx }: Props<StringT
|
|||||||
}, [value, onChangeValue])
|
}, [value, onChangeValue])
|
||||||
|
|
||||||
const completions = useMemo(() => {
|
const completions = useMemo(() => {
|
||||||
return getValues(type, { ...ctx, offset: node?.range.start ?? 0 })
|
const values = getValues(type, { ...ctx, offset: node?.range.start ?? 0 })
|
||||||
.filter(c => c.kind === 'string' && c.value !== 'THIS')
|
.filter(c => c.kind === 'string' && c.value !== 'THIS')
|
||||||
.filter(c => !excludeStrings?.includes(c.value))
|
.filter(c => !excludeStrings?.includes(c.value))
|
||||||
|
values.sort((a, b) => a.value.localeCompare(b.value))
|
||||||
|
return values
|
||||||
}, [type, excludeStrings, node, ctx])
|
}, [type, excludeStrings, node, ctx])
|
||||||
|
|
||||||
const datalistId = `mcdoc_completions_${hexId()}`
|
const datalistId = `mcdoc_completions_${hexId()}`
|
||||||
|
|||||||
Reference in New Issue
Block a user