more improvements

This commit is contained in:
Joeri Exelmans 2025-05-19 15:43:11 +02:00
parent d877b42a12
commit ec2944cdb7
5 changed files with 63 additions and 214 deletions

View file

@ -53,7 +53,7 @@ const computeSuggestions = (text, env, suggestionPriority: (s: ResolvedType) =>
kind: type.kind || "value",
}]),
]
return []; // <-- uncomment to disable suggestions (useful for debugging)
// return []; // <-- uncomment to disable suggestions (useful for debugging)
return ls
.map(suggestion => [suggestionPriority(suggestion[2]), ...suggestion] as PrioritizedSuggestionType)
.sort(([priorityA], [priorityB]) => priorityB - priorityA)
@ -88,7 +88,12 @@ export function InputBlock({ state, setState, suggestionPriority, onCancel }: In
}
const onTextChange = newText => {
setState(state => ({...state, text: newText}));
setState(state => ({...state,
text: newText,
value: (trie.get(env.names)(newText) ? {
kind: "name",
} : state.value),
}));
}
// fired before onInput