typst icon indicating copy to clipboard operation
typst copied to clipboard

Dedpulicate labels for code completion

Open Daaiid opened this issue 6 months ago • 1 comments

Closes #6296.

For the purpose of code completion we don't want to list duplicate labels.

Duplicates can still happen if a label exists in the document and in the bibliography. I consider this acceptable and might actually give users an important hint that they have duplicate labels.

Daaiid avatar Jun 27 '25 16:06 Daaiid

Thanks for the PR! Could you add a test for this in autocomplete.rs?

laurmaedje avatar Jun 27 '25 16:06 laurmaedje

Might wanna fix the typo in the title so this can be found through search later

Enivex avatar Jun 30 '25 14:06 Enivex

I saw that there was a general lack of tests for references in complete.rs so I decided to add some. During that I found a small regression due to my previous PR (#6332) where autocompletion would not show labels right after an @. I fixed the regression in here since it was just a few more lines and I understood the problem well.

Daaiid avatar Jul 07 '25 10:07 Daaiid

Could you extract the regression fix into a separate PR? For the tests, it could also be good to try and extract a common function as there is some duplicate in the setup code there.

laurmaedje avatar Jul 09 '25 12:07 laurmaedje

Alright, I'm putting the regression fixes into a separate PR. Any consolidation of the test code will also happen in the follow up PR.

Daaiid avatar Jul 10 '25 13:07 Daaiid

Thank you!

laurmaedje avatar Jul 10 '25 13:07 laurmaedje