This repository was archived by the owner on Oct 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
src/AddIns/BackendBindings/XamlBinding/XamlBinding Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -397,7 +397,9 @@ bool DoMarkupExtensionCompletion(XamlCompletionContext context)
397397 if ( context . Description == XamlContextDescription . InMarkupExtension && context . AttributeValue != null && ! context . AttributeValue . IsString ) {
398398 if ( ! XamlBindingOptions . UseExtensionCompletion )
399399 return false ;
400- XamlCompletionItemList completionList = generator . CreateMarkupExtensionCompletion ( context ) as XamlCompletionItemList ;
400+ var completionList = generator . CreateMarkupExtensionCompletion ( context ) as XamlCompletionItemList ;
401+ if ( completionList == null )
402+ return false ;
401403 string word = context . Editor . GetWordBeforeCaretExtended ( ) ;
402404 if ( context . PressedKey != '.' && context . PressedKey != '=' && ! word . EndsWith ( "." , StringComparison . Ordinal ) && completionList . PreselectionLength == 0 )
403405 completionList . PreselectionLength = word . Length ;
Original file line number Diff line number Diff line change @@ -41,9 +41,13 @@ public override CompletionItemListKeyResult ProcessInput(char key)
4141 if ( key == ':' || key == '/' )
4242 return CompletionItemListKeyResult . NormalKey ;
4343
44- if ( key == '.' && ( context . InAttributeValueOrMarkupExtension && context . Attribute . Name . StartsWith ( "xmlns" ) ) )
44+ if ( key == '.' && ( context . InAttributeValueOrMarkupExtension && context . Attribute . Name . StartsWith ( "xmlns" , StringComparison . Ordinal ) ) )
4545 return CompletionItemListKeyResult . NormalKey ;
4646
47+ // cancel completion if user might want to start a markup extension and value is still empty
48+ if ( key == '{' && ( context . InAttributeValueOrMarkupExtension && string . IsNullOrEmpty ( context . RawAttributeValue ) ) )
49+ return CompletionItemListKeyResult . Cancel ;
50+
4751 return base . ProcessInput ( key ) ;
4852 }
4953
You can’t perform that action at this time.
0 commit comments