Skip to content

Pre-release cleanup: signature/type-comment fixes, respect syntax off and Tree-sitter, opt-in palette, accurate docs - #5

Merged
aaronbcarlisle merged 3 commits into
mainfrom
claude/determined-sagan-2hjq47
Sep 26, 2026
Merged

aaronbcarlisle merged 3 commits into
mainfrom
claude/determined-sagan-2hjq47

Conversation

@aaronbcarlisle

@aaronbcarlisle aaronbcarlisle commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Fixes bugs and inaccurate docs found in a pre-announcement audit, makes the color palette opt-in, and trims boilerplate. Each bug fix has a new assertion that fails on main and passes here.

Changes

Syntax / plugin

  • A call, dict or list in a parameter default (x=f(1, 2), x={"k": v}) ended the parameter list at its ), or started an annotation at its :. Later parameters and the return type lost their type highlighting. Brackets in defaults now go through pythonBracketBlock.
  • key=lambda x: x.name in a default: lambda was uncolored and x.name was colored as a type. The lambda is now its own region.
  • # type: int: the word type was colored as a type; # type: ignore[...] colored ignore as a type. Both are now plain comment text.
  • The plugin no longer loads on FileType when 'syntax' isn't python. Before, it turned highlighting back on after :syntax off, and in Neovim it stacked regex syntax on top of Tree-sitter. Verified with Neovim 0.12.5 and a real tree-sitter-python parser.
  • The palette is opt-in (g:python_enhanced_colors now defaults to 0). By default every group only links to a standard group, so the colorscheme decides the colors.
  • g:python_enhanced_highlight_all no longer overwrites the individual g:python_highlight_* variables. :PythonSyntaxInfo now reports the same values the syntax file uses.
  • Removed pythonSelfRef: it duplicated the pythonClassVar keywords and never matched. Also removed links for groups that were never defined.
  • Operators are matched with a character class instead of a 30-way alternation. Visuals are identical, and it's much cheaper in :syntime.

Docs and repo

  • README/help: describe what the built-in syntax actually does (it doesn't "break" on ->); drop "IDE-level"; accurate color table; one verified example instead of eight basic blocks; fix the help's manual install; add Limitations; changelog entries.
  • AUTHORS and the syntax header say the file is based on Vim's python.vim; dropped "ABC-Terminal".
  • Removed ftplugin/python.vim (no-op), the PR-labeling workflow and the issue-template config; shortened the PR template.

Checklist

  • Syntax or plugin changes have assertions in tests/test_syntax.vim or tests/test_loading.vim that fail without the change
  • sh tests/run.sh passes (68 + 7 assertions, Vim 9.1 and Neovim 0.12.5)
  • User-visible changes are in the README, doc/python-syntax-enhanced.txt and its changelog

- A bracketed default (x=f(1, 2), x={"k": v}, x=[...]) no longer ends
  the parameter list or starts an annotation; later parameters and the
  return type keep their type highlighting
- lambda in a default is highlighted as a keyword and its body is not
  treated as an annotation
- In "# type: T" only T is highlighted as a type; "# type: ignore[...]"
  stays a comment
- Do not load on FileType when 'syntax' is not "python" (:syntax off,
  :syntax manual, or Neovim's Tree-sitter highlighter cleared it)
- Remove pythonSelfRef, which duplicated the pythonClassVar keywords and
  never matched, and links for groups that were never defined
- Match operators one character at a time instead of a 30-way alternation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHGQAYx5m3Fs5HUYPdtUWt
- Describe what the built-in syntax actually does with annotations
  instead of saying -> "breaks" it, and drop "IDE-level" wording
- Color table: self/cls use pythonClassVar (colorscheme Identifier);
  say which groups the palette sets and how to turn it off
- Options are read when a buffer's syntax loads, not only before
  :syntax on
- Neovim: the plugin does not load when Tree-sitter highlights Python
- Help: fix the manual install (plugged/ is not on 'runtimepath'),
  broken |pythonBuiltin| link and title underline; add Limitations
- Remove ftplugin/python.vim: it only set and unset its own flag

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHGQAYx5m3Fs5HUYPdtUWt
@github-actions github-actions Bot added bug Something isn't working ci/cd documentation Improvements or additions to documentation plugin syntax testing labels Sep 26, 2026
- g:python_enhanced_colors now defaults to 0: groups keep their standard
  links so the colorscheme decides; the palette is one line to enable
- g:python_enhanced_highlight_all no longer overwrites the individual
  g:python_highlight_* variables; :PythonSyntaxInfo reports the same
  values the syntax file uses
- Remove the PR labeling workflow and the issue-template config, and
  shorten the PR template
- AUTHORS lists the maintainer and the Vim syntax file this is based on;
  the syntax file header says so too; drop "ABC-Terminal"
- README: one verified example of what counts as a type instead of eight
  basic code blocks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NHGQAYx5m3Fs5HUYPdtUWt
@aaronbcarlisle aaronbcarlisle changed the title fix: parameter defaults, type comments, loading under syntax off / Tree-sitter; accurate docs Pre-release cleanup: signature/type-comment fixes, respect syntax off and Tree-sitter, opt-in palette, accurate docs Sep 26, 2026
@aaronbcarlisle
aaronbcarlisle marked this pull request as ready for review September 26, 2026 09:58
Copilot AI lite review requested due to automatic review settings September 26, 2026 09:58
@aaronbcarlisle
aaronbcarlisle merged commit 84745ed into main Sep 26, 2026
5 checks passed
@aaronbcarlisle
aaronbcarlisle deleted the claude/determined-sagan-2hjq47 branch September 26, 2026 09:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🔵 Needs a closer look

Unresolved issues remain with syntax reloading after syntax off and removal of the private security-report path.

Review effort: Lite
Findings: None

What changed in this PR

Pre-release cleanup for the Python syntax plugin, including highlighting fixes, safer loading behavior, opt-in colors, documentation updates, and repository cleanup.

Changes:

  • Fixes highlighting for defaults, lambdas, type comments, and operators.
  • Respects disabled syntax and Tree-sitter buffers; makes palette styling opt-in.
  • Updates tests, documentation, attribution, and repository files.
File Summary
tests/​test_syntax.vim Adds syntax regression assertions.
tests/​test_loading.vim Tests loading safeguards and configuration.
tests/​test_highlighting.py Updates highlighting fixture documentation.
syntax/​python.vim Improves Python syntax and highlighting behavior.
README.md Updates usage, colors, limitations, and installation guidance.
plugin/​python-syntax-enhanced.vim Adjusts loading, palette, and status behavior.
ftplugin/​python.vim Removes the no-op ftplugin.
doc/​python-syntax-enhanced.txt Updates help documentation and changelog.
AUTHORS Refreshes attribution.
.github/​workflows/​pr-automation.yml Removes PR automation workflow.
.github/​pull_request_template.md Simplifies the PR template.
.github/​ISSUE_TEMPLATE/​config.yml Removes issue configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

bug Something isn't working ci/cd documentation Improvements or additions to documentation plugin syntax testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants