|
|
|
|
@ -1238,13 +1238,18 @@ fn atom_from_cursor<'a>(
|
|
|
|
|
content = content.trim();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 'extra' nodes in tree-sitter are comments. Most parsers use
|
|
|
|
|
// 'comment' as their comment node name, but if they don't we can
|
|
|
|
|
// still detect comments by looking at their syntax highlighting.
|
|
|
|
|
let highlight = if node.is_extra()
|
|
|
|
|
node.is_error();
|
|
|
|
|
|
|
|
|
|
let highlight = if node.is_error() {
|
|
|
|
|
AtomKind::TreeSitterError
|
|
|
|
|
} else if node.is_extra()
|
|
|
|
|
|| node.kind() == "comment"
|
|
|
|
|
|| highlights.comment_ids.contains(&node.id())
|
|
|
|
|
{
|
|
|
|
|
// 'extra' nodes in tree-sitter are comments. Most parsers use
|
|
|
|
|
// 'comment' as their comment node name, but if they don't we
|
|
|
|
|
// can still detect comments by looking at their syntax
|
|
|
|
|
// highlighting.
|
|
|
|
|
AtomKind::Comment
|
|
|
|
|
} else if highlights.keyword_ids.contains(&node.id()) {
|
|
|
|
|
AtomKind::Keyword
|
|
|
|
|
|