Skip to content

Highlight function definitions from sf commands - #1661

Open
Muneer320 wants to merge 1 commit into
dbcli:mainfrom
Muneer320:feat/function-definition-highlighting
Open

Muneer320 wants to merge 1 commit into
dbcli:mainfrom
Muneer320:feat/function-definition-highlighting

Conversation

@Muneer320

Copy link
Copy Markdown

Description

Highlight the function source returned by \sf and \sf+ using the configured syntax theme. Pass the command context to the output formatter and color the source before laying out psql, plain or expanded output. CSV, TSV, JSONL and markup output retain their existing behavior.

Closes #1488. This uses the existing Pygments dependency and the source returned by pgspecial; no server-side or pgspecial change is required.

Validation: 20 focused tests and Ruff check/format pass locally. The hosted Linux/PostgreSQL run passes the complete main test module, real \sf/\sf+ commands, redirected output, output files, repository hooks and changelog validation. The command regression fails on the original source because sf output has no SQL token colors.

Stripping colors preserves the previous output, including LF, CRLF and carriage returns in expanded output and automatic expansion. Other display formats keep their existing formatting.

Checklist

  • I've added this contribution to the changelog.rst.
  • I've added my name to the AUTHORS file (or it's already there).
  • I installed pre-commit hooks (pip install pre-commit && pre-commit install).
  • I verified that my changes work as expected.
  • Please squash merge this pull request.

@Muneer320

Copy link
Copy Markdown
Author

The automated review stopped before reviewing the patch because the triggering account needs repository write access. Could a maintainer trigger the label-based review and approve the queued CI? The completed PostgreSQL verification is linked in the PR description.

This branch has not been deployed

No deployments
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.

Function syntax highlighting \sf

1 participant