Skip to content

Leading space fail#773

Open
gintsgints wants to merge 3 commits into
supabase-community:mainfrom
gintsgints:leading_space_fail
Open

Leading space fail#773
gintsgints wants to merge 3 commits into
supabase-community:mainfrom
gintsgints:leading_space_fail

Conversation

@gintsgints

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

Panic when procedure contains space after semicolon. Bug #769

What is the new behavior?

No Panic :)


pub fn register<'a>(&mut self, node: tree_sitter::Node<'a>, position: usize) {
if SCOPE_BOUNDARIES.contains(&node.kind()) {
// The `program` root node is never registered directly, so the first node

@gintsgints gintsgints Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Might be this comment is too much and should be removed.

@psteinroe

Copy link
Copy Markdown
Collaborator

Thank you! @juleswritescode will take a look soon :)

@juleswritescode

juleswritescode commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator

Hey there! Just took a look at this — do you have a real world scenario where this leads to a bug? I can't reproduce it by typing begin end; | in a test.sql file and trying to get completions or hover results.

The reason I'm asking is that the treesitter context is best understood within the statement-splitter > sanitization > treesitter-context > scope-tracker chain.

e.g. the sanitization will modify the SQL before it's even passed to the context; the context will adjust the cursor-position to prevent out-of-statement issues, and so on.

Fixing it in the ScopeTracker seems like it's too low in the chain; other parts of the parser might still have trouble if there's a bug.

@gintsgints

Copy link
Copy Markdown
Contributor Author

To begin with, I have updated version of treesitter in my project - 0.26. Might be issue. I am investigating.

@gintsgints

gintsgints commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Test in my fork branch without fix fails:

https://github.com/gintsgints/postgres-language-server/tree/func_with_leading_space_fails

Hope it is helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants