MCPcopy Create free account
hub / github.com/LaBatata101/sith-language-server / new_tokens

Function new_tokens

crates/sith_python_parser/src/lib.rs:653–665  ·  view source on GitHub ↗

Helper function to create [`Tokens`] from an iterator of (kind, range).

(tokens: impl Iterator<Item = (TokenKind, Range<u32>)>)

Source from the content-addressed store, hash-verified

651
652 /// Helper function to create [`Tokens`] from an iterator of (kind, range).
653 fn new_tokens(tokens: impl Iterator<Item = (TokenKind, Range<u32>)>) -> Tokens {
654 Tokens::new(
655 tokens
656 .map(|(kind, range)| {
657 Token::new(
658 kind,
659 TextRange::new(TextSize::new(range.start), TextSize::new(range.end)),
660 TokenFlags::empty(),
661 )
662 })
663 .collect(),
664 )
665 }
666
667 #[test]
668 fn tokens_after_offset_at_token_start() {

Calls 2

emptyFunction · 0.85
collectMethod · 0.80