I use AppleScript in my Mac for automating various processes in my computer. I know that Visual Studio Code does not have an AppleScript dictionary.
Is there any way to programmatically control Visual Studio Code eg using Python or any other programming language?
As an example I would like to programmatically get the path of the frontmost document.
I know that VSC has a JavaScript API . Can I use this for automation purposes?
I guess a lot of such automation / programmatic control can be done via the JavaScript extension API.
There is vscode.window.activeTextEditor, and that gives you document.fileName or document.uri for the filename, and selection.active to get you the cursor position (example).
It looks like this API allows for a lot of automation, e.g. moving cursor around, inserting text, etc.
There is vscode-ext (active fork) to write Python extensions. When you look at the code, you see that this provides a websockets bridge from JavaScript inside VSCode to Python in a separate process. This bridge could be use for controlling VSCode from some external process.
Further, I just learned about the Robot Framework / Robotic Process Automation (RPA) Framework (also with Python backend). I'm not sure but it might be helpful.
Related
I use Visual Studio Code with Robot Framework and Python for test purposes. I also use CANoe application as a simulator.
I installed the Robot Framework Language Server and for some reason when I open VSCode or even just click on it CANoe automatically opens, I know that the extension is causing this because if I disable the extension the application stops to automatically open.
Do you already had any similar behavior with Robot Framework Language Server and any other process? If yes, how did you solve it?
There are 2 different LSP implementations for robot framework. This answer relates mainly to the one Robocorp maintains.
That particular implementation of lsp works by executing each LIBRARY settings section in python interpreter and executing the actual library's constructor to get the data it needs for auto completion / typing / whatnot. If the python library makes any connection to com API thats associated with CANoe during execution of the constructor, it will trigger actual CANoe application to start - even if that's not mandatory at this point but that's how COM works.
I'm quite there are ways to hack around the issue but essentially, the easiest way to fix this is to;
Fix the library that provides your keywords that interact with CANoe and/or ecutest or similar that requires CANoe to be running.
Try switching to https://github.com/d-biehl/robotcode within vsc to provide you autocomplete and the rest ..
If you where using robotcode lsp, see first suggestion.
In the company where I am right now we use Lua for some smaller macros in our software, the software is programmed in Object Pascal. We have made our own Lua Functions we often use when developing macros.
Is there any possibility to integrate our own Lua Functions in Visual Studio Code ?
We would like to use Visual Studio Code to develop the Lua Scripts for our macros, it lightweight, easy to use and has plenty of extensions.
There are some extensions in VSCode that allow you to edit them for this type of thing, but they are very rare.
What you can do is try to create your own extension for your company, it's really easy, you can see how to start here, and see how to create content for your extension like commands here
I am totally new to creating extensions in VS Code, and all the official examples of extensions are written in Typescript/Javascript, which I have no experience with. Is it possible to create VS Code extensions in other languages, such as Python or C++?
If so, could anyone point me to any resources to get me started?
It is possible by creating a C++ module for Node.js, which can then be loaded like any other node module. Of course, some glue code written in JS or TS is necessary to register the extension and translate calls to/from vscode.
I've gone this way in my ANTLR4 extension, but gave up eventually, because of the troubles I had due to incompatible dependencies (you have to make sure the extension uses the exact same V8 version, which was used to build the underlying Node.js used by vscode, on all supported platforms).
This situation might have change, I don't know, but with that in the background I don't recommend it.
If you want to add support for a new language in vscode you can also write a separate language server, as is mentioned in the linked SO answer. For other type of work, I'm afraid, you have no alternative to use.
No, as #rioV8 said, since VSCode is an electron app and runs on Javascript.
is it possible to create a new editor that includes custom markup? I went through the docs and couldn't find any extension to get it done.
My requirement is to develop an interactive graphical editor (with SVG) to manipulate text content in a file. I want to use third party css/js libs to implement the markup of the editor and at the same time using VS Code APIs fetch/update content of the current file, fire/listen to VS Code events, etc.
Extensions have very limited ability to manipulate the editor's UI. It seems to me that you have two choices:
If you need this capability to be unified with the editor, you will almost certainly need to fork VSCode.
If you don't mind your added functionality being external to VSCode, you could create an extension with a language server that implements your UI. The language server would run in a separate process, but would still be able to interact with VSCode through the extension.
I'm trying to make an application in C# that can download, install and manage various games that I and a few friends'll be making.
I know how I'm gonna do it, but I want users to be able to use this app on both Windows and Linux as most games will run on both. That's not the big issue, I know how I'm gonna get that working. Ohhhh, the power of Mono and GTK#.
The issue is, however, that for GUI-designing I can't figure out how to design GTK windows within Visual Studio just like you can with Windows Forms. I don't know if there's an add-in or whateverthelike, I just need some way of designing my GUIs for Linux.
I am running Visual Studio Express 2015, on Windows 10.
I have never seen a public version of a Visual Studio embedded GTK (+/2/3) Designer, let alone one that supports GTK#.
As far as Mono GTK# goes, it's designer is called 'Stetic' and is embedded into MonoDevelop/Xamarin Studio.
Stetic has a GUI based designer but also uses the files produced from that designer to generate the C# code from a xml file (gui.stetic) and combine that with user written code (actions/events/etc...) via C# partial classes.
You can also use the Glade Designer (older versions) and import them into MD/XS and it will convert them to a gui.stetic files and thus create the C# classes for your UI. This is what I used to do when I needed to knock out a complex GUI prototype quickly. Stetic can really try your patience with the ways it works, but in the end, personally I would skip the Stetic and Glade GUI designers and just code the GTK# containers, widgets and actions in straight C#.
http://www.monodevelop.com/documentation/stetic-gui-designer/
Stetic GUI Designer Move to Glade for Gtk#3
GUI building with GTK#
MonoDevelop editor GUI designer
https://glade.gnome.org