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

Match dashes/underscores in identifiers #109

Closed
blueyed opened this issue Feb 13, 2013 · 6 comments
Closed

Match dashes/underscores in identifiers #109

blueyed opened this issue Feb 13, 2013 · 6 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Feb 13, 2013

I changed IDENTIFIER_REGEX to include dashes and underscores (in https://github.com/Valloric/YouCompleteMe/blob/master/cpp/ycm/IdentifierUtils.cpp#L37):

const char *IDENTIFIER_REGEX = "[_a-zA-Z][\\w_-]*";

(It would be great, if it could respect Vim's iskeyword setting.)

But that appears to need further adjustments somewhere else.. after completing "foo-bar-baz" it still offers "foo-bar-baz" and completes it to "foo-foo-bar-baz".

See also issue #98 (about comments).

@Valloric
Copy link
Member

Duplicate issue #86.

@blueyed
Copy link
Contributor Author

blueyed commented Feb 14, 2013

Can you tell me, if what I've tried should basically work?
Is there a reason why completion of the matched/collected foo-bar indentifiers behaves strange ("foo-" => "foo-bar" => "foo-foo-bar")?

@noprompt
Copy link

@blueyed You need to update python/ycm_utils.py like so:

def IsIdentifierChar( char ):
  return char.isalnum() or char in ['_', '-']

That should help.

@blueyed
Copy link
Contributor Author

blueyed commented Feb 17, 2013

Thanks, @noprompt - that appears to work.

@yayitswei
Copy link

This works for me too, thanks guys.

@mutewinter
Copy link

For anyone finding this now, this Gist will patch YouCompleteMe to support -'s and _'s as identifiers.

blueyed added a commit to blueyed/YouCompleteMe that referenced this issue Mar 14, 2014
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants