Skip to content
This repository has been archived by the owner on Aug 30, 2020. It is now read-only.

Detect file language by source file extension #101

Open
wants to merge 2 commits into
base: stable
Choose a base branch
from

Conversation

dmpetroff
Copy link

I've been using ycm-gen for multilanguage (C/C++) project and had troubles with single language being forced for all project files. So I've made language enforcement not global, but rather "per-file by extension". That may be more convenient better that the current behaviour.

Also it's still possible to globally enforce single language via --language option of config_gen.py

@@ -136,7 +136,10 @@ def main():
else:
lang, flags = ("c++", cxx_flags)

generate_conf(["-x", lang] + flags, config_file)
if force_lang:
lang += ["-x", force_lang]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lang should be a scalar value, not a list of flags

if force_lang:
lang += ["-x", force_lang]

generate_conf(flags, config_file)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will break color-coded config generation (generate_cc_conf()), because it outputs a plain text file without the logic in template.py.

IMO, a better way to handle this would be to add separate parameters to the generate_*_conf functions for force_lang and detected_lang, so they can do the right thing for their outputs.

@rdnetto
Copy link
Owner

rdnetto commented Apr 4, 2017

Can you please target the develop branch instead of stable?

Also, please make sure that template.py is valid in both Python 2 & Python 3. (I really need to setup some CI for this sometime...)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants