flybywire
flybywire

Reputation: 273502

rich web text-editor with autocomplete

Is there a web (i.e. html) text editor with autocomplete?

Let's say I want to do a web based mini IDE. I want to add it an autocomplete feature, so if you write Str and hit a key combination a javascript method would be invoked that returned possible completions, such as String, StringBuffer, StringBuilder, StreamParser, etc

Upvotes: 1

Views: 1675

Answers (1)

Esteban Küber
Esteban Küber

Reputation: 36832

You could see at the current position of the cursor move back until the first word boundary and through AJAX search for keywords. You position these keywords in a select like list just under the cursor.

That would be the very general idea, but it could be too costrly to do on every keystroke, so I'd advice,

  • first, that the word is longuer than 3 letters (at least),
  • call every several keystrokes,
  • and third, if the cursor is static for a few seconds, call the function.

Upvotes: 1

Related Questions