Can I create VS Code extensions in Python/C++? - visual-studio-code

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.

Related

How to add a language to vscode web without using yeoman?

I use github.dev for a lot of my programming work because I don't like downloading programs. As such, I would not like to download either the vscode app or yeoman. Can I make my own extension inside github.dev (perhaps using the .vscode folder?)? I've read a bunch of documentation, but all of it seems to hinge on using yeoman.
You don't need Yeoman to create an extension. Yeoman is just a scaffolding tool, and only helps you in the initial process. Instead, you could simply copy/clone any other extension that seems similar to your need, and update it to make it the way you want.
Back to github.dev, unfortunately, you won't be able to use it to develop your extension, simply because it does not allow debugging. Without that, you won't be able to test your extension. Also, you will still need to install vsce, which is responsible for bundling/publishing the extension.
Instead, you should use services like Codespaces or Gitpod, because once they provide you a remote server, you could install yeoman and vsce there. But, services like Codespaces and Gitpode uses desktop-like extensions, and Github.dev/vscode.dev uses web-like extensions, which are a bit different (https://code.visualstudio.com/api/extension-guides/web-extensions)
Hope this helps

What is the difference between extension and plugin in Vscode?

Yes, I'm beginner. and I used Webstorm but now using Vscode.
I know to say 'extension' in Vscode.
But sometimes to say 'plugin' in Vscode.(ex. Do you know Vscode's Prettier plugin?)
Can others understand this?
I understand it like this Python's pip and Node's npm to understand.
Just different name.
Is that what I understand right?
There is very thin border line between the two.
Extension and plugins often confused people. And Mostly people believe both are same.
The main difference between the two is that plug-in provides extra functionality which does not modify the core functionality.
While extension is made for modifying core functionality, may be provided due to version change or improvement.
Securing plugins is more complex than extension.
Extension are individual identity so one extension needs one set of privileges, whereas plugins are more complicated and needs to identify privileges for each application runs plugins rather than a whole plugin.
Extension is specific to particular application. It extends functionality of a particular application or software.
While plug-in can be made generalized which may runs independently in coordination with particular application or software.

VS Code / IDEs: How can I enable cmd+click goto definition for variables declared at runtime?

I'm looking to improve my own productivity by trying to figure out how to provide cmd+click functionality for variables declared at runtime. I work with a library that allows you to register objects to it at runtime to be accessed later — it would be great if I could cmd+click to definitions of these! How do you think I could achieve this? I'm open to any ideas. Thanks!
Edit:
Thoughts I have so far inspired by feedback from various Slack communities:
There is no such thing as 'runtime' when providing functionality in IDEs
We need to be able to teach the IDE about what definitions to expect. Whether this means writing an extension to use the VS Code API specifically for my use-case, or otherwise working within a system that generates files that the IDE already knows to look for, which allows it to connect the dots and provide the precious peek / goto definition functionality
Edit:
I'm starting work on a VS Code extension that reads a dotfile for configuration — I'll share what I find out as I go!

How to get Csharp syntax tree from VS Code Extension?

Is it possible to interact with the CSharp syntax tree from my own VS code extension? I have an extension which I made in Visual Studio proper which uses the Roslyn Syntax Tree to do a variety of code editing and sorting tasks and I want to migrate it to VS Code.
My naive assumption is that if I can get access to the OmnisharpServer object by reaching into the Omnisharp VS Code Extension I might be able to pull the relevant information out of there. I can get access to the extension itself by calling:
let csextension = vscode.extensions.getExtension('ms-vscode.csharp')
But the extension itself doesn't expose much so I'm wondering if this is the correct methodology? If so, how do I get access to the running server from my own extension?
The only other strategy I have is to run a .net core exe which uses Roslyn to do the analysis, but this seems to be duplicating a problem which must be solved somewhere in the stack.
I don't think there's any way to do this without going through the Omnisharp VSCode Extension / its extension API (unless perhaps the server implements some custom interface). If an API doesn't already exist, you could consider creating a feature request on the issue tracker?

Graphically laying out wx app

Being really new to wx, I'm wondering if there is an IDE (especially for Linux) which would help me lay out a frame or dialog or whatever just to help me see what I'm doing. That means also creating the code for those changes.
I remember way back when using resource compilers for OS/2 and Windows that produced binaries that would then create the window, and was hoping for something similar (though obviously not binary if wx doesn't support that).
I use wxFormBuilder. It is written in wxWidgets, so it works on Linux quite well. It can generate C++ code or XRC files. Make sure you understand its philosophy, and use it like this:
generate C++ code for the GUI
don't edit the code wxFormBuilder generated, but create new files
in new files, derive new classes from the classes it generated
implement event handlers in you own class (wxFB creates virtual function for each event handler you wish to use)
I usually name the wxFormBuilder generated classes/files like, for example, MainFrameGUI, and one with implementation (derived one in which I write all my code) would be just MainFrame. This enables you to change the visual layout and regenerate C++ files from wxFB at any time without overwriting your code.
DialogBlocks works quite well for me, although sometimes you need to edit the code to fix errors manually. It has a property editor that seems advanced enough.
Just another options is wxGlade. It does not have the that much features as the others mentioned seem to have, but it works just good enough for me to not daring to switch.
I use Code::Blocks IDE from http://www.codeblocks.org which has
- built-in GUI editor
- Cross compilable, so you can use it under Linux, OSX and Windows.
But I still use wxFormBuilder with it instead of built-in wxSmith editor. But they are compatible with internal wxSmith.
For windows you've got "wx-devcpp" which is Blodsheed Dev C++ with some addons providing what you looking for
Here is project page
http://wxdsgn.sourceforge.net/