cshtml files with more than one data-bind on a line get a tab (four spaces) insterted after the >data-bind="<. This happens when Visual Studio does "Format Document". And is therefore reproducible by Edit->Format Document.
Only the additional data-binds have this, so the 2nd and 3rd get spaces added while the first remains normal:
<input type="checkbox" data-bind="checked: Active" /><span data-bind="text: firstName"></span><span data-bind="text: lastName"></span>
Changes into:
<input type="checkbox" data-bind="checked: Active" /><span data-bind=" text: firstName"></span><span data-bind=" text: lastName"></span>
It's not a huge problem, stuff can be placed on seperate lines, but still annoying.
Edit: Since vs2013 I no longer have this problem. That also seems to have fixed another problem where vs would randomly decide to move my carret and type some spaces.
I am working with Visual studio 2012, and I don't facing this problem.
May be you could try to reset your VS settings.
If it doesn't work, I will post my settings.
Related
I'm making a web application using ASP.NET Core 2.2 and trying out Razor Pages more or less for the first time. When using "asp-for" attributes in order to bind an HTML input to a PageModel property, everything works just fine, but then when editing any attribute in any HTML element in the script that also has an "asp-for" attribute defined, all "asp-for" values for every other element but the one I'm editing are scrambled/wiped out.
I'm using the latest version of Visual Studio 2019 Community Edition and all extensions are up to date. ASP.NET Core 2.2 and all included packages are their respective latest stable versions.
I've tried disabling all extensions one by one, restarting the application each time to see if one of them is causing any strange behaviour- I'm not using many to begin with though, mostly just GitHub integration and "Format on Save" at the moment.
I've also tried going through the preferences and unchecking many of the validation options for HTML and C#, and things like automatic quotations for new attributes and closing bracket insertions... basically, anything that I thought could potentially have an impact. Nothing has worked.
An example would be something like:
<div>
<table>
<tr>
<td>Entry ID:</td>
<td><input type="text" asp-for="EntryID" /></td>
</tr>
<tr>
<td>Entry Name:</td>
<td><input type="text" asp-for="EntryName" /></td>
</tr>
</table>
</div>
When editing any of the attributes for any element with an asp-for attached, the asp-for value for the other tags will be scrambled. This happens both when I use the backspace key or the delete key, so it doesn't appear to be keyboard-shortcut related.
Here's a gif of the issue (not enough reputation to post images apparently- apologies).
https://drive.google.com/file/d/1f1gZSvGrQ8ehpTNwKOA2YbCkfLhx_o-M
If anyone has any ideas, I'd be quite grateful. This is really killing productivity and I haven't really come up with any ways to consistently get around the issue- usually when deleting the entire attribute all at once (which still scrambles other values), I can hit Undo once and it'll undo the scrambling but not the deletion itself. That's not 100% though, so it's just a big headache all around.
UPDATE 7/31: I've gone ahead and reported this to Microsoft as per Peter B's suggestion. A link to the report can be had here if anyone comes along with the same issue and are wondering at the progress there.
Your gif shows it happening for the id attribute, but you shouldn't try to specify the id because the Input Tag Helper already does it for you:
The Input Tag Helper:
* Generates the id and name HTML attributes for the expression name specified in the asp-for attribute. [...]
Source:
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/working-with-forms?view=aspnetcore-2.2
I agree that it seems to be acting a bit weird. If it persists, you can try reporting the weird behaviour, as described here: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2019
When I write the blow code in Watir-webdriver:
$browser.checkbox(:index,0).click
It gives the following error:
element not visible (Session info: chrome=48.0.2564.97) (Driver
info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
and then I have written this code $browser.input(:index,0).click then it reports this error:
unknown error: Element is not clickable at point (952, 17). Other
element would receive the click: ...
(Session info: chrome=48.0.2564.97) (Driver info:
chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64)
But the element is clearly visible and also the given above two lines of code cleanly works in watir-classic, we do not even need to scroll the screen.
Can anyone suggest me why it is the case? Why this watir-webdriver is not as comfortable as watir-classic?
<td class="centred"> <label class="label-checkbox"> <input type="checkbox" data-ng-model="cover.IsSelected" class="ng-pristine ng-valid"> <div class="fake-checkbox"> <span class="glyphicon glyphicon-ok"></span> </div> </label> </td>
The first thing you need to do is to update your chromedriver, as version 2.9 is 2 years old. That binary needs to be kept up to date with current versions of chrome. It is quite likely that this alone will fix your issue.
If it is an issue of visibility... The purpose of Watir (and Selenium and WebDriver) is to mimic the action of a user. If the checkbox isn't visible to the user, you shouldn't be able to click it in your test.
If the checkbox is something that isn't visible at first, but then becomes visible, you can do: browser.checkbox.when_present.click (note that index: 0 is the default behavior and is not necessary)
If the checkbox has some exciting javascript things that are covering it up in a way that it is never going to be visible, and clicking on something that is visible throws the "Element not clickable" error, you might have to do browser.checkbox.when_present.fire_event :click
That method does not mimic what a user actually does on your site, so it should only be used as a last resort.
I have the following line:
<input id="cbField{$idx}"
type="checkbox" value="{ID}"
{?checked}checked="checked"{Checked}"/>
<label for="cbField{$idx}">{Name}</label>
{?checked} is wrong, it should be {?Checked} with a Capital C.
When I copy 'Checked' and past it on 'checked', VS "correct" them both to 'checked'.
I work with dust.js so I'm not writing 100% "right of the bat" valid HTML and I'd like to prevent visual studio to make any single change to what I type
How can this be done?
I found it, it's in HTML/... Advanced : Format on paste.
Tools / Options / Text Editor / HTML / Advanced / Format on past
On my VS version
Yes I set "top level elements" to "projects"
Here is how it looks when I load my zend studio.
I want it to load so that all my projects are there instead of having to press that up button 20 times...
Find the file below to edit in your favorite text editor:
workspace.metadata.plugins\org.eclipse.ui.workbench\workbench.xml
In my case:
C:\Users\juliano\Zend\workspaces\DefaultWorkspace.metadata.plugins\org.eclipse.ui.workbench
And find the line:
<input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/xxx" type="4"/>
In my case it was:
<input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/Electrolux" type="4"/>
and replace it by
<input factoryID="org.eclipse.ui.internal.model.ResourceFactory" path="/" type="8"/>
And again have peace!
Is there any way to place a row of buttons or link buttons next to each other on a webform without a white space showing between them when viewed in the browser?
thanks again
Well, for starters once you get to the "when viewed in the browser" stage in the process, you're well outside of Visual Studio and into straight HTML/CSS. In HTML/CSS, this can be done:
<input type="button" value="test" /><input type="button" value="test" /><input type="button" value="test" /><input type="button" value="test" /><input type="button" value="test" />
and
input { margin: -1px; }
Using CSS is generally the best way to do this, rather than trying to come up with some custom thing within Visual Studio. It's more native to the target platform, the web browser. The CSS in my example would cover all input elements on the page, of course, so you probably don't want that. But if you can uniquely identify your rendered buttons (perhaps input elements within a div of a known id?) then you can apply that style only to them.