Пример #1
0
        private bool TryGetIndentation(SyntaxElement element, out int indentation)
        {
            if (_elementIndentations.TryGetValue(element, out indentation))
            {
                return(true);
            }

            // if no specific indentation is recorded for a node,
            // use the indentation of its first token
            if (element is SyntaxNode node)
            {
                var token = element.GetFirstToken();

                if (token != null && _elementIndentations.TryGetValue(token, out indentation))
                {
                    return(true);
                }
            }

            return(false);
        }