Last active
January 15, 2017 14:39
-
-
Save mutewinter/7186595 to your computer and use it in GitHub Desktop.
Add dash and underscore completion for the YouCompleteMe Vim plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ycmd/identifier_utils.py b/ycmd/identifier_utils.py | |
index 4217fdef..ac91c97b 100644 | |
--- a/ycmd/identifier_utils.py | |
+++ b/ycmd/identifier_utils.py | |
@@ -102,6 +102,7 @@ FILETYPE_TO_IDENTIFIER_REGEX = { | |
} | |
FILETYPE_TO_IDENTIFIER_REGEX[ 'scss' ] = FILETYPE_TO_IDENTIFIER_REGEX[ 'css' ] | |
+FILETYPE_TO_IDENTIFIER_REGEX[ 'javascript' ] = FILETYPE_TO_IDENTIFIER_REGEX[ 'css' ] | |
FILETYPE_TO_IDENTIFIER_REGEX[ 'sass' ] = FILETYPE_TO_IDENTIFIER_REGEX[ 'css' ] | |
FILETYPE_TO_IDENTIFIER_REGEX[ 'less' ] = FILETYPE_TO_IDENTIFIER_REGEX[ 'css' ] | |
FILETYPE_TO_IDENTIFIER_REGEX[ 'elisp' ] = ( |
Thanks! Had to apply using --reject and --whitespace=fix.
Also added $-sign (useful when writing AngularJs)...
return char.isalnum() or char in ['_', '-', '$']
const char *IDENTIFIER_REGEX = "[\\$_a-zA-Z][\\w_-]*";
👍
Adding the $ sign also helps with sass variables too. Cheers.
You might want to use the following instead to only match $
at the beginning:
const char *IDENTIFIER_REGEX = "\\$?[_a-zA-Z][\\w_-]*";
(also in my fork, together with handling identifiers from strings and comments)
Updated for ycmd
.
Does this still work? I can't find any reference to:
def IsIdentifierChar( char ): return char.isalnum() or char == '_'
to change in my local source code .
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, works fine!