1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use std::{
fs, io,
ops::Range,
path::{Path, PathBuf},
};
use ropey::Rope;
use tree_sitter::Tree;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum Language {
Rust,
TypeScript,
Python,
Toml,
Markdown,
Plain,
}
impl Language {
pub fn detect(path: impl AsRef<Path>) -> Self {
match path
.as_ref()
.extension()