How do I configure VS Code to auto-complete / closing of HTML elements in PHP files like Adobe Brackets does? - visual-studio-code

Adobe just slapped me with horrible news saying they will end support for the Brackets Editor and we need to switch to VS Code.
I wasted an hour already just to have auto-closing of tags to work.
Here is a video explaining exactly what I want.
https://imgur.com/a/tLWpU4x
I want to be able to have auto-close work for HTML elements in a PHP file like it does without issue on Adobe Brackets.

VS Code has a lot of extension for this kind of need. I personally use HTML Snippets.
Just navigate to extensions tab, search HTML Snippets then click install.
Please check this link for your reference. You can find some extension which could cater your needs.

Related

Automatically formatting HTML within PHP with VSCode?

I tried Intelephense and dozens of other extensions and settings but NONE of them achieved what I'm after. What I prioritize is automatic tag close and automatic indent... most of others VSC functionalities for HTML would be great too, like css classes or files paths suggestions, but what I really need is this 'basic' automatic format...
I'm sorry for this question, I know it's been done and answered before, it's just that I can't get my VSC to correctly work with HTML when mixed with PHP, and I've been trying for months now... Read everything I've found on Google, searched about it here and on Reddit, but wasn't able to reproduce any of the solutions, or better saying, none of them worked for me.
Could anyone give me some guidance?
Luckily I felt the same way as you so I just decided to go ahead and hammer out a solution to this very annoying problem with a VScode extension that doesn't register itself as a "formatting" extension I format the HTML onBeforeSave so you can still register a PHP formatting extension so between the two it gets the whole file. I use js-beautify so you can just use all the native HTML formatting settings in VSCode already.
Format HTML in PHP on the VSCode Extension Marketplace.

How do I add my own completions to sublime text 3?

I've been looking everywhere for an answer and I can't seem to make sense of anything I find. There's either to references to files that don't exist in my installation, or the file does exist but is just raw hexadecimal data rather than code. For example, I keep seeing that I should look in my packages/(insert programming language here) folder to access autocompletion files for that particular language. Unfortunately, when I click browse packages, the folder only contains a bz2 folder and a User folder.
I'm trying to modify sublime text's PHP autocompletion and make it so that whenever I type
<?
I can hit enter and it would autocomplete to
<?php ?>
with the cursor set between the tags. I've seen this as well but as I said earlier I've had problems getting any of these solutions to work for me.
How do I add this simple autocompletion to my sublime text 3?
You can do that by adding snippets. Just go to Tools > New Snippet.... There's a lot of docs about how to write a snippet.
Also, in your case, you can install the Additional PHP Snippets and trigger that completition by typing php and hitting tab

Coffeescript syntax highlighting in the browser

I am looking to create a really simple in-browser IDE for CoffeeScript. Basically a text box and a submit button, for now. All the code will then be submitted to the server for execution.
One thing I did want, is a syntax highlighting in the browser as the person type. Something liked Iced Coffee for Sublime Text. Is there a way to do this syntax highlighting?
You can try embedding the ACE editor in your page. It has many nice color themes for the syntax highlighting and seems to support CoffeeScript (try the CoffeeScript document and mode in their kitchen sink demo).
I know this post is old but you could always use CodeMirror, its what the jsfiddle uses.

Notepad++ plugin to edit opening and closing html tags at the same time

Is there a plugin (or a way) to edit opening and closing html tags in Notepad++ simultaneously such as the 'Insert open/close tag' feature of Textmate?
Edit simultaneously: http://www.youtube.com/watch?feature=player_detailpage&v=jqj1t4qFFwM#t=20s
Insert open/close tag feature: http://www.youtube.com/watch?feature=player_detailpage&v=jqj1t4qFFwM#t=15s
Surround.vim is a somewhat similar feature but for VIM.
There isn't a plugin that does this at the moment, sorry.
However, it wouldn't be impossible to add, especially with the existing tag highlighting code (full disclosure: I wrote the current tag highlighting code). Add an "idea" on ideatorrent on the sourceforge project page. It's certainly something that's asked about often enough.

how to switch/control syntax highlighting in eclipse flexibly?

I have a file with extension .xml.
But it doesn't necessarily contain XML. It may also contain HTML and JavaScript. Now I would like to either have Eclipse decide inteligently/heuristically which syntax highlighting would be appropriate or to switch it myself.
Any ideas?
Eclipse associates files with an editor. You can let eclipse decide which editor to use (e.g. defaults per file extension) or select the editor by yourself. I guess you might already know that or have at least experienced it.
Syntax highlighting isn't always set seperately but instead part of some editor (together with stuff like keyboard shortcuts). So what you are going to need is an editor that behaves the way you want it to. I do not know if there is an editor like this available but one options is writing an eclipse plug-in and implementing such an editor.
Fortunately there are great editors for each of XML, javascript, HTML, etc that are all open source. I guess you might be able to use some of their code. Ideally as a client of their API / Objects or if it won't work out just by reusing code.
short answer: not possible. use PHPStorm instead :)