brandon1024 / cortado.vim

Import Java classes by name, find unused import statemens, and many other goodies!
MIT License
2 stars 0 forks source link

represent imports as dictionary trees #7

Closed brandon1024 closed 2 years ago

brandon1024 commented 2 years ago

Rather than represent import statements as flat lists, which are difficult and inefficient to work with, construct an import tree and flatten it before sorting and writing to the buffer.

Trees are a much smarter way to represent imports. With trees, we no longer need to filter duplicate imports because dictionary keys are inherently unique. It also allows for a bit more flexibility and features down the road.

One such feature is the ability to control how import statements are merged into single wildcard import statements. A new configuration option was introduced to allow the user to configure how to handle wildcards. By default, leaf nodes are only merged into a wildcard if a wildcard import statement already exists at that node level.

A few minor bugs were fixed.

Fixes #2