Created
February 28, 2020 07:18
-
-
Save hustlijian/74d4ceabb196098b09b1e499fca6e597 to your computer and use it in GitHub Desktop.
YCM config to FindCorrespondingSourceFile from upper directory (eg:libevent)
This file contains hidden or 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
def FindCorrespondingSourceFile( filename ): | |
if IsHeaderFile( filename ): | |
basename = os.path.splitext( filename )[ 0 ] | |
for extension in SOURCE_EXTENSIONS: | |
replacement_file = basename + extension | |
if os.path.exists( replacement_file ): | |
return replacement_file | |
name = os.path.basename(replacement_file) | |
upper_file = os.path.normpath(os.path.join(os.path.dirname(replacement_file), "../", name)) | |
if os.path.exists( upper_file): | |
return upper_file | |
upper_file = os.path.normpath(os.path.join(os.path.dirname(replacement_file), "../../", name)) | |
if os.path.exists( upper_file): | |
return upper_file | |
return filename |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment