How to start creating a language extension for VS Code? - visual-studio-code

Pursuant to the discussion in Add XHTML support, I'd like to start creating an extension for Visual Studio Code which would implement support for XHTML. Which is HTML with XML syntax, so the the desired functionality is already (mostly?) implemented elsewhere – for XML and HTML languages, the latter having two extensions bundled with VS Code: html and html-language features. But it's disparate.
As the first step, should I clone the VS Code repo and delete everything except the two directories named html and html-language features? Or Language services for HTML? Or the latter and html from the former? Or start with html, make it work for XHTML and only then deal with language features?
Should the second step be just adding the extension(s) I'm developing on my computer to my installation of VS Code? The GUI seems to allow adding only extensions from the Visual Studio Marketplace. Is it the right solution to place the extensions under development into VS Code's directory for extensions (either directly or with symbolic links)? I'm on Manjaro Linux.
If you can offer any other helpful advice, I welcome it too.

Related

How do I use a language server in a Custom(Text)Editor?

I want to create a VS Code extension that extends the existing XML extension by Red Hat (redhat.vscode-xml) and allows visual editing of XML schemas and possibly XML files bound to a schema (similar to Altova XML Spy).
I hope that I can benefit from the XML language server integrated by the XML extension regarding things like what can be added at this point in the file and highlighting errors.
How would I tackle this in an editor that is not text-based?
I studied the documentation for VS Code extensions a lot. I read the bits about CustomEditors, CustomTextEditors, and LanguageServers. I've also played around with the example code. I've looked at Eclipse glsp VS Code integration and read its documentation. I've also looked at Eclipse Sprotty VS Code integration. The point where I'm struggling is that I don't know how to leverage the existing XML language server.

Auto-suggestion HTML and CSS code without an extension in VS Code

I just installed Visual Studio Code. It works and suggests HTML and stylesheet and JavaScript as well, but what matters is that I didn't install any extension in Visual Studio Code, and it works well without HTML and JavaScript extension.
How does it work without any extension? Do I need to install an extension for this?
To answer it on Low-Level, VS Code is built on top of monaco-editor
As mentioned in its docs, it has below stuffs by default
Rich IntelliSense, Validation TypeScript, JavaScript, CSS, LESS, SCSS,
JSON, HTML
Refer: https://microsoft.github.io/monaco-editor/
Those shortcut features are built with https://emmet.io/
So, for working with basic web stuffs, you don't need an extension.

How to I get Visual Studio Code to treat <webscript> the same way it treats <script>?

I’m working on HTML files which contain JavaScript inside <webscript> tags. Can I customize Visual Studio Code so that it treats these tags the same way it treats <script> tags, i.e. with syntax highlighting, etc.?
AFAIK, there is no direct way to customize this in Code. But you could write your own language configuration. A documentation with a sample file can be found at: https://code.visualstudio.com/api/language-extensions/language-configuration-guide
The most easiest way would searching for the default html language configuration copy this file and just edit the regex for script to support webscript, too. Should be this one on GitHub

How to change all occurrences of variable name in Visual Studio Code for PHP?

I have tried Ctrl + F12 but it does not really work. It does not select $this-> for some reasons. Does anyone here know, how to do it?
Thanks in advance
Currently, Visual Studio Code's support for PHP is limited (see here), and I was unable to locate a PHP language service extension for Visual Studio Code (you're welcome to look, too).
Visual Studio Code currently only comes bundled with language services for JavaScript and TypeScript.
According to Visual Studio Code's documentation, a language service is defined as follows:
Language services provide the code understanding necessary for features like IntelliSense (suggestions) and smart code navigation (Go to Definition, Find All References, Rename Symbol).
You can try the regular search and replace CTRL+SHIFT+H. VS Code provides preview for all planned replacements so it is done not that bad as you would expect.
This question is a bit old but, for anyone who stumbled upon here,
You could use PHP Refactor Tool extension: https://marketplace.visualstudio.com/items?itemName=st-pham.php-refactor-tool
note that this extension dependent on PHP intelephense: https://marketplace.visualstudio.com/items?itemName=bmewburn.vscode-intelephense-client

How can I configure Visual Studio Code to recognize files with extensions other than .js as Javascript

We have a QA tool (SmartBear's TestComplete) that uses javascript as a scripting language, but names the file with a ".sj" extension instead of ".js". I would like to use Visual Studio Code to edit those files, with all the nice intellisense and other tooling that comes with it, but I can't figure out how to configure it to recognize .sj files as javascript files. Any ideas?
Answering my own question, just for future readers that may be searching for the same thing.
According to a tweet from #code, this is not yet possible, but is coming "soon".