public int GetCurrentColumn(TokenData tokenData) { return(GetColumn(tokenData, _getTriviaData)); }
public int GetCurrentColumn(TokenData tokenData) => GetColumn(tokenData, _getTriviaData);
private bool ApplyBaseTokenIndentationChangesFromTo( TokenData baseToken, TokenData startToken, TokenData endToken, Dictionary <SyntaxToken, int> previousChangesMap, CancellationToken cancellationToken ) { // if baseToken is not in the stream, then it is guaranteed to be not moved. var tokenWithIndex = baseToken; if (tokenWithIndex.IndexInStream < 0) { return(false); } // now, check whether tokens on that the base token depends have been moved. // any token before the base token on the same line has implicit dependency over the base token. while (tokenWithIndex.IndexInStream >= 0) { // check whether given token have moved if (previousChangesMap.ContainsKey(tokenWithIndex.Token)) { break; } // okay, this token is not moved, check one before me as long as it is on the same line var tokenPairIndex = tokenWithIndex.IndexInStream - 1; if ( tokenPairIndex < 0 || _context.TokenStream.GetTriviaData( tokenPairIndex ).SecondTokenIsFirstTokenOnLine ) { return(false); } tokenWithIndex = tokenWithIndex.GetPreviousTokenData(); } // didn't find anything moved if (tokenWithIndex.IndexInStream < 0) { return(false); } // we are not moved var indentationDelta = _context.GetDeltaFromPreviousChangesMap( tokenWithIndex.Token, previousChangesMap ); if (indentationDelta == 0) { return(false); } startToken = startToken.IndexInStream < 0 ? _context.TokenStream.FirstTokenInStream : startToken; endToken = endToken.IndexInStream < 0 ? _context.TokenStream.LastTokenInStream : endToken; ApplyIndentationDeltaFromTo( startToken, endToken, indentationDelta, previousChangesMap, cancellationToken ); return(true); }