Repository navigation
Add unicode support for \w regexps - #667
Conversation
|
+1 |
|
This is interesting. One thing that's a little nervewracking is that it's pulling in a new regex library that has a lot of unknowns. We dont know if it's slow, we dont know what other issues are in there, and we dont know about the edges no one has thought about. I think the right way forward should be:
|
|
Hi, @benogle
Letters = "0-9A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\_and_so_on_and_so_on"
...
wordPrefixRegex: RegExp ('^[' + Letters + '\\d_]+[' + Letters + '-\\d_]*$')So, you have no extra dependencies AND have needed behavior. |
Having an option makes sure that there are no regressions, and people can enable/disable it at will. This was the same approach done for fuzzy finding (which had even more requests, also since 2014) and other major features such as preview tabs or the Shadow DOM. After a while if everything is proven stable then the default can be switched to true or even removed (as in the case of preview tabs). |
|
@50Wliu do you think this option should be editor-wide or could be specified for specific language? Me and my colleauges tested it for our language package (in both ascii and non-ascii variants). it would be great if we could turn this flag on when package activate() |
b76368e to
6048840
Compare
75b6001 to
3aecf17
Compare
New setting turns on the extended regexes instead of classic \w
082bf70 to
16d45c4
Compare
|
Here some updates for this PR.
enableExtendedUnicodeSupport is disabled: enableExtendedUnicodeSupport is enabled: As you can see, time for all three variants is nearly equal, within the measuring error. Maybe you'll want to get xRegExp dep back or hide |
Add unicode support for \w regexps
|
Thanks for this! |
|
Amazing news, thanks for the hard work! |



Hello.
This is a fix for long-lived bug #76 - autocomplete is broken for non-ascii symbols (cause of
\w-implementation as[a-zA-Z0-9_])I took @l-flame idea of adding XRegExp and replacing
\wto[\p{L}\d_]+ some tuning for\b(it's also based on\w).All 218 specs are "green".