Aren't S-expressions particularly problematic for providing autocomplete hints?
Aren't S-expressions particularly problematic for providing autocomplete hints?
It might be true that s-expressions would make people prefer certain semantic decisions that would be difficult to analyze for autocomplete.
(not that it's important of course, but your remark made me curious, and the reactions to my question even more so)
If you used an s-expression based grammar that still had fields and methods, then you'd get the exact same experience.
foo.bar. <- autocomplete here
vs (foo.bar.)
^ autocomplete here (. (bar foo) ...)
^ cursor is hereIf you've already typed the form and are just changing the head symbol, you're golden:
(.myMeth| my-object)
If Cursive can accurately determine the type of my-object, you'll only see the relevant completions, i.e. methods from that type.If you're using Clojure's threading forms, Cursive understands that:
(-> my-object .myMeth|)
also works.Otherwise, if you're typing out a new form you can do:
(my-object .myMeth|)
and when you auto-complete the forms will be switched around to: (.myMethod my-object |).One correction - this is all done at edit time, not compile time. At compile time there's no issue since all macros are expanded to the core language.
It's just like how SQL decided to write all their queries backwards making it impossible to do good autocomplete.