Closed ghost closed 8 years ago
feel free to make pull request, I'm not able to repair this now.
I think changing "syn region pgsqlString start=+\$\z(\w*)\$+ end=+\$\z1\$+" to:
syn match pgsqlString "\$\w*\$"
seems to solve this problem. Not knowing vimscript or syntax highlighting well enough, i am not certain that it does not cause other issues.
@Phone911, if I understand your change correctly, then all dollar-sign-quoted strings would only have their quotes highlighted. That feels a bit like throwing the baby out with the bathwater. It might be possible to only highlight strings that way if they're in the AS
position of a CREATE FUNCTION
statement.
We could create a new region like:
syn region pgsqlFunctionBody start=+[aA][sS]\s*\$\z(\w*\)\$+ end=+\$\z1\$+
But I'm not sure yet where to go from there. If I come up with anything, I'll make a pull request.
After some playing around, I don't think my suggestion is very feasible. It seems like @Phone911's suggestion is the right solution.
I have postgresql functions, which are defined as standard
CREATE OR REPLACE FUNCTION substract_lunch() RETURNS TRIGGER AS $no_lunch$ DECLARE o_lunch interval; BEGIN SELECT object_lunch INTO o_lunch FROM attendance_control WHERE attendance_ct_id = NEW.object_id;
NEW.offsite := NEW.offsite - o_lunch;
RETURN NEW; END;--Trigger $no_lunch$ LANGUAGE plpgsql;
What the dollar quoting does, is rendering the whole body as string, with no highlighting.
Vim - 7.4.135 pgsql.vim - 424cd518e6e250c3cfcd6f1c534832f8da07c098
If I remove or comment out the line (line 57 in syntax/pgsql.vim) syn region pgsqlString start=+\$\z(\w*)\$+ end=+\$\z1\$+ I get the highlighting back. I have a feeling the regexp is too greedy, but I cannot read vim's regexp yet.