Predictive text inside the terminal in Dart - command-line

Trying to create a command line tool for use in a web framework and want to have predictive text inside the terminal to save typing. So far I've been using:
stdout.writeln('Text to output'); // To output to terminal
stdin.readLineSync(); // For reading responses from the terminal
However, using the writeIn function doesn't output to the user input area in the terminal, but rather a system response. What I need is to output to the user input in the terminal, like how the Symfony framework operates in PHP, so that when typing a guess can be given and the user can tab to complete (again, see the symfony CRUD or doctrine entity generator for an idea of the desired functionality).
I do see that using readLineSync might also be a problem (as the script will need to listen for user input and not be blocked).
Thank you for reading!

Related

write a vscode extension visual test

I created a VSCode Extension and then I need to write some tests.
I am using Mocha and chai.
I wrote a few tests and I don't have any issue with that part. My problem is with the below scenario:
I have a button, when I press that button, an input box will appear and then I need to key in a value in the input box and press the okay button.
Can you help me with how I can simulate this scenario by a test? should simulate press the first button by calling the Command palette but how to key in value in the input box?
** Please take note that I already wrote the function test, but the user wants to test the UI also.
can you help me in finding an example related to my problem?
There is something like vscode-extension-tester which lets you test the GUI very comfortable. All information you can find on its github main page:
https://github.com/redhat-developer/vscode-extension-tester/wiki

Using codemirror to execute code on server

Novice to Codemirror.
I have codemirror running on my server I have it set to Python mode. Can someone please suggest how I go about executing the code and showing the result on the page where I have written the python code
Thanks
Without knowing much about your setup, here's a general idea:
Use the getValue() method to get the code from your CodeMirror instance.
Assuming the code is a run-able Python script, you can either
(1) send the code to your back end with AJAX or a POST request and run it there. Or (2) you could run the Python script in the browser with a library like one discussed here.
If you ran it on the back end, you can send the result of running the code back as text or JSON with your preferred protocol. If you ran it on the browser, you should probably follow the guidelines for the specific library you used.

How to debug ExecuteFunctions for word add-in?

I'm implementing a functionality which runs in background(without Taskpanel), where I can POST the word document data to REST API through the ExecuteFunctions. my question here is How can I debug the Function file? I tried printing through the console logs and also tried to debug through F12 and Visual studio tools, but didn't work. I have created word add-in using YO Office generator.
To answer the question as is, simplest way of debugging the functions is through the Web experience (https://onedrive.live.com), where they will print stuff on the console.
You should probably check out this answer though: Run add-in without showing taskpane?
You really can't run background tasks without having a TaskPane. Functions are meant to just plainly execute something and exit. That means; upon clicking the Function button, you can make a request and upload some data, but you can't really keep a connection open and upload periodically after just one click.

Autocomplete custom data in Slack commands

Just playing with my first slack command. Is there any way of adding custom data from an external API for autocomplete. So what works perfectly right now, is calling the command /assign plus a slack user (both will be autocompleted, nice!). What I want/need is a list of items I would fetch from a remote endpoint, which can be selected by autocomplete.
Is this possible at all?
/assign #userX to [data_by_autocomplete]
Or do I need to solve that by a full conversation like:
=> /assign user #userX
=> BOT: Which task? Here is a list: ...
=> /assign taskY
=> BOT: Assigned TaskY to #userX
But this feels very cumbersome (and wrong). So basically what I want is a remotely fetched list for autocomplete in the same command.
PS: Command and functionality is a simplified example to illustrate the point.
No, you can not use custom autocomplete within the command line, but you can use custom autocomplete with the the new interactive message menus.
So I would suggest to break it up into two steps.
Enter slash command and provide username
Show interactive menu with autocomplete

How to suppress display of password in Selenium RC window

I am writing some Selenium RC tests using the perl library WWW::Selenium. At the beginning of the test I need to login to a web form using my username and password.
I noticed that my password is displayed in the Selenium Remote Control "Command History" window as type(password, secret).
Is there any way to suppress the display of the password? Maybe there is a command other than type I can use?
Unfortunately no. You could go into the Selenium core and change it to show ******* when it finds a field named password.
Beware though that this could make life difficult when debugging
I guess we can do this using native methods support.
Think logically every native methods in selenium will be sent to the operating system not to the browser.
So if you use any of the native methods, the flow is like this:
Client Program ----> Selenium RC server ----> to the operating system (in Java this is done using Robot Class)
But all the other non-native methods flow is like this:
Client Program ----> Selenium RC server ----> to the Browser
So, the Command History window operates at the Browser level and the native methods will not reach there.
Here is the code:
selenium.focus("locator");
selenium.keyPressNative("key code"); // this will not be shown in command history
Here the key code is only for one character and if you want string (more than one character), we should rely on our client program to implement the logic.
I have given that code in my previous answers to other posts. If you need it personalised post our exact requirement so that I can give that code tailored to your need.