function parameter autocomplete for vb.net

Hi there!

I was wondering if it was possible to implement a vb.net autocompletion since the vb mode already exists. I am looking for a way to input a function parameter autocomplete in addition to the basic autocomplete feature. Basically I’d like to input the names of the objects and functions(and their parmeters) to offer the user the possibility to autocomplete them.

Do you think that it is possible and do you think that I need to create a vb-hint.js from scratch?

Depending you requirements, sure, this should be possible. You’ll have to implement and distribute it outside of the core library, though.

1 Like

Thank you!
Sorry I am still learning web development, there is no way to do this without implementing and distributing a vb-hint.js outside of the core library?
Is there any documents explaining what a -hint.js require?

The manual describes what kind of function you need to provide to the show-hint addon. But in your case, it might be easier to use "hintWords" (as in CodeMirror.registerHelper("hintWords", "vb", ["array", "of", "words"])) to simply register a list of words you want to complete.

Edit: on closer look, it seems like mode/vb/vb.js already does this, so basic autocompletion should just work.

1 Like

Thank you really much :grin:! I checked it and yes I found out that in the vb.js file there is :

CodeMirror.registerHelper(“hintWords”, “vb”, openingKeywords.concat(middleKeywords).concat(endKeywords)
.concat(operatorKeywords).concat(commonKeywords).concat(commontypes));

Sorry my questions might be a bit annoying but I am just a beginner. If in my HTML file I declare “”"textarea id=“code”>

In my script :

var editor = CodeMirror(document.getElementById("code"), {
      mode: {name:"text/x-vb"},
      extraKeys: {"Ctrl-Space": "autocomplete",
      ".": "autocomplete"}
    });

Why do you think it does not work? Do I now have to implement a getHelper() in my JS script to now apply the hintWords ?

Are you loading addon/hint/show-hint.js and .css?

1 Like

Yes, I am loading these files :

href="…/doc/docs.css">
href="…/lib/codemirror.css">
link rel=“stylesheet” href="…/addon/hint/show-hint.css">
lib/codemirror.js">
addon/hint/show-hint.js">
mode/vb/vb.js">

Is it the name mode : “text/x-vb” that causes this issue?

I don’t think so, that looks good. Try starting from the autocompletion demo and modifying it step by step to get a VB.net editor.

1 Like

Thank you for your help!
I can now activate the autocomplete by pressing Ctrl+Space! :grin:
But is there anyway to custom the autocomplete behavior since there is no vb-hint.js