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

completion of non static members does not work unless the class is imported to the name space #58

Closed
behrica opened this issue Nov 23, 2018 · 4 comments · Fixed by #102

Comments

@behrica
Copy link

behrica commented Nov 23, 2018

In this scenario, we get no candidates,

  • start new repl
(use 'compliment.sources.class-members)
(def blob (javax.sql.rowset.serial.SerialBlob. (byte-array 1)))
(map :candidate (members-candidates "." (find-ns 'user) (ctx/parse-context '(__prefix__ blob)) ))

()

so no candidates are found.
expected behavior: all and only members of class SerialBlob are returned
found behavior: no members are returned

It does work, when class is imported first:

(require '[compliment.context :as ctx])
 (use 'compliment.sources.class-members)
 (import javax.sql.rowset.serial.SerialBlob)
(def blob (SerialBlob. (byte-array 1)))
(map :candidate (members-candidates "." (find-ns 'user) (ctx/parse-context '(__prefix__ blob)) ))


(".getBinaryStream" ".setBytes" ".free" ".setBinaryStream" ".getBytes" ".position" ".length" ".truncate" ".clone" ".hashCode" ".equals")

@behrica
Copy link
Author

behrica commented Nov 23, 2018

Maybe on more comment, why I don't use the "import" in the first place ...

I discovered the issue by using the library
https://github.com/vvvvalvalval/scope-capture

A debugging tool which allows to "inject" reflectively captured local vars as global vars in the current name space (or any other name space)

So it creates the vars reflectively without me instantiating the java objects myself (so I neither used "import" nor the full qualified class name directly, but scope-capture does the instantiation via reflection)

So a kind of special case, but would be nice to get it work to avoid surprises of users.

@alexander-yakushev
Copy link
Owner

@behrica The class no longer needs to be imported for completion to work if the class can be resolved from the context. The docstring will not work though, as that's a separate thing in CIDER now.

Would you be so kind to test this out with the latest CIDER snapshot?

@vemv
Copy link
Contributor

vemv commented Nov 16, 2021

Hi there!

Today @cjohansen was expressing the same issue over Clojurians #cider.

I wonder if there's a unit test for instance method access such as (.| (java.time.LocalDate/now))? Tried searching it, no luck.

@cjohansen
Copy link

I can confirm that completions from the pipe in (.| (java.time.LocalDate/now)) does not find members on LocalDate if the class has not been imported, even when the REPL can evaluate (java.time.LocalDate/now).

vemv added a commit to reducecombine/compliment that referenced this issue Jul 15, 2023
It's already passing, so no action is needed.

Closes alexander-yakushev#58
vemv added a commit to reducecombine/compliment that referenced this issue Jul 15, 2023
It's already passing, so no action is needed.

Closes alexander-yakushev#58
alexander-yakushev pushed a commit that referenced this issue Jul 15, 2023
* Add a test case for #58

It's already passing, so no action is needed.

Closes #58
alexander-yakushev added a commit that referenced this issue Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants