I have a function with the name waitForCompletion(arg1,value,waitTime);
I want to find out a way to know that I am on the second argument of the function i.e. waitForCompletion(arg1,
Use case:- When a user starts typing the function name and is on the second argument, I have to trigger some intellisense for showing the intellisense on what values the second argument can accept.
I currently have the following, but it only matches the function name and triggers my intellisense for all the arguments but it has to only do that for the 2nd argument.
let completionMatch = textUntilPosition.trim().match(/(^waitForCompletion)|(\swaitForCompletion)/);
if(completionMatch){ //trigger intellisense }
I believe we would have to match the ( after the function name but somehow ignore the first argument and match then match the , after the first argument , that is when I can make sure that my pattern matches.
Note:- textUntilPosition gets me the text until the position where my cursor is at i.e. if my cursor is in the second argument waitForCompletion(arg1, , if my cursor is on the first argument it is waitForCompletion(arg1