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

Infer the class of string and coll literals #107

Conversation

vemv
Copy link
Contributor

@vemv vemv commented Sep 16, 2023

Fixes #106

Hopefully the inclusion of colls won't be a nuisance - as you can see, luckily it turned out to be a minimal addition.

Most pragmatically, it would be used in clojure-emacs/cider-nrepl#812 for instance.

Cheers - V

@vemv vemv changed the title Infer the class string and coll literals Infer the class of string and coll literals Sep 16, 2023
Copy link
Owner

@alexander-yakushev alexander-yakushev left a comment

Choose a reason for hiding this comment

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

Cool! Sure, it's no problem since the addition is minimal.

which indicates that the members are an exact match against the class of `[]`"
(let [c (count (src/members-candidates "." (-ns) (ctx/cache-context
"(__prefix__ [])")))]
(< 17 c 21))

Choose a reason for hiding this comment

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

I propose testing for something exact. Let's say, check that when completing .in, only .indexOf is suggested when context is present, and more than one candidate are suggested without context.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I finally did a bit of both, LMK what you think

expected (if (and (= 1 major)
(< minor 12))
18
19)]

Choose a reason for hiding this comment

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

Sorry, you are overdoing it. Your changes to Compliment don't depend on the exact public methods of PersistentVector or other classes, they transcend the exact versions of Clojure and Java. Just make a minimal test that proves that context performs the filtering, and that's it. There are plenty of tests like that already, take any as an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, I believe!

@alexander-yakushev
Copy link
Owner

Perfection.

@alexander-yakushev alexander-yakushev merged commit 812ca78 into alexander-yakushev:master Sep 17, 2023
@vemv vemv deleted the 106--string-literals branch September 17, 2023 19:05
@vemv
Copy link
Contributor Author

vemv commented Sep 17, 2023

Cheers. A release would make it into cider/cider-nrepl which are scheduled for a shiny big release next week.

I've already tested this feature locally during yesterday.

@alexander-yakushev
Copy link
Owner

Pushed 0.4.2 🍺.

@vemv
Copy link
Contributor Author

vemv commented Sep 17, 2023

🍻! It's on its way now.

Btw, I'll be excited to work on clojure-emacs/cider-nrepl#812 someday soon - I find it fairly important for making our other Java-related work shine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String literals aren't inferred as strings
2 participants