mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
dbeaver/pro#6411 check for includes also (#3655)
Co-authored-by: Evgenia <139753579+EvgeniaBzzz@users.noreply.github.com>
This commit is contained in:
+13
-10
@@ -36,16 +36,19 @@ export function useSqlDialectAutocompletion(data: ISQLEditorData): [Compartment,
|
||||
sanitizeProposal(displayString) === wordLowerCase || replacementString.toLocaleLowerCase() === wordLowerCase,
|
||||
);
|
||||
const filteredProposals = proposals
|
||||
.filter(
|
||||
({ replacementString, displayString }) => {
|
||||
const display = sanitizeProposal(displayString);
|
||||
const replacement = replacementString.toLocaleLowerCase();
|
||||
|
||||
return word === '*' ||
|
||||
(display !== wordLowerCase && display.startsWith(wordLowerCase)) ||
|
||||
(replacement !== wordLowerCase && replacement.startsWith(wordLowerCase));
|
||||
.filter(({ replacementString, displayString }) => {
|
||||
if (word === '*') {
|
||||
return true;
|
||||
}
|
||||
)
|
||||
|
||||
const display = sanitizeProposal(displayString);
|
||||
const replacement = replacementString.toLocaleLowerCase();
|
||||
|
||||
const displayMatch = display !== wordLowerCase && (display.startsWith(wordLowerCase) || display.includes(wordLowerCase));
|
||||
const replacementMatch = replacement !== wordLowerCase && (replacement.startsWith(wordLowerCase) || replacement.includes(wordLowerCase));
|
||||
|
||||
return displayMatch || replacementMatch;
|
||||
})
|
||||
.sort((a, b) => (b.score ?? 0) - (a.score ?? 0));
|
||||
|
||||
if (filteredProposals.length === 0 && !hasSameName && explicit) {
|
||||
@@ -156,4 +159,4 @@ export function useSqlDialectAutocompletion(data: ISQLEditorData): [Compartment,
|
||||
|
||||
function sanitizeProposal(value: string): string {
|
||||
return value.replace(/^"|"$/g, '').toLocaleLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user