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

Autocomplete for php code works incorrectly in some cases #8

Closed
sigsergv opened this issue Feb 8, 2013 · 5 comments
Closed

Autocomplete for php code works incorrectly in some cases #8

sigsergv opened this issue Feb 8, 2013 · 5 comments

Comments

@sigsergv
Copy link

sigsergv commented Feb 8, 2013

To reproduce you must change settings parameter word_separators and remove character $ there, like this (in Preferences.sublime-settings):

"word_separators": "./\\()\"'-:,.;<>~!@%^&*|+=[]{}`~?",

After that create new file with the following content:

<?php

$test = 'aaaaa'

and try to auto-complete word $test there, you should fail, word just disappears.

It looks like somethere inside sublimetext character $ treated as something special (incorrect regexp generation maybe) so if returned value from on_query_completions starts with $ it will break the completion.

@alienhard
Copy link
Owner

Your pull request #9 doesn't seem to fix the problem. Did that do anything in your case?

The API call to extract_completions() returns no matches if the first character of the prefix string is a $. I also tested with a colon and it is the same problem. I tried to re.escape() the prefix but that didn't help.

I suspect that Sublime doesn't respect word_separators when tokenizing the content to match it against prefix in extract_completions(). Hence there's never a match. I'm only speculating but we can't check since we don't have access to the source. There's probably nothing we can do, except for reporting the problem.

@sigsergv
Copy link
Author

Did you remove character $ from separators list (word_separators config option)? It's important.The code from pull request #9 has solved “disappearing” issue for me.

@alienhard
Copy link
Owner

Yes, I removed $. The behavior I see is that when I start typing $te there is no completion. I.e., the autocomplete dialog disappears because the are no matches. Is this the "disappearing issue" or do you experience something different? I'd like to understand and be able to reproduce the problem before adding an extra case.

@sigsergv
Copy link
Author

sigsergv commented Mar 5, 2013

OK, let's try another example:

  1. Close all editor windows and open a new empty one
  2. In that window create new file and put the following text there:
<?php
$token = 444;

don't save

  1. Now enter text $to on line below $token = 444; and press completion key

In my case complete text including $to just disappears as it's just deleted.

@alienhard
Copy link
Owner

I still can't reproduce. Removed $ from word_separators, then did what you said above. When I start typing $to I don't get an autocompleter dialog.

Does anyone else have this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants