Discussion:
override closeCharacters for show-hint
Boyan O
2014-03-30 10:21:21 UTC
Permalink
Hi,

I want to override closeCharacters for show-hint
But simply ```cm.setOptions("closeCharacters", ...);``` doesn't work.

`
CodeMirror.showHint = function(cm, getHints, options) {}
`
https://github.com/marijnh/CodeMirror/blob/master/addon/hint/show-hint.js#L14

Expects `cm, getHints, options` arguments, but how does they get passed to
it, if

```
execCommand: function(cmd) {
if (commands.hasOwnProperty(cmd))
return commands[cmd](this);
},
```
https://github.com/marijnh/CodeMirror/blob/master/lib/codemirror.js#L4068

It only passed `cm` instance without any options?

Sorry if this is common knowledge.

Best Regards,
Boyan
--
--
You are receiving this because you are currently a member of the CodeMirror Google group. To send something to list, use codemirror-/***@public.gmane.org, to unsubscribe, send a message to codemirror-unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
---
You received this message because you are subscribed to the Google Groups "CodeMirror" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codemirror+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Boyan O
2014-03-30 14:50:07 UTC
Permalink
I was able to override it using
CodeMirror.showHint(cm, null, { closeCharacters: /[()\[\]{};:>,]/ } );
Post by Boyan O
Hi,
I want to override closeCharacters for show-hint
But simply ```cm.setOptions("closeCharacters", ...);``` doesn't work.
`
CodeMirror.showHint = function(cm, getHints, options) {}
`
https://github.com/marijnh/CodeMirror/blob/master/addon/hint/show-hint.js#L14
Expects `cm, getHints, options` arguments, but how does they get passed to
it, if
```
execCommand: function(cmd) {
if (commands.hasOwnProperty(cmd))
return commands[cmd](this);
},
```
https://github.com/marijnh/CodeMirror/blob/master/lib/codemirror.js#L4068
It only passed `cm` instance without any options?
Sorry if this is common knowledge.
Best Regards,
Boyan
--
--
You are receiving this because you are currently a member of the CodeMirror Google group. To send something to list, use codemirror-/***@public.gmane.org, to unsubscribe, send a message to codemirror-unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
---
You received this message because you are subscribed to the Google Groups "CodeMirror" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codemirror+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
Loading...