Skip to content

Commit

Permalink
fix(completion): prev text with uppercase should match
Browse files Browse the repository at this point in the history
Closes #4764
  • Loading branch information
chemzqm committed Sep 26, 2023
1 parent d9dce16 commit 249b9df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/completion/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export default class Complete {
if (item.delta > 0) {
// better input to make it have higher score and better highlight
let prev = filterText.slice(0, item.delta)
fuzzyResult = scoreFn(prev + input, prev + lowInput, 0, filterText, filterText.toLowerCase(), 0, scoreOption)
fuzzyResult = scoreFn(prev + input, prev.toLowerCase() + lowInput, 0, filterText, filterText.toLowerCase(), 0, scoreOption)
} else {
fuzzyResult = scoreFn(input, lowInput, 0, filterText, filterText.toLowerCase(), 0, scoreOption)
}
Expand Down
4 changes: 2 additions & 2 deletions src/completion/pum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { toNumber } from '../util/numbers'
import { byteIndex, byteLength, characterIndex, toText } from '../util/string'
import workspace from '../workspace'
import { CompleteOption, DurationCompleteItem } from './types'
import { getKindHighlight, getKindText, highlightOffert, MruLoader, Selection } from './util'
import { getKindHighlight, getKindText, highlightOffset, MruLoader, Selection } from './util'

export interface PumDimension {
readonly height: number
Expand Down Expand Up @@ -277,7 +277,7 @@ export default class PopupMenu {
switch (name) {
case 'abbr': {
if (!isFalsyOrEmpty(item.positions)) {
let pre = highlightOffert(len, item)
let pre = highlightOffset(len, item)
if (pre != -1) {
positionHighlights(hls, item.abbr, item.positions, pre, index, labelMaxLength)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/completion/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export function shouldIndent(indentkeys: string, pretext: string): boolean {
return false
}

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

0 comments on commit 249b9df

Please sign in to comment.