Closed dNitro closed 8 years ago
This seems to only adjust the editor-side code. Shouldn't you also be passing ignoreCase
to the Tern query to make it work?
@marijnh , Thats the reason why i request it for ternforvim. vim completion algorithm is capable of cope with case sesitivity in this way. I think passing ignoreCase
shouldn't be needed as i am ok now with this method.
It seems to me like Tern will filter out relevant completions if you don't tell it to match in a case-insensitive way.
@marijnh , Oh, understood what you mean. just now tested a word in middle and doesn't get suggestions. so where we should start? Is it trivial like the editor side or hard to implement? I think its a good option to have.
It's easy, just add an ignoreCase: True
parameter to the JSON query object that's being sent over (line 264, on the current master branch)
@marijnh , cant get it working. could you add it yourself? and still doesn't tell me what is your opinion about this feature. would you consider push it over?
@marijnh , Actually the parameter is caseInsensitive: True
BUT also with this one for example i cant get both Document and document after pressing <C-x><C-o>
in the following position: doc|
at the same time! (just get document)
The server's caseInsensitive
feature seems to work, when I test it. Could it be that the client is doing its own filtering?
@marijnh , Yes, its because of client caching! Currently we call the server on non-alphanumeric characters through ".*\\W"
regex matching. so if we change it to ".*\\w"
it should work and ... yessss. It works :)
Great! Could you update your pull request so that I can merge it?
@marijnh, Here it is. Of course i am not sure about ".*(?:\\w|\\W)"
pattern! \w
and \W
are complementary and probably could be exchange with a much nicer one.
That regexp is definitely dodgy (\w|\W
matches everything), and I'm not sure why you need to adjust that line at all -- it test if a non-word character was typed into the line after the cached completion, and discards the cached completions if that's the case. \W
simply means the inverse of \w
, which matches a word character, and doesn't have anything to do with case.
@marijnh , If we does not discard cached completions on word charachters typed after the cached completion we does not get case insensitivity at all. so first i exchange ".*\\W"
with ".*\\w"
. and then we also does need to discard cached completions if a non-word charachter types. so i came up with aforementioned pattern for ignorecase option on and also wanted to keep the non-ignorecase logic same as before. So i think replacing the ".*(?:\\w|\\W)"
pattern with "."
will do the job. Got you any other suggestion? ( I tested with "."
pattern and its working great)
If we does not discard cached completions on word charachters typed after the cached completion we does not get case insensitivity at all
Why? If the server consistently returns case-insensitive results, I don't see why caching is a problem.
@marijnh, With ".*\\W"
pattern in place thats already present in master branch and requesting with caseInsensitive: True
query:
i -> docu -> <C-x><C-o>
<C-e> -> m -> <C-x><C-o>
so at first we get case insensitivity but if we close popupmenu and type a word charachter we dont get them anymore. so it seems word charachters somehow interrupt server consistency to return case-insensitive results.
now if we change pattern to "."
and requesting with caseInsensitive: True
query:
i -> docu -> <C-x><C-o>
<C-e> -> m -> <C-x><C-o>
The latter is so persistent and on every charachter gives the desired case-insensitive result. I dont know how much impact it has on the work that tern server should do, but it is now i use it for one week and dont counter any degradation on terns work.
(I'm really not going to accept a patch that intentionally sabotages a regexp as a way to disable a block of code.)
Okay, I very much appreciate that you, @marijnh, took the time to review this patch. Anyway tern is a great piece of software, javascript community is owe you. keep up the good work.
CamelCase is not so simple to type. Sometimes fingers don't hold Shift key properly so as soon as you type an uppercase in place of a lower one you missed the tern suggestions becase they are case sensitive. Added case sensitivity as an option so any one have an option to active it or not.