internal virtual bool InsertSpecificExpansion(IVsTextView view, XmlElement snippet, TextSpan pos, string relativePath) { if (this.expansionActive) { this.EndTemplateEditing(true); } if (this.source.IsCompletorActive) { this.source.DismissCompletor(); } this.view = view; MSXML.IXMLDOMDocument doc = new MSXML.DOMDocumentClass(); if (!doc.loadXML(snippet.OuterXml)) { throw new ArgumentException(doc.parseError.reason); } Guid guidLanguage = this.source.LanguageService.GetLanguageServiceGuid(); int hr = this.vsExpansion.InsertSpecificExpansion(doc, pos, this, guidLanguage, relativePath, out this.expansionSession); if (hr != NativeMethods.S_OK || this.expansionSession == null) { this.EndTemplateEditing(true); } else { this.expansionActive = true; return(true); } return(false); }
/// <include file='doc\ExpansionProvider.uex' path='docs/doc[@for="ExpansionProvider.InsertSpecificExpansion"]/*' /> public virtual bool InsertSpecificExpansion(IVsTextView view, XmlElement snippet, TextSpan pos, string relativePath) { if (this.expansionActive) { this.EndTemplateEditing(true); } if (this.source.IsCompletorActive) { this.source.DismissCompletor(); } this.view = view; MSXML.IXMLDOMDocument doc = new MSXML.DOMDocumentClass(); if (!doc.loadXML(snippet.OuterXml)) { throw new ArgumentException(doc.parseError.reason); } Guid guidLanguage = this.source.LanguageService.GetLanguageServiceGuid(); int hr = this.vsExpansion.InsertSpecificExpansion(doc, pos, this, guidLanguage, relativePath, out this.expansionSession); if (hr != NativeMethods.S_OK) { this.EndTemplateEditing(true); } else { // When inserting a snippet it is possible that the edit session is ended inside the insert // function (e.g. if the template has no editable fields). In this case we should not stay // in template edit mode because otherwise our filter will stole messages to the editor. if (!this.expansionActive) { this.expansionSession = null; } return(true); } return(false); }
internal virtual bool InsertSpecificExpansion(IVsTextView view, XmlElement snippet, TextSpan pos, string relativePath) { if (this.expansionActive) this.EndTemplateEditing(true); if (this.source.IsCompletorActive) { this.source.DismissCompletor(); } this.view = view; MSXML.IXMLDOMDocument doc = new MSXML.DOMDocumentClass(); if (!doc.loadXML(snippet.OuterXml)) { throw new ArgumentException(doc.parseError.reason); } Guid guidLanguage = this.source.LanguageService.GetLanguageServiceGuid(); int hr = this.vsExpansion.InsertSpecificExpansion(doc, pos, this, guidLanguage, relativePath, out this.expansionSession); if (hr != NativeMethods.S_OK || this.expansionSession == null) { this.EndTemplateEditing(true); } else { this.expansionActive = true; return true; } return false; }