Closed machitgarha closed 3 years ago
Hello.
Do you have minimumWordLength
in the autocomplete-plus
settings set to a non-zero value?
Yes, it's 3, the default one.
Do the words your typing happen to be less than three characters when this doesn't work :smile: ? IIUC, this setting causes nothing to be autocompleted unless you've typed at least three characters. If this is indeed causing the problem, you can try setting it to 0
and see if that has any effect.
No. Sorry. Neither typing more than minimumWordLength
help anything nor decreasing its value.
However, when I set it to 0
, it works, but strange and somehow wrong (e.g. especially for class methods and variables). Furthermore, pressing enter for inclusion of the suggestion inserts it after what I typed, not replacing it. For example, when I type replace
and I press enter when the autocomplete is active on str_replace()
, then the result will be replacestr_replace()
, not as expected.
BTW, I don't want minimumWordLength
to be 0
.
Okay, I think I may be able to clear up some confusion: autocompletion triggers on characters such as $
, ::
and ->
because these are so-called "trigger characters", meaning Atom will always try to show suggestions when these are typed.
If you type something after them, you fall back to "standard" autocompletion, which also happens when you start typing on a new line. If you have minimumWordLength
set to 3
, this means (IIUC), that Atom will not try to do any additional autocompletion anymore when you type b
or be
, because you have fewer than 3
characters (Atom stops counting at word boundaries).
In short, this probably happens:
self::
.::
is a trigger character.Ctrl+Space
.g
, turning the code into self::g
.minimumWordLength
is 3
, which is larger than 1
, so Atom shrugs and gives up.I would expect this to start working when you typed 3 or more characters, then, though :smile:.
@Gert-dev For clarification, I've updated the issue and added more precise details on the problem (in the Example section).
Hmm, I understand. This does somehow appear to be linked to that minimumWordCount
option. If I set it to 0
here, everything works, if I set it to the default (3
), I get even different results from you and never get autocompletion unless I press ctrl-space
.
The strange thing is that, on exactly the third character, even the snippets disappear. As if Atom knows there should now be other suggestions, but none are shown. If I press ctrl-space
, they suddenly pop up.
I'm wondering if this is related to this fix I did. Could you perhaps try commenting it out to see if that fixes anything?
(I can say for sure that it's not a server problem, since in other clients and the server output the appropriate suggestions appear to be returned.)
@Gert-dev Oh! Good to hear it does not only happen for me. And about the fix, what should I do to get the fix? Only updating to the latest version or not?
Commenting out that line in ~/.atom/packages/php-ide-serenata/lib/SerenataClient.js
fixed it for me, with the autocomplete-plus
still on the minimumWordCount
default of 3. It also fixed issue #489 for me, so the suggestion is no longer appended to what I already typed. It does bring back issue #487, so I will have @@inheritDoc
, but that is still better than @inhe@inheritDoc
.
@rhuijts Thanks for your help.
@Gert-dev Yes, commenting the mentioned line as a temporary fix worked for me too. However, I'm waiting for a permanent fix (maybe removing that line causes other issues?).
Hello.
Nice to hear you found a workaround.
Indeed, I could remove the line, but it will break sorting and filtering the list, as indicated by the comment above it. Atom seems to insist on doing its own reordering and filtering client-side, whilst the autocompletion results by Serenata are already filtered and sorted server-side. This causes less relevant results to be shown or the sorting to be different than intended by the server. The only fix I've found for that so far is this line, but it seems like an upstream bug.
Seeing as removing this line fixes it, I'll update the title of this ticket to reflect that and leave it open so it's not forgotten in the future.
Commenting out that line in ~/.atom/packages/php-ide-serenata/lib/SerenataClient.js
also fixed this for me. Thanks!
is this bug still exists with current 5.4.0?
@yanggs07 Still exists. As @Gert-dev has said, it seems to be an upstream bug.
@yanggs07 Still exists. As @Gert-dev has said, it seems to be an upstream bug.
emmmm so i still use v4.5.3 with osx 10.15.2, atom
This may be fixed in atom-languageclient v1.0.0 if it is not please open an issue on the new repo https://github.com/atom-ide-community/atom-languageclient
@Gert-dev Could you please release a new version (probably 5.4.1) for this change? Maybe it's late, but I think it was an effective and impactful change.
Done - in the spirit of leaving the package in a somewhat stable state (due to #522).
@Gert-dev Great! Thanks. And yes, the package is in a really good shape (and sorry, I'm personally interested in, but unable to being a maintainer).
For $this->myA
is successfully autocompleted to $this->myAwesomeMethod()
. ✅
But for local variables, it still adds an extra $
as prefix. $thi -> $$this
. 🐛
Seems like $
character is not taken in count as prefix, only 'thi'
instead of $thi
.
@nelson6e65, as you might already know, that's a separated issue being tracked in #487.
Oh, sorry. I didn't remember it. 😅
Hi. First of all, thanks for this cool package in Atom. Everything works fine, except the auto-completion.
Desciption
When I type characters like
$
,::
or->
, the suggestions will be shown in a great way, but when I enter another character to limit the suggestions, all Serenata suggestions will be disappeared (yes, the default snippets are shown). However, all of expected suggestions will be re-shown when I enter Ctrl+Space.Example
To be clarified, in the following example,
minimumWordLength
equals3
(in the settings ofautocomplete-plus
package):$this->
$this->d
d
, likedebug
anddo
$this->de
de
, likedebug
anddef
$this->de
+ Ctrl+Spacede
$this->deb
deb
, likedebug
deb
$this->deb
+ Ctrl+Spacedeb
Steps to Reproduce
Do steps in Example section above.
Platform Information
ide-php
and the like installed.autocomplete-plus
:minimumWordLength
:3
What should I do now?