Clean code
This commit is contained in:
parent
2fafbc8493
commit
5c9f074e05
|
@ -22,7 +22,7 @@ export const EditorModes: EditorModesMap = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildHelperInfoNode = (completion: any, helper: Helper) => {
|
const buildHelperInfoNode = (helper: Helper) => {
|
||||||
const ele = document.createElement("div")
|
const ele = document.createElement("div")
|
||||||
ele.classList.add("info-bubble")
|
ele.classList.add("info-bubble")
|
||||||
|
|
||||||
|
@ -83,9 +83,7 @@ const helpersToCompletion = (
|
||||||
const helper = helpers[helperName]
|
const helper = helpers[helperName]
|
||||||
return {
|
return {
|
||||||
label: helperName,
|
label: helperName,
|
||||||
info: (completion: BindingCompletionOption) => {
|
info: () => buildHelperInfoNode(helper),
|
||||||
return buildHelperInfoNode(completion, helper)
|
|
||||||
},
|
|
||||||
type: "helper",
|
type: "helper",
|
||||||
section: helperSection,
|
section: helperSection,
|
||||||
detail: "Function",
|
detail: "Function",
|
||||||
|
@ -236,10 +234,10 @@ export const jsHelperAutocomplete = (
|
||||||
return coreCompletion
|
return coreCompletion
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildBindingInfoNode = (
|
const buildBindingInfoNode = (binding: {
|
||||||
_completion: BindingCompletionOption,
|
valueHTML: string
|
||||||
binding: any
|
value: string | null
|
||||||
) => {
|
}) => {
|
||||||
if (!binding.valueHTML || binding.value == null) {
|
if (!binding.valueHTML || binding.value == null) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
@ -385,9 +383,7 @@ export const bindingsToCompletions = (
|
||||||
acc.push({
|
acc.push({
|
||||||
label:
|
label:
|
||||||
binding.display?.name || binding.readableBinding || "NO NAME",
|
binding.display?.name || binding.readableBinding || "NO NAME",
|
||||||
info: (completion: BindingCompletionOption) => {
|
info: () => buildBindingInfoNode(binding),
|
||||||
return buildBindingInfoNode(completion, binding)
|
|
||||||
},
|
|
||||||
type: "binding",
|
type: "binding",
|
||||||
detail: displayType,
|
detail: displayType,
|
||||||
section: bindingSectionHeader,
|
section: bindingSectionHeader,
|
||||||
|
|
Loading…
Reference in New Issue