In Tools > Options, I cannot find the setting to disable auto-renaming of elements which are pasted in HTML source view.
It used to be: Tools > Options > Text Editor > HTML > Miscellaneous > Auto ID elements on paste in Source view. But that option is gone in Visual Studio 2013.
How can I disable the auto-renaming?
For now the best solution seems to be a workaround that was posted by a user on the Microsoft Connect website which is to paste the code as a comment.
Fool the IDE that we're not pasting code (thus he won't alter it). How ? Paste a comment ! How to do that in real life ? Here is how I do it (feel free to suggest other ways!):
1) Place cursor where I want to paste code
2) ctrl-k, ctrl-c (i.e.
comment region. Since no region was selected, an empty comment is
inserted and our cursor Inside of it) 3) ctrl-v (paste content that is
believed to be a comment by the IDE) 4) ctrl-k, ctrl-u (i.e.
un-commenting the current comment we're in!
The auto ID assigning is made only if the ID is used by another control on the same page.
Copy the code and paste in external editor like Notepad++, then copy it again from NP++ and paste it in the code editor page, the ID should remain the same.
Related
We used to be able to type ! inside an html document in vscode to get html boiler plate content completion as documented here.
However it no longer works. Thoughts?
I noticed that if we type ! and select Edit > Expand Abbreviation, the ! is replaced with boilerplate, but I no longer get the intellisense that was there before.
Update
Looks like we need to do ctrl+shift+p and search for User Settings. Filter for the emmet settings and select the Trigger expansion on tab then the ! is replaced with the corresponding emmet snippet.
I also selected Show suggestions as snippets, but the intellisense / snippet is still not showing up.
If you want to get html boilerplate with Emmet Abbreviation, you should type html:5 and hit tab.
I have faced this issue in visual studio.
Step-1:
try below steps in url. https://marketplace.visualstudio.com/items?itemName=sidthesloth.html5-boilerplate
Step-2:
if it worked : "cheers .!"
else:
it could be issue with select language mode. on the bottom of visual studio next to LF on your screenshot select language mode and change it to html.
Thanks & Regards, Surya kiran.
The issue was with Language mode only. You will get the option to select the Langauage mode on the bottom.
Been very annoyed for many, many long minutes by the boilerplate shortcut's suddenly, inexplicably not working (maugre much extension-de-installing and intalling and re-installing, even with VS Code uninstalls and re-installs, but what I'm come up with from mining various forums (what does seem to work and doesn't appear to be settings-dependent or peculiar to my laptop) is:
COMMAND+K plus COMMAND+L (one can just HOLD COMMAND and type K and then L sequentially).
In the Emmet Abbreviation window that comes up type ! as usual and then press Enter/Return.
Simply striking ! will bring up the boilerplate. One can then simply press Enter to return to the code.
The two-stroke process of ! + TAB is now replaced by the only marginally more involved five-stroke process of ⌘ + K + L + ! + Enter.
For me it was the "<" problem
this is not working: <html
this is working: html
After a recent update to VS Code the familiar why of getting a html boilerplate failed. You could add a index.html to the file explore and the window would open for its content.
Using Shift and the exclamation mark key would produce it. That is no longer the case instead create your file in the explore. When it opens the window type html, you will receive a dropdown to select from instead.
enter image description here
I experienced this issue after configuring my VS Code environment for an online course. In my case, the behavior was due to the following pair being added to my settings.json file:
"emmet.showExpandedAbbreviation": "never"
After I removed this, the shortcuts returned.
When copying and pasting HTML, VS helpfully renames all my variables to things like "Div1" & "Img1". Why!
I remember when using VS 2010 I think it was, there was a setting that allowed us to turn this "feature" off. Seems that feature no longer exists.
Are there any plugins or extensions or workarounds for this problem?
Seems that people have been complaining about this for years now:
How do I prevent Visual Studio from renaming my controls?
Disable "Auto ID elements" in Visual Studio 2013
https://connect.microsoft.com/VisualStudio/feedback/details/806446/asp-net-web-forms-development-unable-to-disable-auto-id-generation-on-paste-using-new-version-of-visual-studio-2013
You can use the following command (Language: C#) for my Visual Commander extension to paste text as is without renaming variables:
public void Run(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
EnvDTE.TextSelection ts = DTE.ActiveDocument.Selection as EnvDTE.TextSelection;
ts.Insert(System.Windows.Clipboard.GetText());
}
Here is the simplest workaround.
Simply make a comment first, then paste into the comment. When uncommenting, it will not apply Auto ID.
As a keyboard shortcut, it's CTRL+K,C,V,K,U on a new line.
Comment (KC), Paste (V), Uncomment (KU).
You can disable this auto-tag closing in Options > Text Editor > HTML u can find here everything about html editor.Search for AutoTag or Format Html on paste!
In Sublime text cmd+shift+v will paste and indent the code. Can this be done in visual studio code?
Workaround
I've made an extension that will let you paste and format with cmd/ctrl+shift+v.
Search for pasteandformat
https://marketplace.visualstudio.com/items?itemName=spoeken.pasteandformat
Currently, Visual Studio Code doesn't provide this specific functionality.
We could vote for this feature at Visual Studio's UserVoice website.
There's already a ticket open for this feature: Paste and auto align code. If you've got an account, you can vote for this feature so it gets more attention. If it has enough attention, Visual Studio Code's developers could take notice of this and maybe develop it.
Current workaround
After pasting the code,
You could use CTRL+E, CTRL+D for windows or ALT+SHIFT+F for mac.
But note that this will reformat the whole document, indenting according to the available rules for the source type.
If you only want this to be applied to the pasted code, select the code after pasting and then use CTRL+E, CTRL+D for windows or ALT+SHIFT+F for mac. Now the indenting/formatting is only applied to the pasted lines.
Since version 1.9.0, editor.formatOnPaste landed in VSCode.
Open settings.json via Code -> Preferences - Settings and search for formatOnPaste
// Controls if the editor should automatically format the pasted
content. A formatter must be available and the formatter should be
able to format a range in a document.
"editor.formatOnPaste": true,
Modify false to true since the default value is false
Source: Changelog update 1.9.0
Is there any eclipse shortcut/trick/plugin/whatever that will allow me to select a section of text and surround it with an arbitrary html/xml tag when using the html editor.
Something like this textmate video
EDIT: not sure If my Eclipse setup is the same as yours, but...
I have the HTML Editor installed, and if I switch to the Java perspective, I can use Edit -> Quick Fix and then choose Surround with new element to get exactly the effect in your video. (On a Mac, the shortcut for this is ⌘1).
Hope this is helpful.
In the C++ editor, you can try Source -> Surround With... -> Configure Templates to add the tag you want.
The following works and allows for entering random/arbitrary tags:
Select the desired text that you want wrap.
Go to 'Edit > Quick Fix' or press 'Ctrl + 1'.
In the new menu that appears select 'Surround with new element'
However there is an annoyance, please upvote Bug 494169
Is it possible to auto-format your code in Dreamweaver like in Visual Studio (ctrl+k+d)
A quick Google search turns up these two possibilities:
Commands > Apply Formatting
Commands > Clean up HTML
Commands > Apply Source Formatting.
Works a treat.
For the 2017 CC release this has been moved (after many years of habit development). Find it now at:
Edit > Code > Apply Source Formatting.
It may be prudent to set up a keyboard shortcut if this is something you'll need regularly.
Edit > Keyboard Shortcuts
Following works perfectly for me:
-*click on COMMAND and click on APPLY SOURCE FORMATTING
- *And click on Clean Up HTML
Thank you PEKA
This is the only thing I've found for JavaScript formatting in Dreamweaver. Not many options, but it seems to work well.
JavaScript source format extension for dreamweaver: Adobe CFusion
I tried some of the sources online and finally, the below selection works fine for me (Dreamweaver on Mac). For versions above Adobe Dreamweaver CC 2017 and above:
Adobe says:
Edit > Code > Apply Source Formatting
Moreover, full documentation with other supporting information for tasks such as setting defaults, etc. on https://helpx.adobe.com/dreamweaver/using/format-code.html.
And for JavaScript source format you can use Dreamweaver JavaScript source formatting extension.(available on adobe)
Auto formatting can be done by
Select View > Code View Options
Click the View Options button in the toolbar at the top of Code view or the Code inspector.
Auto Indent Makes your code indent automatically when you press Enter while writing code.
source
Please use shortcut key alt+c+a
Please click on "edit" -> then keyboard shortcuts. It`s straight forward from there. Just select the command from the list, and press the + button.
You will need to create a duplicate set, then select it again from the list. And finally set a keyboard shortcut!
Now, before saving, press the shortcut you just created!
Coding toolbar (Edit > Toolbars > Coding) and select Code Format Settings to set your preferred formatting.
You can also access the formatting option from Commands > Apply Source Formatting or only apply it to a select block of code by selecting the Apply Source Formatting to Selection option.
http://www.hongkiat.com/blog/10-useful-dreamweaver-tips-for-beginners/
ctrl+a->(click)commands->cleanup word HTML