Why does autocomplete does not pick up local variables from the editor?


#1

I am using mode “text/x-java”. The libraries that I am using are codemirror.js, show-hint.js and clike.js. The autocomplete works in the sense that any keywords that I included in the clike.js file will get called when I start typing it in the editor. The problem I have is that the autocomplete does not pick up any local variables that I define in the editor as this is not stored in the clike.js files. I am aware this functionality does exist in the autocomplete and xml complete demo. I am also aware that they both have javascript-hint.js and xml-hint.js. I looked into both of these libraries but I do not know which function from the library allows storing local variables from the editor into the autocomplete list and gets recalled when the user starts to type. Can some also describe how the function works, please?

Thank You


#2

Supporting that would require language-specific code, and no such code exists for Java. The JavaScript mode gathers local variables, and javascript-hint accesses those for completion.


#3

Hi Marijn

Thank you for your reply.

Can you please confirm which function in the JavaScript mode takes a local variable and which function in javascript-hint accesses it for completion?

If I need to include this feature for Java mode where/ how would I start?

Thank You