DerekStride / tree-sitter-sql

SQL grammar for tree-sitter
http://derek.stride.host/tree-sitter-sql/
MIT License
159 stars 54 forks source link

doesnt parse function parameters #277

Open srghma opened 2 months ago

srghma commented 2 months ago

I use

https://github.com/AstroNvim/AstroNvim/blob/86f153cc426a32f86f8102368b96107c39e69e0c/lua/astronvim/plugins/treesitter.lua#L56C32-L57

and

in file

create function app_private.really_create_user(
  username text,
  email text,
  email_is_verified bool,
  name text,
  avatar_url text,
  password text default null
) returns app_public.users as $$
declare
  v_user app_public.users;
  v_user_secret_id uuid;
  v_user_email_id uuid;
begin

  return v_user;
end;
$$ language plpgsql volatile set search_path from current;

when I on [u]sername and do via

actual - no action

expected - select username text


when I on [u]sername and do vaa

actual - no action

expected - select \n username text,\n

matthias-Q commented 2 months ago

This plugin is (AFAIK) nvim-treesitter-textobjects. This plugin contains the query that matches e.g. parameters.outer. It does not have a query for SQL. This is why the textobject cannot be matched.

nvim-treesitter-textobjects needs to have a textobjects.scm file holding queries that match the AST for SQL files.