Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
hatoo committed Jan 30, 2024
1 parent ff1f692 commit 5262f2b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn desugar(src: &str) -> anyhow::Result<String> {
let output = child.wait_with_output()?;

if !output.status.success() {
anyhow::bail!("child proccess fail");
anyhow::bail!("child process fail");
}
Ok(String::from_utf8(output.stdout)?)
}
Expand All @@ -83,7 +83,7 @@ impl Backend {
async fn on_change(&self, params: TextDocumentItem) {
// TODO: Support incremental update
let src_tree = SrcTree::new(params.text);
let diagnostics = src_tree.diagnstics();
let diagnostics = src_tree.diagnostics();

self.document_map.insert(params.uri.clone(), src_tree);
self.client
Expand Down Expand Up @@ -295,7 +295,7 @@ impl LanguageServer for Backend {
.highlight(&language_config, src_tree.src().as_bytes(), None, |_| None)
.map_err(|_| Error::internal_error())?;

let mut current_hightlight: Option<Highlight> = None;
let mut current_highlight: Option<Highlight> = None;
let mut pre_line = 0;
let mut pre_start = 0;
let semantic_tokens = highlights
Expand All @@ -314,7 +314,7 @@ impl LanguageServer for Backend {
} else {
start
};
if let Some(t) = current_hightlight {
if let Some(t) = current_highlight {
let ret = Some(SemanticToken {
delta_line,
delta_start,
Expand All @@ -330,11 +330,11 @@ impl LanguageServer for Backend {
}
}
HighlightEvent::HighlightStart(highlight) => {
current_hightlight = Some(highlight);
current_highlight = Some(highlight);
None
}
HighlightEvent::HighlightEnd => {
current_hightlight = None;
current_highlight = None;
None
}
})
Expand Down Expand Up @@ -410,14 +410,14 @@ impl LanguageServer for Backend {

let root = src_tree.tree().root_node();

let posisiton = tree_sitter::Point {
let position = tree_sitter::Point {
row: pos.position.line as _,
column: pos.position.character as _,
};

let node = root
.descendant_for_point_range(posisiton, posisiton)
.ok_or_else(|| Error::invalid_params("Postion out of range"))?;
.descendant_for_point_range(position, position)
.ok_or_else(|| Error::invalid_params("Position out of range"))?;

let mut markdown = String::new();

Expand Down
4 changes: 2 additions & 2 deletions src/src_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl SrcTree {
buf
}

pub fn diagnstics(&self) -> Vec<Diagnostic> {
pub fn diagnostics(&self) -> Vec<Diagnostic> {
let src = &self.src;
let tree = &self.tree;
let root_node = tree.root_node();
Expand Down Expand Up @@ -595,7 +595,7 @@ fn test_diagnostic() {
fn has_error(src: String) -> bool {
let src_tree = SrcTree::new(src);

!src_tree.diagnstics().is_empty()
!src_tree.diagnostics().is_empty()
}

assert!(has_error("(sort)".to_string()));
Expand Down

0 comments on commit 5262f2b

Please sign in to comment.