CodeMirror-XQuery
CodeMirror-XQuery copied to clipboard
Autocompletion of Method Parameters for User-Defined Functions?
How can we acheive Autocompletion of Method Parameters for User-Defined Functions. It only displays Autocompletion for javascript functions. I want to achieve this for my functions used in that particular project.
Could you explain more your need?
Perhaps you should see https://github.com/angelozerr/CodeMirror-XQuery/blob/master/codemirror-javascript/addon/hint/tern/tern-extension.js (CodeMirror.ternHint = function(cm, c) { function c1(data) { => line 43), I have extended the éofficial" CodeMirror tern addon to add "templates" hint.
I am actually working on a project and we have created a JS editor which provides auto completion. So i have used your add ons. But on using this add on it displays only JavaScript functions in autocompletion. Since my project contains many infra files also and i need to show functions of that infra files through autocompletion feature. So how can i achieve that?
P.S i need autocompletion with method parameters too..
To add your own completion with tern, the best mean is to create defs file like I have done here https://github.com/angelozerr/CodeMirror-XQuery/tree/master/codemirror-javascript/addon/hint/tern/defs
But perhaps you wish to use directly your js file and your file should be added to tern server (I must modify my addon to do that).
For parameter completion, I would like to manage that too (eg: show only number vars after str.slice( but I must study if it's possible with tern.
If i have multiple functions in multiple Js files then what can i do? Can i simply directly declare all these function signature in a global array and with tern it could automatically detect all the functions with method parameters. Can you provide code of this?
Creating your own Tern def (see https://github.com/angelozerr/CodeMirror-XQuery/tree/master/codemirror-javascript/addon/hint/tern/defs ) could help you no?
So i will have to write my own def but seems a quite lengthy process to declare all the functions.. Is there any way by which i could import the Js files and the code could automatically detect all the functions inside that Js File.
I'm not a big expert with Tern, but I think you could define use getFile function to add your own JS file. Never played with that.
Can you provide the function through which we can import JS files directly.
I suggest you to post your question on CodeMirror forum.
@ayush-jayaswal Tern demo uses something like server.addFile and Tern demo shows completion for custom function as you may seen in Tern demo
How do i configure tern server to include user-defined .js files so as to provide method auto complete.
As I said you, I suggest you to post your question on CodeMirror forum.
Any chance to re-open this requirement?