Skip to content

Commit f8633b4

Browse files
tests pass
1 parent 6d8156a commit f8633b4

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

crates/pgt_completions/src/complete.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ pub fn complete(params: CompletionParams) -> Vec<CompletionItem> {
3535
tree: &sanitized_params.tree,
3636
});
3737

38-
println!("{:#?}", ctx);
39-
4038
let mut builder = CompletionBuilder::new(&ctx);
4139

4240
complete_tables(&ctx, sanitized_params.schema, &mut builder);

crates/pgt_treesitter/src/context/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,12 @@ impl<'a> TreesitterContext<'a> {
432432
.nth(self.position)
433433
.is_some_and(|c| !c.is_ascii_whitespace() && !&[';', ')'].contains(&c))
434434
{
435-
self.position = cmp::min(self.position + 1, self.text.len());
435+
self.position = cmp::min(self.position, self.text.len().saturating_sub(1));
436436
} else {
437-
self.position = cmp::min(self.position, self.text.len());
437+
self.position = cmp::min(
438+
self.position.saturating_sub(1),
439+
self.text.len().saturating_sub(1),
440+
);
438441
}
439442

440443
cursor.goto_first_child_for_byte(self.position);

0 commit comments

Comments
 (0)