private DeveroomTag CreateDefinitionBlockTag(IHasDescription astNode, string tagType, ITextSnapshot fileSnapshot, int lastLine, DeveroomTag parentTag = null)
        {
            var span     = GetBlockSpan(fileSnapshot, ((IHasLocation)astNode).Location, lastLine);
            var blockTag = new DeveroomTag(tagType, span, astNode);

            parentTag?.AddChild(blockTag);
            blockTag.AddChild(CreateDefinitionLineKeyword(fileSnapshot, astNode));
            if (astNode is IHasTags hasTags)
            {
                foreach (var gherkinTag in hasTags.Tags)
                {
                    blockTag.AddChild(
                        new DeveroomTag(DeveroomTagTypes.Tag,
                                        GetTextSpan(fileSnapshot, gherkinTag.Location, gherkinTag.Name),
                                        gherkinTag));
                }
            }

            if (!string.IsNullOrEmpty(astNode.Description))
            {
                var startLineNumber = ((IHasLocation)astNode).Location.Line + 1;
                while (string.IsNullOrWhiteSpace(fileSnapshot.GetLineFromLineNumber(GetSnapshotLineNumber(startLineNumber, fileSnapshot)).GetText()))
                {
                    startLineNumber++;
                }
                blockTag.AddChild(
                    new DeveroomTag(DeveroomTagTypes.Description,
                                    GetBlockSpan(fileSnapshot, startLineNumber,
                                                 CountLines(astNode.Description))));
            }

            return(blockTag);
        }
 private void AddParameterTags(ITextSnapshot fileSnapshot, ParameterMatch parameterMatch, DeveroomTag stepTag, Step step)
 {
     foreach (var parameter in parameterMatch.StepTextParameters)
     {
         stepTag.AddChild(new DeveroomTag(DeveroomTagTypes.StepParameter,
                                          GetSpan(fileSnapshot, step.Location, parameter.Length, offset: step.Keyword.Length + parameter.Index),
                                          parameter));
     }
 }
 private void TagRowCells(ITextSnapshot fileSnapshot, TableRow row, DeveroomTag parentTag, string tagType)
 {
     foreach (var cell in row.Cells)
     {
         parentTag.AddChild(new DeveroomTag(tagType,
                                            GetSpan(fileSnapshot, cell.Location, cell.Value.Length),
                                            cell));
     }
 }
        private void AddPlaceholderTags(ITextSnapshot fileSnapshot, DeveroomTag stepTag, Step step)
        {
            var placeholders = MatchedScenarioOutlinePlaceholder.MatchScenarioOutlinePlaceholders(step);

            foreach (var placeholder in placeholders)
            {
                stepTag.AddChild(new DeveroomTag(DeveroomTagTypes.ScenarioOutlinePlaceholder,
                                                 GetSpan(fileSnapshot, step.Location, placeholder.Length, offset: step.Keyword.Length + placeholder.Index),
                                                 placeholder));
            }
        }