Closed gavinking closed 9 years ago
@gavinking could you check this is not a problem in the IDE when the query returns no results?
Because I just tested the search code and doing an exact search for a member ceylon.math.float.random
returns nothing. But that is "normal" because the real name for that member is ceylon.math.$float.random_
.
I was just about to say that you would have to call Naming.quoteIfJavaKeyword()
because the CMR does not have access to that code it being in the compiler. But I see it was recently moved to ceylon.common
so the CMR actually can do the quoting itself now.
So the fact that it doesn't return a result I can fix, but in none of my tests did it actually return "java.auth". So could you see if it really returns that and if so what value pkg
was in the above code when it did?
I can confirm that that is what it returns. I already debugged this.
This is nothing to do with random, since we are searching for a -package- not a declaration. Look again at the code example I gave above.
Sent from my iPhone
On 1 Mar 2015, at 1:28 pm, Tako Schotanus notifications@github.com wrote:
@gavinking could you check this is not a problem in the IDE when the query returns no results? Because I just tested the search code and doing an exact search for a member ceylon.math.float.random returns nothing. But that is "normal" because the real name for that member is ceylon.math$float.random_.
I was just about to say that you would have to call Naming.quoteIfJavaKeyword() because the CMR does not have access to that code it being in the compiler. But I see it was recently moved to ceylon.common so the CMR actually can do the quoting itself now.
So the fact that it doesn't return a result I can fix, but in none of my tests did it actually return "java.auth". So could you see if it really returns that and if so what value pkg was in the above code when it did?
— Reply to this email directly or view it on GitHub.
The same holds true for searching for random
or not, the fact is the names have to be escaped somewhere otherwise it won't find it, I'll fix that in the CMR.
And I found what the issue is of java.auth
appearing. It's because the IDE uses an extra repository, the JDKRepository
, which is used for doing completion for JDK modules. Thing is it doesn't implement any package or member searches at all. So it just adds all of them.
But because it's the last one in the list and you set the result to a max of 1 you normally didn't notice.
PS: after I fix these two issues you should remove the query.setCount(1l)
because there could be more than one module with the given package.
@quintesse OK, thanks.
This should now work @gavinking , don't forget to remove that query.setCount(1l)
line!
Excellent, thanks!
Reopening this because the way this was fixed was not good enough.
Problem is of course that you can't pre-quote the search query and expect it to always match.
For example searching for ceylon.math.float
will correctly match ceylon.math.$float
, but searching for ceylon.math.fl*
won't because the fl
won't be quoted.
And it's not the only type of quoting we need to think about, there's ending _
as well.
So probably a better way is to match unquoted strings.
Ok, this should now really be fixed. But for remote searches it depends on ceylon/ceylon-herd#218 and ceylon/ceylon-herd#219 being applied to the Herd server.
Originally reported here.
I use the code:
This has been reported before, and I had understood it to be already fixed, but apparently not!
@quintesse would you take a look please.