Newbie questions


  1. Can I implement dynamic contextual help? What I mean is this: let’s say the user types some identifier. Then depending on where cursor is, my app would retrieve the identifier in the proximity of the cursor and display more information related to that identifier

  2. Can I provide my own completions list?

  3. Do you support code snippets, i.e. the user would type let’s say, wh, press some shortcut and the editor would expand that to a predefined code snippet?

Thank you

  1. Yes, but you have to do some work (there’s no framework that handles it for you). See this demo for an example – if you type console.log, it’ll show arguments. It does this by querying the current cursor context on the "cursorActivity" event, and overlaying the editor with a tooltip DOM node when it has something to say. The tooltip stuff could in principle be factored out of the Tern addon, into its own reusable addon.

  2. Yes. See the docs for show-hint.

  3. No, though you might be able to use code from CodeMirror-xQuery, which has some support for this.