when sorting suggestions, not only function and input type are matched, but also output type (=input of surrounding function)
This commit is contained in:
parent
d3138e6617
commit
ea8c015eff
5 changed files with 132 additions and 55 deletions
|
|
@ -28,7 +28,7 @@ export interface State2Props<InType, OutType = InType> {
|
|||
}
|
||||
|
||||
interface EditorProps extends State2Props<EditorState> {
|
||||
filter: (suggestion: SuggestionType) => boolean;
|
||||
suggestionPriority: (suggestion: SuggestionType) => number;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ function removeFocus(state: EditorState): EditorState {
|
|||
return state;
|
||||
}
|
||||
|
||||
export function Editor({state, setState, onCancel, filter}: EditorProps) {
|
||||
export function Editor({state, setState, onCancel, suggestionPriority}: EditorProps) {
|
||||
const env = useContext(EnvContext);
|
||||
const [needCommand, setNeedCommand] = useState(false);
|
||||
const commandInputRef = useRef<HTMLInputElement>(null);
|
||||
|
|
@ -144,14 +144,14 @@ export function Editor({state, setState, onCancel, filter}: EditorProps) {
|
|||
return <InputBlock
|
||||
state={state}
|
||||
setState={setState as (callback:(p:InputBlockState)=>EditorState)=>void}
|
||||
filter={filter}
|
||||
suggestionPriority={suggestionPriority}
|
||||
onCancel={onCancel}
|
||||
/>;
|
||||
case "call":
|
||||
return <CallBlock
|
||||
state={state}
|
||||
setState={setState as (callback:(p:CallBlockState)=>EditorState)=>void}
|
||||
filter={filter}
|
||||
suggestionPriority={suggestionPriority}
|
||||
/>;
|
||||
case "let":
|
||||
return <LetInBlock
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue