public SnippetEditorForm() { snippetImports.CollectionChanged += snippet_CollectionChanged; snippetReferences.CollectionChanged += snippet_CollectionChanged; snippetAlternativeShortcuts.CollectionChanged += snippet_CollectionChanged; reservedReplacements.Add("end"); reservedReplacements.Add("selected"); textSearchService = SnippetDesignerPackage.Instance.ComponentModel.GetService <ITextSearchService>(); validPotentialReplacementRegex = SnippetRegexPatterns.BuildValidPotentialReplacementRegex(); }
private void MarkReplacements(ICollection <string> replaceIDs) { if (CodeWindow.TextBuffer == null) { return; } var findData = new FindData(SnippetRegexPatterns.BuildValidReplacementString(SnippetDelimiter), CodeWindow.TextBuffer.CurrentSnapshot, FindOptions.UseRegularExpressions, null); var candidateSpans = textSearchService.FindAll(findData); foreach (var candidateSpan in candidateSpans) { var replacementText = candidateSpan.GetText(); var textBetween = TurnReplacementSymbolIntoText(replacementText); if (!replaceIDs.Contains(textBetween)) { CreateReplacement(textBetween); } } }