BayardRock / WebIntellisense

JavaScript and CSS library for intellisense user interface. Complete with bindings for a textarea, ACE editor, and CodeMirror.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can i get last chosen/selected token for loading dynamic declarations

nabeelahm2 opened this issue · comments

I am evaluating webintellisense/text-area-intellisnse plugin for my project. I want to load declarations based on the last selected/chosen item e.g. if user types "c." plugins loads {"Param1", "Param2", "Param2"} options. If user selects "C.Param1" option plugin should load next declarations based on this "param1". I am looking for same behavior for both new/edit functionalists.

I know question sounds too specific to my requirements, however can someone guide me is this possible via plugin or atleast point me to right direction

I don't really understand what you're trying to do, so let me try to rephrase what you are asking.

When the user presses the period key (".") declarations should popup depending on what is currently in the textbox?

Excuse my bad English :(. Yes, declaration should be based on what is currently (last typed string/token) in the text box or in which context user has pressed the key.

This demo may help you: http://bayardrock.github.io/WebIntellisense/src/demo1.html

// called when the declarations are triggered
intellisense.onDeclaration(function (item)
{
    var val = $editor.val().toLowerCase();
    var data = /* something that parses val and transforms it into declaration objects */
    intellisense.setDeclarations(data);
});

I am already using "onDeclaration" function. I thought there might be some built in functions for parsing. Anyhow, thanks for your support.