Don't allow helpers on snippets
This commit is contained in:
parent
e3ef74769b
commit
304e66735b
|
@ -91,7 +91,10 @@
|
||||||
$: bindingCompletions = bindingsToCompletions(enrichedBindings, editorMode)
|
$: bindingCompletions = bindingsToCompletions(enrichedBindings, editorMode)
|
||||||
$: bindingHelpers = new BindingHelpers(getCaretPosition, insertAtPos)
|
$: bindingHelpers = new BindingHelpers(getCaretPosition, insertAtPos)
|
||||||
$: hbsCompletions = getHBSCompletions(bindingCompletions)
|
$: hbsCompletions = getHBSCompletions(bindingCompletions)
|
||||||
$: jsCompletions = getJSCompletions(bindingCompletions, snippets, useSnippets)
|
$: jsCompletions = getJSCompletions(bindingCompletions, snippets, {
|
||||||
|
useHelpers: allowHelpers,
|
||||||
|
useSnippets,
|
||||||
|
})
|
||||||
$: {
|
$: {
|
||||||
// Ensure a valid side panel option is always selected
|
// Ensure a valid side panel option is always selected
|
||||||
if (sidePanel && !sidePanelOptions.includes(sidePanel)) {
|
if (sidePanel && !sidePanelOptions.includes(sidePanel)) {
|
||||||
|
@ -111,13 +114,20 @@
|
||||||
const getJSCompletions = (
|
const getJSCompletions = (
|
||||||
bindingCompletions: BindingCompletionOption[],
|
bindingCompletions: BindingCompletionOption[],
|
||||||
snippets: Snippet[] | null,
|
snippets: Snippet[] | null,
|
||||||
useSnippets?: boolean
|
config: {
|
||||||
|
useHelpers: boolean
|
||||||
|
useSnippets: boolean
|
||||||
|
}
|
||||||
) => {
|
) => {
|
||||||
const completions: BindingCompletion[] = [
|
const completions: BindingCompletion[] = [
|
||||||
jsAutocomplete([...bindingCompletions]),
|
jsAutocomplete([...bindingCompletions]),
|
||||||
jsHelperAutocomplete([...getHelperCompletions(EditorModes.JS)]),
|
|
||||||
]
|
]
|
||||||
if (useSnippets && snippets) {
|
if (config.useHelpers) {
|
||||||
|
completions.push(
|
||||||
|
jsHelperAutocomplete([...getHelperCompletions(EditorModes.JS)])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (config.useSnippets && snippets) {
|
||||||
completions.push(snippetAutoComplete(snippets))
|
completions.push(snippetAutoComplete(snippets))
|
||||||
}
|
}
|
||||||
return completions
|
return completions
|
||||||
|
|
|
@ -118,6 +118,7 @@
|
||||||
allowHBS={false}
|
allowHBS={false}
|
||||||
allowJS
|
allowJS
|
||||||
allowSnippets={false}
|
allowSnippets={false}
|
||||||
|
allowHelpers={false}
|
||||||
showTabBar={false}
|
showTabBar={false}
|
||||||
placeholder="return function(input) ❴ ... ❵"
|
placeholder="return function(input) ❴ ... ❵"
|
||||||
value={code}
|
value={code}
|
||||||
|
|
Loading…
Reference in New Issue