Skip to content

Show unique paths to disambiguate same file names (Re: #557)#1521

Merged
dzhou121 merged 8 commits intolapce:masterfrom
hbina:disambiguate-files
Oct 15, 2022
Merged

Show unique paths to disambiguate same file names (Re: #557)#1521
dzhou121 merged 8 commits intolapce:masterfrom
hbina:disambiguate-files

Conversation

@hbina
Copy link
Copy Markdown
Contributor

@hbina hbina commented Oct 14, 2022

Based on the work from #557.

  • Added an entry to CHANGELOG.md if this change could be valuable to users

nheuillet and others added 8 commits June 23, 2022 01:42
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Also reimplemented to always find some unique path.

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
}
}

fn get_truncated_path(full_paths: &[PathBuf]) -> Vec<PathBuf> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this PathBuf.parent()?

Copy link
Copy Markdown
Contributor Author

@hbina hbina Oct 15, 2022

Choose a reason for hiding this comment

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

Not quite, you can imagine it as consuming all the given Paths in parallel from left and right one Component of at a time. It stops when it finds a mismatching Components. Just a simple algorithm to find a short unique path to display. I can't find the algorithm that VSCode it using so this is the best I can think of.

path_layout,
Point::new(
rect.x1 + 5.0 + self.text_layout.layout.width() as f64 + 5.0,
path_layout.y_offset(size.height),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not entirely sure this is correct because I think its not really aligned to center. IDK how this layout really works tho.

@dzhou121 dzhou121 merged commit 32fe6b0 into lapce:master Oct 15, 2022
@hbina hbina deleted the disambiguate-files branch October 15, 2022 23:05
@panekj panekj added this to the v0.2.2 milestone Mar 13, 2023
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.

4 participants