Given a view with the following Razor code:
#Url.Action("Index", "Home")
I want to add an Area parameter like so:
#Url.Action("Index", "Home", new { Area = "Manage" })
But when I start typing, this happens:
#Url.Action("Index", "Home", new object{Area = ""Manage"}) // broken double quote
How do I stop Visual Studio from completing the broken double quote so I don't have to play tetris for each link? Could ReSharper be causing this? I can't find the option for it.
If you type your code inside attribute, for example
<a href="#Url.Action("Index", "Home", new { Area = "Manage" })">
then ReSharper can erroneously add a quote, resulting in "Manage"". This should be fixed in the last ReSharper 7.0 EAP releases. In previous versions, try turning off ReSharper | Options -> Environment | Editor -> Auto-insert pair brackets, parenthesis and quotes.
I find that feature quite nifty but if you want it out of your way, then:
1. Go to "Tools" > "Options".
2. Expand the "Text Editor" node.
3. Expand the "HTML" node.
4. Uncheck the "Insert attribute value quotes when typing" field.
If you have ReSharper, then do this:
1. Go to ReSharper -> Options -> Intellisense -> General.
2. Check the Visual Studio option.
This will leave ReSharper out of the intellisense loop.
Related
While implementing custom form in Blazor I am not able to bind value to html input box.
<div class="col-sm-4">
<input type="text" class="form-control" id="title" placeholder="Blog Title"
#bind-Value="blogTitle" #bind-value:event="oninput" />
</div>
#code
{
string blogTitle = "";
}
I am using Blazor version 3.2.0 preview version.
Any help would be appreciated. Thanks
After restarting visual studio it worked. The correct one is with "V" capital.
#bind-Value="blogTitle"
#bind-Value:event="oninput"
There is seems to be issue with Visual Studio 2019 preview. Whenever I add new nutget package it gives errors for missing references. I have to restart my visual studio so that newly added package takes effect. I hope updating visual studio with latest version will resolve the issue.
try to type lower case "V"
#bind-Value
replace to
#bind-value
With child components like InputDate, InputCheckbox etc use capital 'V'
But for child components like textarea, label etc use lower case 'v'.
<ul{{attributes.addClass('container container-desktop')}}>
when I press Command + / (autoformat), all my classes are without whitespace:
<ul{{attributes.addClass('containercontainer-desktop')}}>
I searched in the settings of Visual Studio Code for a setting. But did not found a solution to disable it.
That's a correct behavior from your IDE, because addClass with a string parameter is meant to add one class.
For multiple classes, refer to this documentation:
{%
set classes = [
'red',
'green',
]
%}
<div{{ attributes.addClass(classes) }}></div>
Try this and see if it solves the problem for you.
Open Visual Studio Code and:
Click menu File → Preferences → *Settings.
Click {} at the top
It leads you to a settings.json file were you'll
add: "files.trimTrailingWhitespace": true
Save your file.
So I know autocomplete works great when you start typing a value. For example, the second you type the "c" in text-align:center, the available autocomplete values pop up (such as center, left, right).
However, when I used Dreamweaver, for properties with specific value options like text-align (center, right, left), display (block, inline-block), cursor (pointer, default), etc., the autocomplete popup would show immediately after the property was typed, it did NOT wait until I started typing a value. Right after text-align: was typed out, it would show me the autocomplete popup giving me the options center, right, left.
The value autocomplete should fire right after my property autocomplete fires:
So after I type te...
the autocomplete popup for "te" properties displays text-align, text-decoration, text-shadow etc....
then I press Enter to select text-align...
then immediately after pressing Enter an autocomplete popup should show for the text-align values: center, left, right.
Any idea how this can be accomplished in Sublime Text 3?
You can get ST to show the autocompletion popup again straight after a completion has been inserted using a small plugin and some preferences:
With a CSS file open in ST, open the Preferences menu and select Preferences - Syntax Specific. Add the following to the settings on the right hand side:
"auto_complete_triggers":
[
{
"characters": ": ",
"selector": "source.css meta.property-list.css meta.property-value.css"
},
],
and save it. This will tell ST to show the autocomplete popup automatically in CSS files when typing a : or a space when the syntax expects a property value.
Now, unfortunately, ST doesn't consider an autocompletion to have "typed" anything, so this trigger isn't fired automatically when selecting a property value like text-align from the autocomplete popup, which inserts text-align:. So, to get round that, this is where we need a small plugin. From the Tools menu, choose Developer -> New Plugin...
Select all text and replace with the following and save it, in the folder ST recommends (Packages/User/) as something like show_autocomplete_after_completion.py:
import sublime
import sublime_plugin
class AutoCompleteListener(sublime_plugin.EventListener):
def on_post_text_command(self, view, command_name, args):
if command_name in ('commit_completion', 'insert_best_completion'):
act = view.settings().get('auto_complete_triggers', [])
scope = view.scope_name(view.sel()[0].begin())
char = view.substr(view.sel()[0].begin() - 1)
for trigger in act:
if sublime.score_selector(scope, trigger['selector']) > 0:
if char in trigger['characters']:
view.run_command('auto_complete', { 'insert_best_completion': False })
break
This plugin basically detects when a completion has been inserted (although due to a limitation of the ST API, it can't detect when you click on an entry with the mouse - see https://github.com/SublimeTextIssues/Core/issues/1166), and if the text/character immediately before the caret matches one of the autocompletion triggers defined in the settings, then it will show the autocomplete popup again.
You can try out this package. This package indexes your .less and .scss (or .sass) and caches your mixins, variables, class or id names and autocompletes both on html and css. It autocompletes your less and sass mixins with mixin arguments. It also supports emmet completions and gets your css classes on popup window. -
https://github.com/subhaze/CSS-Extended/
I really like how Emmet generates HTML based on 'CSS-like' strings but I don't want to use their CSS Abbreviations. Cause when I write a piece of css as follows:
li a|
And I press 'TAB', I want to get a Tab
li a |
But with Emmet I get the following when I press Tab
li |-webkit-appearance: none;
-moz-appearance: none;
appearance: none
How can I disable this functionality of Emmet?
In Emmet.sublime-settings you have to update disable_tab_abbreviations_for_scopes property: add source.css to disable Tab trigger completely in CSS.
Also, if you’re on ST2, you may want to take a look at disable_tab_abbreviations_for_regexp preference due to some bugs in ST2 scope matcher.
If you installed with package control, search for Package Control: Remove Package in the command palette. Otherwise you can just remove the Emmet directory.
If you wish to use a custom caption to access commands, create Default.sublime-commands in your User folder. Then insert something similar to the following.
[
{
"caption": "Package Control: Uninstall Package",
"command": "remove_package"
}
]
Of course, you can customize the command and caption as you see fit.
Or try like this: CTRL + SHIFT + P >> Remove Package >>
Select package to remove then press enter
Instead of pressing Tab, you can use Shift+Tab to insert a tab without triggering the tab trigger.
It’s documented in the Sublime Text documentation.
Preferences.sublime-settings - toggle on/off is there.
I'm a long time Sublime Text user but I recently downloaded WebStorm 6 (6.0.2) and I really like it but I haven't been able to find a plugin that matches Sublime's Alignment Plugin that re-formats my code which I use extensively (yes, I'm slightly fanatical about my code formatting).
For example, in Sublime I can take this code block:
user : {
name : "Bruce Wayne",
alias : "Batman",
favColour : "black",
dob : "unknown"
}
And after using the Alignment keyboard shortcut it becomes:
user : {
name : "Bruce Wayne",
alias : "Batman",
favColour : "black",
dob : "unknown"
}
I've looked into the "Reformat Code" option (Code > Reformat Code...) but in this case it doesn't do anything to the formatting as Webstorm believes that it's already correctly formatted, which is in fact entirely correct, just not to my personal standards.
So my question is: is there a (fairly) easy way to accomplish this or is there a plugin that you know of available for WebStorm that offers the same/similar functionality?
Thanks in advance!
Code formatting settings are configured at Settings (Preferences on Mac) | Code Style | JavaScript. The Reformat Code is just a command that reformats selection/file accordingly to those rules.
The Code Style for JavaScript has an option to make such alignment:
"Spaces" tab | Other | Before property name-value separator ':' -- ticked
"Other" tab | Align object properties = On colon