fix: restrict visibility of modules

This commit is contained in:
Luc Georges 2023-10-11 20:45:25 +02:00
parent 777184a373
commit 4d0825594b
No known key found for this signature in database
GPG key ID: 8A2B84C1466CDF50
2 changed files with 7 additions and 7 deletions

View file

@ -165,16 +165,16 @@ fn get_parser(language_id: LanguageId) -> Result<Parser> {
}
}
pub struct Document {
pub(crate) struct Document {
#[allow(dead_code)]
language_id: LanguageId,
pub text: Rope,
pub(crate) text: Rope,
parser: Parser,
pub tree: Option<Tree>,
pub(crate) tree: Option<Tree>,
}
impl Document {
pub async fn open(language_id: &str, text: &str) -> Result<Self> {
pub(crate) async fn open(language_id: &str, text: &str) -> Result<Self> {
let language_id = language_id.into();
let rope = Rope::from_str(text);
let mut parser = get_parser(language_id)?;
@ -187,7 +187,7 @@ impl Document {
})
}
pub async fn change(&mut self, text: &str) -> Result<()> {
pub(crate) async fn change(&mut self, text: &str) -> Result<()> {
let rope = Rope::from_str(text);
self.tree = self.parser.parse(text, None);
self.text = rope;

View file

@ -1,7 +1,7 @@
use std::fmt;
#[derive(Clone, Copy)]
pub enum LanguageId {
pub(crate) enum LanguageId {
Bash,
C,
Cpp,
@ -59,7 +59,7 @@ impl fmt::Display for LanguageId {
}
}
pub struct LanguageIdError {
pub(crate) struct LanguageIdError {
language_id: String,
}