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

No .ycm_extra_conf.py file detected #429

Closed
hominlinx opened this issue Jul 7, 2013 · 12 comments
Closed

No .ycm_extra_conf.py file detected #429

hominlinx opened this issue Jul 7, 2013 · 12 comments

Comments

@hominlinx
Copy link

No .ycm_extra_conf.py file detected, so no compile flags are available. Thus no semantic support for C/C++/ObjC/ObjC++. Go READ THE DOCS NOW, DON'T file a bug report.
I have found the file ~/.vim/bundle/YouCompleteMe/cpp/ycm/.ycm_extra_conf.py。。
why?

Thanks a lot!
homilinx

@Valloric
Copy link
Member

Valloric commented Jul 7, 2013

Please read the error message again.

@puremourning
Copy link
Member

puremourning commented May 14, 2016

The documentation is clear. Please ensure that you are civil when interacting eith the volunteers here. Please see the code of conduct

bijancn pushed a commit to bijancn/YouCompleteMe that referenced this issue Jul 26, 2016
[READY] Search user defined python binary also in PATH

I'm marking as an RFC because there is also ycm-core#424 which does almost the same thing.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/429)
<!-- Reviewable:end -->
@mjdousti
Copy link

mjdousti commented Sep 26, 2016

I agree that YCM's documentation is a bit fuzzy. Basically, you have two options:

  • Add this line to your .vimrc after loading YCM. This sets a default location for .ycm_extra_conf.py. I believe this should have been the default for YCM.
let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
  • Copy YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py to your source code directory and modify it if you need. This file will override the previous global extra conf file.

@vheon
Copy link
Contributor

vheon commented Sep 26, 2016

I agree that YCM's documentation is a bit fuzzy

Let's agree to disagree at least :P Is true that we work on this long enough that we can't always see the forest for the trees, so PRs are welcome 👍

  • Add this line to your .vimrc after loading YCM. This sets a default location for .ycm_extra_conf.py. I believe this should have been the default for YCM.
let g:ycm_global_ycm_extra_conf = '$USER/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra

I don't know how many times I've written this, but DON'T DO THIS. Doing this you're basically using the settings that we use to work on the cpp side of ycmd for your project, which I'm almost sure they're not the same.

Copy YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py to your source code directory and modify it if you need. This file will override the previous global extra conf file.

IMHO would be easier to write it from scratch, I mean:

def FlagsForFile(filename, **kwargs):
  flags = [ ... ] # put your flag here
  return { 'flags': flags }

@Daniel451
Copy link

Daniel451 commented Nov 2, 2016

@vheon what's the problem with supplying a global .ycm_extra_conf.py?
I came from Java & especially Python, thus I'm new to C++, so could you explain why one should want different flags for every project?
I mean you compile YCM once, right? And I am compiling my C++ projects with g++, so YCM has nothing to do with project-related compilation?! Why should YCM need project-related information/flags at all?

@vheon
Copy link
Contributor

vheon commented Nov 2, 2016

I came from Java

Let's see... do you use the same pom.xml for every Java project? I don't think so because maybe in one project you need Guava and in another one you need Solr; maybe in a project you have the file in a src directory and in another one you put the files in libs or whatever. Is the same in C++, hence you need different flags for every project. We don't need the flags for YCM itself, but we need the flags of your project to pass them to libclang to compile your code and provide you semantic completion and features. There is no universal flags set for every project in every language.

@Daniel451
Copy link

Ok, thanks for the explanation.

@cedarmora
Copy link

@mjdousti Your solution almost worked for me. Replacing $USER with a tilde (~) character to represent the path to the home directory instead did work, like so:

let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'

@puremourning
Copy link
Member

@cedarmora you should not do that. Read the docs to understand why.

@harrispham98
Copy link

@vheon Can you explain for me why do I need flags for project? And why don't we fix this problem with let command? I have just use it and I see it done. And I don't know why my .ycm_extra_conf.py not in cpp. It's just in ycmd folder and I don't have cpp folder. Sorry for this trouble. Thank you so much.

@bstaletic
Copy link
Collaborator

@PhamHoangNamAnh
Read this and the following two comments: #415 (comment)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants