Skip to content

Commit

Permalink
Cb 5448 sql assist doesnt work after alias with enabled use long obje…
Browse files Browse the repository at this point in the history
…ct names (#3140)

* CB-5448 adds replacementOffset logic to autocomplete so we have table long names setting

* CB-5448 cleanup

* CB-5448 cleanup

* CB-5448 pr fixes

---------

Co-authored-by: Evgenia <[email protected]>
  • Loading branch information
sergeyteleshev and EvgeniaBzzz authored Dec 30, 2024
1 parent 3bcbf34 commit efd0be6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const CLOSE_CHARACTERS = /[\s()[\]{};:>,=\\*]/;
const COMPLETION_WORD = /[\w*]*/;

export function useSqlDialectAutocompletion(data: ISQLEditorData): [Compartment, Extension] {
const { closeCompletion, useEditorAutocompletion } = useComplexLoader(codemirrorComplexLoader);
const { closeCompletion, useEditorAutocompletion, insertCompletionText } = useComplexLoader(codemirrorComplexLoader);
const localizationService = useService(LocalizationService);
const optionsRef = useObjectRef({ data });

Expand Down Expand Up @@ -56,7 +56,9 @@ export function useSqlDialectAutocompletion(data: ISQLEditorData): [Compartment,
return [
...filteredProposals.map<SqlCompletion>(proposal => ({
label: proposal.displayString,
apply: proposal.replacementString,
apply: (view, completion, from, to) => {
view.dispatch(insertCompletionText(view.state, proposal.replacementString, proposal.replacementOffset, to));
},
boost: proposal.score,
icon: proposal.icon,
})),
Expand Down

0 comments on commit efd0be6

Please sign in to comment.