Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

feat(rome_formatter): Comments multi map #3230

Merged
merged 3 commits into from
Sep 16, 2022

Commits on Sep 15, 2022

  1. feat(rome-formatter): Comments Map

    This PR implements a multimap for storing the leading, dangling, and trailing comments for nodes.
    
    An implementation using a general-purpose implementation would use a multimaps for the leading, trailing, and dangling comments and
     each multimap would allocate a `Vec` for every node with a comment.
    
     This purpose-built multimap uses a shared `Vec` to store all comments where this is possible (99.99% of comments) and only allocates
     node specific `Vec`s if necessary.
    
    The idea behind the implementation is that comments should maintain the same order as in the source document. That means:
    * All comments for a node are inserted at "the same" time (one at a time, but all together)
    * It first inserts the leading, then dangling, and finally, a node's trailing comments.
    MichaReiser committed Sep 15, 2022
    Configuration menu
    Copy the full SHA
    5fd3664 View commit details
    Browse the repository at this point in the history
  2. Documentation

    MichaReiser committed Sep 15, 2022
    Configuration menu
    Copy the full SHA
    03e2cbe View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9e0972b View commit details
    Browse the repository at this point in the history