Intellisense <% = intended <% @Assembly = returned
When I edit my aspnetmvc views, I start the code brackets:
<%
and intellisense float items like
<% @Assembly ... <% @ Control ... <% @ etc.
which is good, but when I continue my line and press the [=] key, it automatically selects <% @Assembly =%> and completes my tag.
It's not a huge deal, but it slows me down a bit, especially when editing forms with missing fields.
Has anyone encountered this problem in the past and there is a way to either add <% = to intellisense or stop returning other directives when I press [=].
I remember seeing the same problem in one of Phil Haaz's recent demonstrations (he says something like "What was that?" And then continues), but I don't remember which one.
Thanks for the help,
Hal
source share
I think I found the answer. I created the following macro:
Option Strict Off Option Explicit Off Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports System.Diagnostics Public Module RecordingModule Sub CleanupImplementedInterface() DTE.ActiveDocument.Selection.LineDown(True, 7) DTE.ActiveDocument.Selection.Text = " {get" DTE.ActiveDocument.Selection.DeleteLeft(3) DTE.ActiveDocument.Selection.Text = " get; set; }" DTE.ActiveDocument.Selection.CharRight DTE.ExecuteCommand ("Edit.Replace") DTE.Find.FindWhat = " {" DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument DTE.Find.MatchCase = False DTE.Find.MatchWholeWord = False DTE.Find.Backwards = False DTE.Find.MatchInHiddenText = True DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral DTE.Find.Action = vsFindAction.vsFindActionFind If(DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then Throw New System.Exception("vsFindResultNotFound") End If DTE.Windows.Item("{CF2DDC32-8CAD-11D2-9302-005345000000}").Close DTE.ActiveDocument.Selection.CharLeft End Sub Sub Brackets() DTE.ActiveDocument.Selection.Text = "<%=" End Sub End Module
Then in the IDE I opened Tools> Options> Environment> Keybord
In the "Show commands containing:" text box, I typed the name of my macro.
Then I selected "HTML Source Editor" from the "Use new shortcut in:" dropdown and pressed the Alt-B shortcut key.
Now when I need a parenthesis, instead of using intellisense, I just press Alt-B in the editor.
Ugly but workable solution. Hopefully they will fix this in 2010. Didn't look.
source share