INNER CODE UNIT · Go

handleCompleteRequest

gopherdata/gophernotes · complete.go:21

func handleCompleteRequest(ir *interp.Interp, receipt msgReceipt) error {
	// Extract the data from the request.
	reqcontent := receipt.Msg.Content.(map[string]interface{})
	code := reqcontent["code"].(string)
	cursorPos := int(reqcontent["cursor_pos"].(float64))

	// autocomplete the code at the cursor position
	prefix, matches, _ := ir.CompleteWords(code, cursorPos)

	// prepare the reply
	content := make(map[string]interface{})

	if len(matches) == 0 {
		content["ename"] = "ERROR"
		content["evalue"] = "no completions found"
		content["traceback"] = nil
		content["status"] = "error"
	} else {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…