diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3e0c8688..b6823e74 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,9 +7,12 @@ YCM to work on my machine" and the reason why is obviously related to your machine configuration and the problem would not be resolved with _reasonable_ changes to the YCM codebase, then the issue is likely to be closed. +**A good place to ask questions is the [ycm-users][] Google group**. Rule of +thumb: if you're not sure whether your problem is a real bug, ask on the group. + **YCM compiles just fine**; [the build bots say so][build-bots]. If the bots are green and YCM doesn't compile on your machine, then _your machine is the root -cause_. Now read the previous paragraph again. +cause_. Now read the first paragraph again. Realize that quite literally _thousands_ of people have gotten YCM to work successfully so if you can't, it's probably because you have a peculiar @@ -25,6 +28,8 @@ Further, **search the issue tracker for similar issues** before creating a new one. There's no point in duplication; if an existing issue addresses your problem, please comment there instead of creating a duplicate. +You should also **search the archives of the [ycm-users][] mailing list**. + Lastly, **make sure you are running the latest version of YCM**. The issue you have encountered may have already been fixed. **Don't forget to recompile ycm_core.so too** (usually by just running `install.sh` again). @@ -80,3 +85,4 @@ Creating good pull requests change is known. _What goal are you trying to accomplish?_ [build-bots]: https://travis-ci.org/Valloric/YouCompleteMe +[ycm-users]: https://groups.google.com/forum/?hl=en#!forum/ycm-users diff --git a/README.md b/README.md index 65767a6f..e6ea221b 100644 --- a/README.md +++ b/README.md @@ -240,16 +240,22 @@ notify you to recompile it. You should then rerun the install process. Now we need to generate the makefiles. If you DON'T care about semantic support for C-family languages, run the following command in the `ycm_build` - directory: `cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp` + directory: + + cmake -G "Unix Makefiles" . ~/.vim/bundle/YouCompleteMe/cpp If you DO care about semantic support for C-family languages, then your `cmake` call will be a bit more complicated. We'll assume you downloaded a binary distribution of LLVM+Clang from llvm.org in step 3 and that you extracted the archive file to folder `~/ycm_temp/llvm_root_dir` (with `bin`, `lib`, `include` etc. folders right inside that folder). With that in mind, - run the following command in the `ycm_build` directory: `cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/cpp` + run the following command in the `ycm_build` directory: + + cmake -G "Unix Makefiles" -DPATH_TO_LLVM_ROOT=~/ycm_temp/llvm_root_dir . ~/.vim/bundle/YouCompleteMe/cpp - Now that makefiles have been generated, simply run `make ycm_core`. + Now that makefiles have been generated, simply run: + + make ycm_core For those who want to use the system version of libclang, you would pass `-DUSE_SYSTEM_LIBCLANG=ON` to cmake _instead of_ the @@ -1244,7 +1250,7 @@ current file and simple prefix-based fitering. ### Why does YCM demand such a recent version of Vim? -During YCM's development several show-stopper bugs where encountered in Vim. +During YCM's development several show-stopper bugs were encountered in Vim. Those needed to be fixed upstream (and were). A few months after those bugs were fixed, Vim trunk landed the `pyeval()` function which improved YCM performance even more since less time was spent serializing and deserializing data between @@ -1264,12 +1270,22 @@ You'll have to learn to ignore them. It's a shitty "solution", I know. Use the [delimitMate][] plugin instead. It does the same thing without conflicting with YCM. +### Is there some sort of YCM mailing list? I have questions + +If you have questions about the plugin or need help, please use the +[ycm-users][] mailing list, _don't_ create issues on the tracker. The tracker is +for bug reports and feature requests. Contact ------- -If you have questions, bug reports, suggestions, etc. please use the [issue -tracker][tracker]. The latest version is available at +If you have questions about the plugin or need help, please use the +[ycm-users][] mailing list. + +If you have bug reports or feature suggestions, please use the [issue +tracker][tracker]. + +The latest version of the plugin is available at . The author's homepage is . @@ -1308,3 +1324,4 @@ This software is licensed under the [GPL v3 license][gpl]. [exuberant-ctags]: http://ctags.sourceforge.net/ [ctags-format]: http://ctags.sourceforge.net/FORMAT [vundle-bug]: https://github.com/gmarik/vundle/issues/48 +[ycm-users]: https://groups.google.com/forum/?hl=en#!forum/ycm-users diff --git a/cpp/BoostParts/CMakeLists.txt b/cpp/BoostParts/CMakeLists.txt index 14e37a4e..6b0d3675 100644 --- a/cpp/BoostParts/CMakeLists.txt +++ b/cpp/BoostParts/CMakeLists.txt @@ -118,3 +118,8 @@ if( MSVC ) set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL" ) set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" ) endif() + +if( SYSTEM_IS_SUNOS ) + # SunOS needs this setting for thread support + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthreads" ) +endif() diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 7afe590b..fecda10b 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -28,6 +28,10 @@ if ( ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" ) set( SYSTEM_IS_FREEBSD true ) endif() +if ( ${CMAKE_SYSTEM_NAME} MATCHES "SunOS" ) + set( SYSTEM_IS_SUNOS true ) +endif() + # Check if platform is 64 bit if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) set( 64_BIT_PLATFORM 0 ) diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt index 52e7afd6..44ea8717 100644 --- a/cpp/ycm/CMakeLists.txt +++ b/cpp/ycm/CMakeLists.txt @@ -313,4 +313,9 @@ endif() ############################################################################# +if( SYSTEM_IS_SUNOS ) + # SunOS needs this setting for thread support + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthreads" ) +endif() + add_subdirectory( tests ) diff --git a/install.sh b/install.sh index 7000fe2c..413b6608 100755 --- a/install.sh +++ b/install.sh @@ -102,20 +102,19 @@ function linux_cmake_install { } function usage { - echo "Usage: $0 [--clang-completer] [--cs-completer]" + echo "Usage: $0 [--clang-completer [--system-libclang]] [--omnisharp-completer]" exit 0 } -if [[ $# -gt 2 ]]; then - usage -fi - -cmake_args='' +cmake_args="" omnisharp_completer=false for flag in $@; do case "$flag" in --clang-completer) - cmake_args='-DUSE_CLANG_COMPLETER=ON' + cmake_args="-DUSE_CLANG_COMPLETER=ON" + ;; + --system-libclang) + cmake_args="$cmake_args -DUSE_SYSTEM_LIBCLANG=ON" ;; --omnisharp-completer) omnisharp_completer=true @@ -126,6 +125,11 @@ for flag in $@; do esac done +if [[ $cmake_args == *-DUSE_SYSTEM_LIBCLANG=ON* ]] && \ + [[ $cmake_args != *-DUSE_CLANG_COMPLETER=ON* ]]; then + usage +fi + if ! command_exists cmake; then echo "CMake is required to build YouCompleteMe." cmake_install diff --git a/plugin/youcompleteme.vim b/plugin/youcompleteme.vim index 70c5e33d..c95a2284 100644 --- a/plugin/youcompleteme.vim +++ b/plugin/youcompleteme.vim @@ -21,13 +21,11 @@ set cpo&vim if exists( "g:loaded_youcompleteme" ) finish -elseif v:version < 704 - if v:version < 703 || !has( 'patch584' ) - echohl WarningMsg | - \ echomsg "YouCompleteMe unavailable: requires Vim 7.3.584+" | - \ echohl None - finish - endif +elseif v:version < 703 || (v:version == 703 && !has('patch584')) + echohl WarningMsg | + \ echomsg "YouCompleteMe unavailable: requires Vim 7.3.584+" | + \ echohl None + finish elseif !has( 'python' ) echohl WarningMsg | \ echomsg "YouCompleteMe unavailable: requires python 2.x" | diff --git a/python/ycm/completers/general/filename_completer.py b/python/ycm/completers/general/filename_completer.py index 42ad6711..8dd1f181 100644 --- a/python/ycm/completers/general/filename_completer.py +++ b/python/ycm/completers/general/filename_completer.py @@ -82,13 +82,13 @@ class FilenameCompleter( ThreadedCompleter ): # We do what GCC does for <> versus "": # http://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html include_current_file_dir = '<' not in include_match.group() - return GenerateCandidatesForPaths( + return _GenerateCandidatesForPaths( self.GetPathsIncludeCase( path_dir, include_current_file_dir ) ) path_match = self._path_regex.search( line ) path_dir = os.path.expanduser( path_match.group() ) if path_match else '' - return GenerateCandidatesForPaths( GetPathsStandardCase( path_dir ) ) + return _GenerateCandidatesForPaths( _GetPathsStandardCase( path_dir ) ) def GetPathsIncludeCase( self, path_dir, include_current_file_dir ): @@ -110,7 +110,7 @@ class FilenameCompleter( ThreadedCompleter ): return sorted( set( paths ) ) -def GetPathsStandardCase( path_dir ): +def _GetPathsStandardCase( path_dir ): if not USE_WORKING_DIR and not path_dir.startswith( '/' ): path_dir = os.path.join( os.path.dirname( vim.current.buffer.name ), path_dir ) @@ -124,11 +124,19 @@ def GetPathsStandardCase( path_dir ): for relative_path in relative_paths ) -def GenerateCandidatesForPaths( absolute_paths ): - def GenerateCandidateForPath( absolute_path ): - is_dir = os.path.isdir( absolute_path ) - return { 'word': os.path.basename( absolute_path ), - 'dup': 1, - 'menu': '[Dir]' if is_dir else '[File]' } +def _GenerateCandidatesForPaths( absolute_paths ): + seen_basenames = set() + completion_dicts = [] - return [ GenerateCandidateForPath( path ) for path in absolute_paths ] + for absolute_path in absolute_paths: + basename = os.path.basename( absolute_path ) + if basename in seen_basenames: + continue + seen_basenames.add( basename ) + + is_dir = os.path.isdir( absolute_path ) + completion_dicts.append( { 'word': basename, + 'dup': 1, + 'menu': '[Dir]' if is_dir else '[File]' } ) + + return completion_dicts