Better selection for top excerpt

This commit is contained in:
Simon Cambier
2024-01-05 20:24:44 +01:00
parent 6b87578c44
commit c5efa2ec90
2 changed files with 13 additions and 4 deletions

View File

@@ -98,4 +98,13 @@ export class Query {
),
]
}
public getBestStringForExcerpt(): string {
// If we have quoted expressions, return the longest one
if (this.#inQuotes.length) {
return this.#inQuotes.sort((a, b) => b.length - a.length)[0] ?? ''
}
// Otherwise, just return the query as is
return this.segmentsToStr()
}
}