Disable HTML autocomplete in non-HTML areas - visual-studio-code

Currently Visual Studio Code always tries to autocomplete an HTML tag.
If I type for example useState<string>my IDE completes it to useState<string></string>.
I know that I can disable it: Visual Studio Code - Disable autocomplete "<>"
But I would like to have this feature in the HTML areas of my React project but not in the TypeScript areas.
Is there a way?

Related

How do I get a working HTML5 snippet extension in VS Code?

I'm looking for HMTL intellisense and code snippets in VS Code.
I searched the extensions marketplace for "html snippet" and found one dominant extension with 7.8M downloads: "HTML Snippets". I installed it and code some HTML intellisense, but no code snippets. I checked the extension description, and it says, under Update 5, "Disabling this extension as its functionality has been absorbed by VS Code main html extension."
Alright, so this extension has been permanently disabled by the creator. But what is the "VS Code main html extension"? It is called an extension, so I expect it to be in the extensions marketplace, but I can't find any extension named "main html extension" or anything like it.
Without any extensions right now, I have no HTML intellisense or code snippets.
What extension can I use now for HTML snippets?

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

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.

Visual Studio Code Bracket Matching

I'm using Visual Studio Code for web development. It's very useful tool but when i select a tag, element etc. Visual Studio Code show all the same tag, element or etc. I only know where tag is closed. How can i do that?
Unfortunately, this is not supported yet, as you can see in this open issue.
Go there and add a :thumbs_up:, so they could priorize in the next releases, or someone else would create an extension for that.

How can I enable IntelliSense for JavaScript inside HTML?

I want to use VS Code to try out the examples of a JavaScript book, but there's no IntelliSense, or at least I don't know how to activate it.
In Visual Studio this feature works out of the box :
But in VS Code, all I got is a message saying "No suggestions."
What do I need to do to enable IntelliSense in VS Code?
Starting with the November 2016 (version 1.8) release, Visual Studio Code now fully supports IntelliSense for JavaScript in HTML.
Note that the language support doesn't follow script includes, it only knows about definitions made in the same file.
Currently Unsupported
JS intellisense doesnt work in HTML script tag - VSCode GitHub Issues #4369
Smart Javascript suggestions inside HTML files no loger working after Visual Studio Code update - StackOverflow
It worked for me, when the file had a .js extension. I didn't get any intellisense when I pasted it into .html file between script tags.
Edit To Add: You can also change the Language Mode by clicking 'HTML' in the bottom of the VS Code window and change it to 'JavaScript'.
It is supported!
Intellisense and syntax highlighting start working after replacing
<script>something()</script>
with
<script type="text/javascript">something()</script>
Make sure you have HTML language mode selected in the bottom right corner. I had Markdown mode set for an unknown reason (autodetect?) and it didn't work for me. Javascript mode won't work either for HTML files.
Visual Studio Code version 1.4.0 does not support CSS intelli-sense.
I have an extension for CSS style, id and class intelli-sense for html documents:
Features:
Style tag completion and hover.
Style attribute completion and hover.
Id attribute completion.
Class attribute completion.
Scans workspace folder for css files.
Supports optional resource.json file for fine tuned resource selection.
Link:
https://marketplace.visualstudio.com/items?itemName=ecmel.vscode-html-css

Is there a way to see a preview of a webpage?

I was wondering if there is a way to see a preview of an webpage page that we are working on in a web browser directly from the Visual Studio Code editor, instead of having to click the file to make it open by the default web browser.
You can open your Visual Studio Code project in a browser window by configuring a gulp task with the node module gulp-open. Then you can run the gulp task from inside Visual Studio Code.
Here's how you might configure the gulp task:
var open = require('gulp-open');
gulp.task('browser', function(){
// Define the source to match the file you wish to open:
gulp.src('./www/index.html')
// Designate the browser you wish the file opened in:
.pipe(open('<%file.path%>', {app: 'google-chrome'}));
});
});
Since we've named our task "browser", from inside Visual Studio Code we can hit command/control P to bring up the command pallet and type task. Then start to type browser. You should see code complete for the full task as you type. Hit return and it will open the your file in the browser you designate. Once the browser is open, you can resize it and Visual Studio Code so that they are side by side. Then as you work you can refresh the browser to see your changes.
You can consult the docs for gulp-open on NPM.
Directly from the editor, there are WYSIWYG editors such as Adobe Dreamweaver, Kompozer, etc. Though these often offer a poor preview of anything beyond simple HTML and CSS (i.e. no JS, no animations, possibly different CSS support).
Using a text editor such as the Visual Studio Code Editor, Sublime Text or vim, there is no such preview function.
Ideally, you'd want to test in the browser (the browsers you'd expect your target audience to be using) to ensure you have an idea of what exactly your visitors will see.
To save time between coding and previewing, you could simply keep the window/tab open in Chrome/Firefox/Edge and refresh after saving the file in the editor.