While the new directive attributes feature is great, it feels like the editor experience needs a lot more review and polish. Trying to type them is quite a bizarre and hostile experience currently :)
Examples:
<input @bind="@someText" @bind:ev. It will prompt you to auto-complete @bind:event, which is perfect, but then if you press tab to accept the suggestion, it replaces what you just typed with <input @bind="@someText" @bind="", which is not at all what you want. Note that it only does this if you've just typed out all of what I wrote here, and not if you go back and edit an existing <input>..razor file: <input @bind="@someText" />. For some reason it inserts a space between @ and bind, so you get <input @ bind="@someText" />. Was this recently fixed? I remember hearing something about this.<div @bind and then press the = character. For some reason it transforms what you typed into this: <div bind-="". I know it's strange to try doing a bind on a div, but this still is an editor bug. Maybe it surfaces in other ways too. <entry>
<record>1127</record>
<time>2019/06/05 12:12:27.457</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.ArgumentException: An entry with the same key already exists.
 at System.Collections.Specialized.ListDictionary.Add(Object key, Object value)
 at System.Collections.Specialized.HybridDictionary.Add(Object key, Object value)
 at Microsoft.VisualStudio.Utilities.PropertyCollection.AddProperty(Object key, Object property)
 at Microsoft.VisualStudio.Language.Intellisense.Implementation.ShimCompletionSessionExtensions.ToLegacy(IAsyncCompletionSession session, SnapshotPoint triggerLocation)
 at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.CreateCompletionSession(ITextView textView, ITrackingPoint triggerPoint, Boolean trackCaret)
 at Microsoft.VisualStudio.Language.Intellisense.Implementation.CompletionBroker.TriggerCompletion(ITextView textView)
 at Microsoft.WebTools.Languages.Shared.Editor.Completion.CompletionController.TriggerCompletion()
 at Microsoft.WebTools.Languages.Shared.Editor.Completion.CompletionController.ShowCompletion(Boolean autoShownCompletion)
 at Microsoft.WebTools.Languages.Shared.Editor.Completion.CompletionController.OnPostTypeChar(Char typedCharacter)
 at Microsoft.WebTools.Languages.Html.Editor.Completion.HtmlCompletionController.OnPostTypeChar(Char typedCharacter)
 at Microsoft.WebTools.Languages.Shared.Editor.Completion.TypingCommandHandler.OnPostTypeChar(Char typedChar)
 at Microsoft.WebTools.Languages.Shared.Editor.Completion.TypingCommandHandler.PostProcessInvoke(CommandResult result, Guid group, Int32 id, Object inputArg, Object& outputArg)
 at Microsoft.WebTools.Languages.Html.Editor.Commands.HtmlTypingCommandHandler.PostProcessInvoke(CommandResult result, Guid group, Int32 id, Object inputArg, Object& outputArg)
 at Microsoft.WebTools.Languages.Shared.Editor.Controller.Controller.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg)
 at Microsoft.WebTools.Languages.Html.Editor.Commands.HtmlMainController.Invoke(Guid group, Int32 id, Object inputArg, Object& outputArg)
 at Microsoft.VisualStudio.Html.Interop.CommandTargetToOleShim.Exec(Guid& guidCommandGroup, UInt32 commandID, UInt32 commandExecOpt, IntPtr variantIn, IntPtr variantOut)
 at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
 at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
 at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
 at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam)
 at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args)
 at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c.<DispatchTextInputEvents>b__6_0(KeyProcessor p, TextCompositionEventArgs args)
 at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c__DisplayClass10_1`1.<Dispatch>b__0()
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)
--- End of stack trace from previous location where exception was thrown ---
 at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)</description>
</entry>
onblur but it completes as onabort:
Note: This is all using VS 29004.115.d16.2 (i.e., int.d16.2 channel)
@NTaylorMullen - which ones of these are the issues that are already being worked on?
All of the above completion issues will be fixed by @amadeusw's VS insertion and the formatting one will be fixed by @ToddGrun's insertion.
So, these are all known and are pending insertions into VS. I still plan to update the dogfood alias for when we have a viable VS build, stay tuned!
Oh and the exception one is also fixed by @AmadeusW's changes.
That's great to hear!
@SteveSandersonMS I marked this as done, if you could close this once you've verified everything on your end now works that'd be great!
I got the latest d16.2 today (29006.145.d16.2), and most of these do appear to be fixed :)
However,
<div @bind= still gets transformed into <div @bind-=""@bind= still adds a space between @bind and = if you do it sufficiently quickly after first creating the .razor files. On my machine, when you create a new .razor file using the item template, there's a period of at least 5 seconds before VS starts applying Razor conventions to it. If you paste anything during that period, you get the extra space inserted (plus of course none of the tag helpers light up). Is this expected? Is there any easy fix?Assigning back to Taylor for comments. The remaining issues are pretty minor at this stage. Thanks for fixing the major ones!
- Typing
<div @bind=still gets transformed into<div @bind-=""
Isn't that expected? I don't believe there is an @bind on div so it does the only completion that makes sense @bind-
- Pasting markup that contains
@bind=still adds a space between@bindand=if you do it sufficiently quickly after first creating the.razorfiles. On my machine, when you create a new.razorfile using the item template, there's a period of at least 5 seconds before VS starts applying Razor conventions to it. If you paste anything during that period, you get the extra space inserted (plus of course none of the tag helpers light up). Is this expected? Is there any easy fix?
There's not much here we can do sadly because the system doesn't yet understand the valid components in the file (or even if it is a component) and therefore tries to format the document as if @bind was an implicit expression. @bhsubra @ToddGrun how important is formatting implicit expressions by adding spaces like this? Aka, what scenarios does it enable?
Isn't that expected? I don't believe there is an @bind on div so it does the only completion that makes sense @bind-
I agree it's an edge case. But I don't agree that <div @bind-="" ever makes sense. It's malformed.
I wouldn't consider it super high priority to do anything about this, except if it also repros in more common cases.
@mkArtakMSFT this doesn't meet the bar for preview7. Heck this could come in post-3.0 馃槃
I'm closing this now, given the scenario to be fixed is a corner case one.
Most helpful comment
@mkArtakMSFT this doesn't meet the bar for preview7. Heck this could come in post-3.0 馃槃