Intelliprompt for Javascript native objects

SyntaxEditor Web Languages Add-on for WPF Forum

Posted 9 years ago by John Sever
Version: 14.2.0611
Avatar

I see that the WPF version of SyntaxEditor and the Web Languages Add-on is the direction you recommend these days and I am willing to go in this direction as long as I know that I can deliver the functionality that I need.  

I have tried your demos, I have downloaded sample software, read help files, and reviewed as a great deal of content on your site but I still do not see anything that suggests I can do what I want. Your Javascript demo for WPF does not provide the functionality I seek so I am finally asking for your help.

What I want is intelliprompt for all of the built-in or native Javascript functions and features such as Math, Date, Array, etc.  So if I type  var x = Math.  it should drop down a list of the various math properties and methodsfunctions such as Math.E, Math.PI, Math.abs(x), Math.tan(x) etc.

Is this possible?  Can you get me pointed in the right direction?

Comments (6)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi John,

We don't currently have IntelliPrompt for the native Javascript objects.  That is something on our TODO list and I'll log your suggestion with the item.

You could add some of this by making a new class that inherits JavaScriptCompletionProvider and override the RequestSession method.  You'd have to get a snapshot reader like:

var reader = view.CurrentSnapshot.GetReader(view.Selection.EndOffset).BufferReader;

It would be initialized where the caret is.  Then use the reader to see if there is a "." before that offset and if so, get the word before it.  If it's any of the built-ins like Math then show a completion session like we do in our QuickStarts.  Otherwise, call the base method to let it try and match identifiers defined in the code.

You'd want to register your custom completion provider with the language like this to clear out the old one:

this.RegisterService<JavaScriptCompletionProvider>(new CustomJavaScriptCompletionProvider());

I hope that helps!


Actipro Software Support

Posted 9 years ago by John Sever
Avatar

Is there a way to load a script file that the editor will parse and automatically add the Intelliprompt function?  

Posted 9 years ago by John Sever
Avatar

I was also looking at your SDI demo that has the option to select the language JavaScript (in Web Languages Add-on).  In JavaScript I created a simple pseudo class like this.

var foo = function(){
  this.FirstName = "Abe";
  this.LastName = "Lincoln";
}

var x = new foo();
console.log(x.

 At the dot, iI expect it to show FirstName and LastName as members of x but it does not.  Is there no IntelliPrompt for JavaScript at all?

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi John,

While we do have a JavaScript parser that will run as the text changes, mark syntax errors, and return an AST result to the document, our JavaScript add-on doesn't currently support context sensitive IntelliPrompt completion. We took the approach for now of making something that generically displays all known identifiers in the document when you Ctrl+Space and filters the list as you type.

[Modified 9 years ago]


Actipro Software Support

Posted 7 years ago by Nate Smith
Avatar

I have revived this effort in our product recently and had the same question regarding JavaScript Intelliprompt completion. I notice the last thread response is two years old.  Has there been any progress toward getting this feature?

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Nate,

Sorry there's nothing new in that area for the JavaScript language at this time.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.