Chain it
This commit is contained in:
parent
3a12111474
commit
43a896fa5a
|
@ -7,7 +7,8 @@ import {
|
||||||
Helper,
|
Helper,
|
||||||
Snippet,
|
Snippet,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { CompletionContext } from "@codemirror/autocomplete"
|
import { CompletionContext, startCompletion } from "@codemirror/autocomplete"
|
||||||
|
import { EditorView } from "@codemirror/view"
|
||||||
|
|
||||||
export const EditorModes: EditorModesMap = {
|
export const EditorModes: EditorModesMap = {
|
||||||
JS: {
|
JS: {
|
||||||
|
@ -102,7 +103,7 @@ export const helpersToCompletion = (
|
||||||
section: helperSection,
|
section: helperSection,
|
||||||
detail: "Function",
|
detail: "Function",
|
||||||
apply: (
|
apply: (
|
||||||
view: any,
|
view: EditorView,
|
||||||
_completion: BindingCompletion,
|
_completion: BindingCompletion,
|
||||||
from: number,
|
from: number,
|
||||||
to: number
|
to: number
|
||||||
|
@ -139,7 +140,7 @@ export const snippetAutoComplete = (snippets: Snippet[]) => {
|
||||||
type: "text",
|
type: "text",
|
||||||
simple: true,
|
simple: true,
|
||||||
apply: (
|
apply: (
|
||||||
view: any,
|
view: EditorView,
|
||||||
completion: BindingCompletion,
|
completion: BindingCompletion,
|
||||||
from: number,
|
from: number,
|
||||||
to: number
|
to: number
|
||||||
|
@ -247,7 +248,7 @@ export const jsHelperAutocomplete = (baseCompletions: BindingCompletion[]) => {
|
||||||
label: "helpers.",
|
label: "helpers.",
|
||||||
detail: "Helpers utilities",
|
detail: "Helpers utilities",
|
||||||
apply: (
|
apply: (
|
||||||
view: any,
|
view: EditorView,
|
||||||
_completion: BindingCompletion,
|
_completion: BindingCompletion,
|
||||||
from: number,
|
from: number,
|
||||||
to: number
|
to: number
|
||||||
|
@ -260,6 +261,9 @@ export const jsHelperAutocomplete = (baseCompletions: BindingCompletion[]) => {
|
||||||
EditorModes.JS,
|
EditorModes.JS,
|
||||||
AutocompleteType.TEXT
|
AutocompleteType.TEXT
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Trigger again the completion, to chain it with the helpers completion
|
||||||
|
startCompletion(view)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -342,7 +346,7 @@ const enum AutocompleteType {
|
||||||
|
|
||||||
// Autocomplete apply behaviour
|
// Autocomplete apply behaviour
|
||||||
export const insertBinding = (
|
export const insertBinding = (
|
||||||
view: any,
|
view: EditorView,
|
||||||
from: number,
|
from: number,
|
||||||
to: number,
|
to: number,
|
||||||
text: string,
|
text: string,
|
||||||
|
@ -386,7 +390,7 @@ export const insertBinding = (
|
||||||
}
|
}
|
||||||
|
|
||||||
export const insertSnippet = (
|
export const insertSnippet = (
|
||||||
view: any,
|
view: EditorView,
|
||||||
from: number,
|
from: number,
|
||||||
to: number,
|
to: number,
|
||||||
text: string
|
text: string
|
||||||
|
@ -448,8 +452,8 @@ export const bindingsToCompletions = (
|
||||||
detail: displayType,
|
detail: displayType,
|
||||||
section: bindingSectionHeader,
|
section: bindingSectionHeader,
|
||||||
apply: (
|
apply: (
|
||||||
view: any,
|
view: EditorView,
|
||||||
completion: BindingCompletion,
|
_completion: BindingCompletion,
|
||||||
from: number,
|
from: number,
|
||||||
to: number
|
to: number
|
||||||
) => {
|
) => {
|
||||||
|
|
Loading…
Reference in New Issue