fix(tui): match @ mention items by name, not description or uri (#32309)
This commit is contained in:
parent
e4d4b07e7d
commit
3e523d506c
@ -362,7 +362,8 @@ export function Autocomplete(props: {
|
|||||||
const text = `${res.name} (${res.uri})`
|
const text = `${res.name} (${res.uri})`
|
||||||
options.push({
|
options.push({
|
||||||
display: Locale.truncateMiddle(text, width),
|
display: Locale.truncateMiddle(text, width),
|
||||||
value: text,
|
// Match the name only; matching the URI caused unrelated fuzzy hits.
|
||||||
|
value: res.name,
|
||||||
description: res.description,
|
description: res.description,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
insertPart(res.name, {
|
insertPart(res.name, {
|
||||||
@ -492,7 +493,8 @@ export function Autocomplete(props: {
|
|||||||
.go(removeLineRange(searchValue), nonFileOptions, {
|
.go(removeLineRange(searchValue), nonFileOptions, {
|
||||||
keys: [
|
keys: [
|
||||||
(obj) => removeLineRange((obj.value ?? obj.display).trimEnd()),
|
(obj) => removeLineRange((obj.value ?? obj.display).trimEnd()),
|
||||||
"description",
|
// Match description for slash commands only; for "@" it surfaced unrelated items.
|
||||||
|
...(store.visible === "/" ? ["description" as const] : []),
|
||||||
(obj) => obj.aliases?.join(" ") ?? "",
|
(obj) => obj.aliases?.join(" ") ?? "",
|
||||||
],
|
],
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user