Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework comments support for pretty-printing #266

Draft
wants to merge 7 commits into
base: 2.1.x
Choose a base branch
from
Draft

Conversation

ondrejmirtes
Copy link
Member

The current implementation (#264) has some drawbacks:

  • Printing with preserving format is pretty broken. For example, it does not notice when a comment is removed from a node.
  • The comment indexes are wrong, they are often out of bounds of the associated node. For example startIndex of node is 5, but its comment can start earlier, which causes problems in Printer
  • Comments are often associated with a weird node, for example:
array{
	// a is for apple
	a: int,
}

Associates the comment with the item keyName, not item itself.

This PR tries to fix it but absence of these fixes doesn't prevent us from releasing phpdoc-parser 2.1.0.

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.

1 participant