tsl-devkit/lsp-server/src/language/ast/tree_sitter_utils.hpp

24 lines
467 B
C++

#pragma once
#include <string>
#include "./types.hpp"
extern "C" {
#include <tree_sitter/api.h>
}
namespace lsp::language::ast::ts
{
std::string Text(TSNode node, std::string_view source);
Location NodeLocation(TSNode node);
inline bool IsComment(TSNode node)
{
std::string_view type = ts_node_type(node);
return type == "line_comment" ||
type == "block_comment" ||
type == "nested_comment";
}
}