Add/remove autocomplete keywords to/from CodeMirror instance


#1

I have multiple CodeMirror instances on a page, all of them have sql autocomplete function on. For one instance I’m looking for an option to add (or remove) some custom keywords to that particular instance in addition to ‘built-in’ sql keywords.

I read SO discussion and the proposed solution worked, but those custom keywords are of course applied to all CodeMirror instances. Is there any way to add them only to a particular instance?

Thanks for a suggestions!


#2

If you directly pass (using the hint option to showHint) a wrapped hint function in a particular CodeMirror instance, that won’t affect other instances.


#3

Thanks, that worked!

But what about removing my custom list? Should I just simply reset hint option with a default CodeMirror.hint.sql function?


#4

That’d work, yes.


#5

Great, thanks!