Skip to content

Commit 249b9df

Browse files
committed
fix(completion): prev text with uppercase should match
Closes #4764
1 parent d9dce16 commit 249b9df

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/completion/complete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ export default class Complete {
293293
if (item.delta > 0) {
294294
// better input to make it have higher score and better highlight
295295
let prev = filterText.slice(0, item.delta)
296-
fuzzyResult = scoreFn(prev + input, prev + lowInput, 0, filterText, filterText.toLowerCase(), 0, scoreOption)
296+
fuzzyResult = scoreFn(prev + input, prev.toLowerCase() + lowInput, 0, filterText, filterText.toLowerCase(), 0, scoreOption)
297297
} else {
298298
fuzzyResult = scoreFn(input, lowInput, 0, filterText, filterText.toLowerCase(), 0, scoreOption)
299299
}

src/completion/pum.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { toNumber } from '../util/numbers'
99
import { byteIndex, byteLength, characterIndex, toText } from '../util/string'
1010
import workspace from '../workspace'
1111
import { CompleteOption, DurationCompleteItem } from './types'
12-
import { getKindHighlight, getKindText, highlightOffert, MruLoader, Selection } from './util'
12+
import { getKindHighlight, getKindText, highlightOffset, MruLoader, Selection } from './util'
1313

1414
export interface PumDimension {
1515
readonly height: number
@@ -277,7 +277,7 @@ export default class PopupMenu {
277277
switch (name) {
278278
case 'abbr': {
279279
if (!isFalsyOrEmpty(item.positions)) {
280-
let pre = highlightOffert(len, item)
280+
let pre = highlightOffset(len, item)
281281
if (pre != -1) {
282282
positionHighlights(hls, item.abbr, item.positions, pre, index, labelMaxLength)
283283
} else {

src/completion/util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ export function shouldIndent(indentkeys: string, pretext: string): boolean {
260260
return false
261261
}
262262

263-
export function highlightOffert<T extends { filterText: string, abbr: string }>(pre: number, item: T): number {
263+
export function highlightOffset<T extends { filterText: string, abbr: string }>(pre: number, item: T): number {
264264
let { filterText, abbr } = item
265265
let idx = abbr.indexOf(filterText)
266266
if (idx == -1) return -1

0 commit comments

Comments
 (0)