-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Custom identifierRegexps is not working #2532
Comments
I was able to reproduce your issue. For some reason the custom regexp doesn't work at all. I am researching a solution right now. |
Thanks. Let me know if you find a solution. |
Ok. I figured out what was the problem. Some programmers were definitely drunk. Here's the solution to the problem: I was using the 'built' version. You need to change the
These are apparently wrong, as they are both not using the correct prefix which can be generated with
I may actually rewrite this part of the library to add a 'trigger' symbol which won't be included as part of the term. |
I'm glad you figured it out. Do you have a branch to test your changes? Even better, you might want to create a pull request to see if this gets merged. |
No.. I simply updated code on my local copy and it's working perfectly now. I think it's not a quite elegant fix as I made a duplicate function. I am still not very familiar with the overall structure of ACE, but I am curious why the getCompletionPrefix function was a local function which can't be referred by other pieces of ACE easily. How to create a pull request? |
There are a lot of good answers here. |
- Add util.getCompletionPrefix and use it instead of util.retrievePrecedingIdentifier in gatherCompletions and doLiveAutocomplete functions as suggested at ajaxorg#2532
Fix custom identifierRegexps (issue #2532)
- Add util.getCompletionPrefix and use it instead of util.retrievePrecedingIdentifier in gatherCompletions and doLiveAutocomplete functions as suggested at ajaxorg#2532
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
This seems to be a recurrent issue, but maybe someone can give a bit of help figuring this out.
The idea is to be able to provide a custom
identifierRegex
in order to change the regex that is used in retrievePrecedingIdentifier.This should be possible giving an
identifierRegexps
to the completers so that this line takes effect:However, I haven't been able to do that using the following (naive) approach:
You can see the code in this plnkr. I simply added a dot in the regex but it looks like the previous prefix is being used as a conditional to run the line
prefix = util.retrievePrecedingIdentifier(line, pos.column, identifierRegex);
. Therefore, hitting Ctrl+space after a dot (e.g. will.) doesn't produce the correct result because there is no prefix under the previous rule. Unfortunately, even after including additional characters (such as will.a), the prefix is set asa
and that line doesn't run again. Please, let me know if there is a fix. Hopefully, I'm just misunderstanding this snippet.This issue is basically the same as this SO question. It would be nice to give an authoritative answer. Also, issues #1670 and #2225 and open pull request #2352 are related to this issue.
The text was updated successfully, but these errors were encountered: