C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting

Overview

ccls

Telegram Gitter

ccls, which originates from cquery, is a C/C++/Objective-C language server.

It has a global view of the code base and support a lot of cross reference features, see wiki/FAQ. It starts indexing the whole project (including subprojects if exist) parallelly when you open the first file, while the main thread can serve requests before the indexing is complete. Saving files will incrementally update the index.

>>> Getting started (CLICK HERE) <<<

ccls can index itself (~180MiB RSS when idle, noted on 2018-09-01), FreeBSD, glibc, Linux, LLVM (~1800MiB RSS), musl (~60MiB RSS), ... with decent memory footprint. See wiki/Project-Setup for examples.

Issues
  • ccls c++ header completion on osx

    ccls c++ header completion on osx

    OS: macOS Mojave 10.14.2 emacs: 26.1 Spacemacs: develop Problem: header file can't be completed correctly image

    And ccls reported error on string and vector even if the correct header file is included image

    .ccls content: %clang -Wall %c -std=gnu11 %cpp -std=c++11 %cpp -stdlib=libc++

    CMakeLists.txt: cmake_minimum_required(VERSION 3.13) project(test_ccls) set(CMAKE_CXX_STANDARD 11) include_directories(/usr/local/Cellar/llvm/7.0.0_1/include/c++/v1) add_executable(test_ccls main.cpp)

    I have generated and linked the compile_commands.json file. Solutions mentioned in https://github.com/MaskRay/ccls/issues/125 and https://github.com/MaskRay/ccls/issues/160 seem not work here. Solutions in wiki https://github.com/MaskRay/ccls/wiki/FAQ#some-cc-headers-are-not-recognized also don't work.

    opened by DL-85 38
  • segmentation fault (core dumped)

    segmentation fault (core dumped)

    a couple hours ago, ccls was just fine. I tested some basic features under spacemacs.

    However, two hours ago, after I recompiled aur/ccls-git and updated lsp-mode, ccls package in emacs, errors occurred!

    coredump info:

    $ coredumpctl info 22625
               PID: 22625 (ccls)
               PID: 22625 (ccls)
               UID: 1000 (shaikh)
               GID: 1000 (shaikh)
            Signal: 11 (SEGV)
         Timestamp: Mon 2018-07-09 17:02:15 CST (19s ago)
      Command Line: /usr/bin/ccls --log-file=/tmp/ccls.log
        Executable: /usr/bin/ccls
     Control Group: /user.slice/user-1000.slice/session-c1.scope
              Unit: session-c1.scope
             Slice: user-1000.slice
           Session: c1
         Owner UID: 1000 (shaikh)
           Boot ID: efe30e1d1af340cdb19ae8455ccd625d
        Machine ID: 26f090b164cf43619ddb4a3c9c38ae60
          Hostname: ArchX
           Storage: /var/lib/systemd/coredump/core.ccls.1000.efe30e1d1af340cdb19ae8455ccd625d.22625.1531126935000000.lz4
           Message: Process 22625 (ccls) of user 1000 dumped core.
                    
                    Stack trace of thread 22633:
                    #0  0x00007efe317f9d08 _ZN4llvm3sys2fs6detail28directory_iterator_constructERNS2_12DirIterStateENS_9StringRefEb (libLLVM-7svn.so)
                    #1  0x0000560f164d3bd8 n/a (ccls)
                    #2  0x0000560f163c39f1 n/a (ccls)
                    #3  0x0000560f163c4a3b n/a (ccls)
                    #4  0x0000560f163d81a5 n/a (ccls)
                    #5  0x0000560f1633495b _ZNK5clang6driver6Driver12getToolChainERKN4llvm3opt7ArgListERKNS2_6TripleE (ccls)
                    #6  0x0000560f16340343 _ZN5clang6driver6Driver16BuildCompilationEN4llvm8ArrayRefIPKcEE (ccls)
                    #7  0x0000560f1578a207 _ZN5clang31createInvocationFromCommandLineEN4llvm8ArrayRefIPKcEENS0_18IntrusiveRefCntPtrINS_17DiagnosticsEngineEEENS5_INS_3vfs10FileSystemEEE (ccls)
                    #8  0x0000560f1562d71c _ZN4ccls3idx5IndexEP3VFSRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKSt6vectorIS8_SaIS8_EERKSB_I12FileContentsSaISG_EE (ccls)
                    #9  0x0000560f156679b1 n/a (ccls)
                    #10 0x0000560f15668adc _ZN4ccls8pipeline12Indexer_MainEP20DiagnosticsPublisherP3VFSP7ProjectP12WorkingFiles (ccls)
                    #11 0x0000560f156d352d n/a (ccls)
                    #12 0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #13 0x00007efe30772075 start_thread (libpthread.so.0)
                    #14 0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22625:
                    #0  0x00007efe30777ffc [email protected]@GLIBC_2.3.2 (libpthread.so.0)
                    #1  0x00007efe30c55d6d __gthread_cond_wait (libstdc++.so.6)
                    #2  0x0000560f15669cf2 _ZN4ccls8pipeline8MainLoopEv (ccls)
                    #3  0x0000560f155feebc main (ccls)
                    #4  0x00007efe303d206b __libc_start_main (libc.so.6)
                    #5  0x0000560f1560365a _start (ccls)
                    
                    Stack trace of thread 22632:
                    #0  0x00007efe317f9d08 _ZN4llvm3sys2fs6detail28directory_iterator_constructERNS2_12DirIterStateENS_9StringRefEb (libLLVM-7svn.so)
                    #1  0x0000560f164d3bd8 n/a (ccls)
                    #2  0x0000560f163c39f1 n/a (ccls)
                    #3  0x0000560f163c4a3b n/a (ccls)
                    #4  0x0000560f163d81a5 n/a (ccls)
                    #5  0x0000560f1633495b _ZNK5clang6driver6Driver12getToolChainERKN4llvm3opt7ArgListERKNS2_6TripleE (ccls)
                    #6  0x0000560f16340343 _ZN5clang6driver6Driver16BuildCompilationEN4llvm8ArrayRefIPKcEE (ccls)
                    #7  0x0000560f1578a207 _ZN5clang31createInvocationFromCommandLineEN4llvm8ArrayRefIPKcEENS0_18IntrusiveRefCntPtrINS_17DiagnosticsEngineEEENS5_INS_3vfs10FileSystemEEE (ccls)
                    #8  0x0000560f1562d71c _ZN4ccls3idx5IndexEP3VFSRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKSt6vectorIS8_SaIS8_EERKSB_I12FileContentsSaISG_EE (ccls)
                    #9  0x0000560f156679b1 n/a (ccls)
                    #10 0x0000560f15668adc _ZN4ccls8pipeline12Indexer_MainEP20DiagnosticsPublisherP3VFSP7ProjectP12WorkingFiles (ccls)
                    #11 0x0000560f156d352d n/a (ccls)
                    #12 0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #13 0x00007efe30772075 start_thread (libpthread.so.0)
                    #14 0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22627:
                    #0  0x00007efe30777ffc [email protected]@GLIBC_2.3.2 (libpthread.so.0)
                    #1  0x00007efe30c55d6d __gthread_cond_wait (libstdc++.so.6)
                    #2  0x0000560f1566478b n/a (ccls)
                    #3  0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #4  0x00007efe30772075 start_thread (libpthread.so.0)
                    #5  0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22634:
                    #0  0x00007efe3077cb50 __libc_sigaction (libpthread.so.0)
                    #1  0x00007efe31804af1 _ZL13SignalHandleri (libLLVM-7svn.so)
                    #2  0x00007efe3077ca80 __restore_rt (libpthread.so.0)
                    #3  0x00007efe317f9d08 _ZN4llvm3sys2fs6detail28directory_iterator_constructERNS2_12DirIterStateENS_9StringRefEb (libLLVM-7svn.so)
                    #4  0x0000560f164d3bd8 n/a (ccls)
                    #5  0x0000560f163c39f1 n/a (ccls)
                    #6  0x0000560f163c4a3b n/a (ccls)
                    #7  0x0000560f163d81a5 n/a (ccls)
                    #8  0x0000560f1633495b _ZNK5clang6driver6Driver12getToolChainERKN4llvm3opt7ArgListERKNS2_6TripleE (ccls)
                    #9  0x0000560f16340343 _ZN5clang6driver6Driver16BuildCompilationEN4llvm8ArrayRefIPKcEE (ccls)
                    #10 0x0000560f1578a207 _ZN5clang31createInvocationFromCommandLineEN4llvm8ArrayRefIPKcEENS0_18IntrusiveRefCntPtrINS_17DiagnosticsEngineEEENS5_INS_3vfs10FileSystemEEE (ccls)
                    #11 0x0000560f1562d71c _ZN4ccls3idx5IndexEP3VFSRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKSt6vectorIS8_SaIS8_EERKSB_I12FileContentsSaISG_EE (ccls)
                    #12 0x0000560f156679b1 n/a (ccls)
                    #13 0x0000560f15668adc _ZN4ccls8pipeline12Indexer_MainEP20DiagnosticsPublisherP3VFSP7ProjectP12WorkingFiles (ccls)
                    #14 0x0000560f156d352d n/a (ccls)
                    #15 0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #16 0x00007efe30772075 start_thread (libpthread.so.0)
                    #17 0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22628:
                    #0  0x00007efe30777ffc [email protected]@GLIBC_2.3.2 (libpthread.so.0)
                    #1  0x00007efe30c55d6d __gthread_cond_wait (libstdc++.so.6)
                    #2  0x0000560f1560ed51 _ZNSt3_V222condition_variable_any4waitISt11unique_lockISt5mutexEEEvRT_ (ccls)
                    #3  0x0000560f1560f09b _ZN13ThreadedQueueISt10unique_ptrIN20ClangCompleteManager17CompletionRequestESt14default_deleteIS2_EEE7DequeueEv (ccls)
                    #4  0x0000560f1560a71b n/a (ccls)
                    #5  0x0000560f1560b7bf n/a (ccls)
                    #6  0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #7  0x00007efe30772075 start_thread (libpthread.so.0)
                    #8  0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22629:
                    #0  0x00007efe30777ffc [email protected]@GLIBC_2.3.2 (libpthread.so.0)
                    #1  0x00007efe30c55d6d __gthread_cond_wait (libstdc++.so.6)
                    #2  0x0000560f1560ed51 _ZNSt3_V222condition_variable_any4waitISt11unique_lockISt5mutexEEEvRT_ (ccls)
                    #3  0x0000560f15609960 n/a (ccls)
                    #4  0x0000560f15609a6f n/a (ccls)
                    #5  0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #6  0x00007efe30772075 start_thread (libpthread.so.0)
                    #7  0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22630:
                    #0  0x00007efe30777ffc [email protected]@GLIBC_2.3.2 (libpthread.so.0)
                    #1  0x00007efe30c55d6d __gthread_cond_wait (libstdc++.so.6)
                    #2  0x0000560f1560ed51 _ZNSt3_V222condition_variable_any4waitISt11unique_lockISt5mutexEEEvRT_ (ccls)
                    #3  0x0000560f1560a2d6 n/a (ccls)
                    #4  0x0000560f1560a6bf n/a (ccls)
                    #5  0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #6  0x00007efe30772075 start_thread (libpthread.so.0)
                    #7  0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22626:
                    #0  0x00007efe30498934 __read (libc.so.6)
                    #1  0x00007efe3042a788 [email protected]@GLIBC_2.2.5 (libc.so.6)
                    #2  0x00007efe3042b8a2 _IO_default_uflow (libc.so.6)
                    #3  0x00007efe304261f0 _IO_getc (libc.so.6)
                    #4  0x0000560f15638d5e _Z25ReadCharFromStdinBlockingv (ccls)
                    #5  0x0000560f156393e7 _Z22ReadJsonRpcContentFromB5cxx11St8functionIFSt8optionalIcEvEE (ccls)
                    #6  0x0000560f1563c30c _ZN15MessageRegistry20ReadMessageFromStdinB5cxx11EPSt10unique_ptrI9InMessageSt14default_deleteIS1_EE (ccls)
                    #7  0x0000560f15665606 n/a (ccls)
                    #8  0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #9  0x00007efe30772075 start_thread (libpthread.so.0)
                    #10 0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22631:
                    #0  0x00007efe30509669 __strlen_avx2 (libc.so.6)
                    #1  0x00007efe32a99b7c _ZNK4llvm3opt8OptTable11ParseOneArgERKNS0_7ArgListERjjj (libLLVM-7svn.so)
                    #2  0x00007efe32a9a17e _ZNK4llvm3opt8OptTable9ParseArgsENS_8ArrayRefIPKcEERjS6_jj (libLLVM-7svn.so)
                    #3  0x0000560f16326dbc _ZN5clang6driver6Driver15ParseArgStringsEN4llvm8ArrayRefIPKcEERb (ccls)
                    #4  0x0000560f1633fc2b _ZN5clang6driver6Driver16BuildCompilationEN4llvm8ArrayRefIPKcEE (ccls)
                    #5  0x0000560f1578a207 _ZN5clang31createInvocationFromCommandLineEN4llvm8ArrayRefIPKcEENS0_18IntrusiveRefCntPtrINS_17DiagnosticsEngineEEENS5_INS_3vfs10FileSystemEEE (ccls)
                    #6  0x0000560f1562d71c _ZN4ccls3idx5IndexEP3VFSRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKSt6vectorIS8_SaIS8_EERKSB_I12FileContentsSaISG_EE (ccls)
                    #7  0x0000560f156679b1 n/a (ccls)
                    #8  0x0000560f15668adc _ZN4ccls8pipeline12Indexer_MainEP20DiagnosticsPublisherP3VFSP7ProjectP12WorkingFiles (ccls)
                    #9  0x0000560f156d352d n/a (ccls)
                    #10 0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #11 0x00007efe30772075 start_thread (libpthread.so.0)
                    #12 0x00007efe304a753f __clone (libc.so.6)
    
               PID: 22625 (ccls)
               UID: 1000 (shaikh)
               GID: 1000 (shaikh)
            Signal: 11 (SEGV)
         Timestamp: Mon 2018-07-09 17:02:15 CST (19s ago)
      Command Line: /usr/bin/ccls --log-file=/tmp/ccls.log
        Executable: /usr/bin/ccls
     Control Group: /user.slice/user-1000.slice/session-c1.scope
              Unit: session-c1.scope
             Slice: user-1000.slice
           Session: c1
         Owner UID: 1000 (shaikh)
           Boot ID: efe30e1d1af340cdb19ae8455ccd625d
        Machine ID: 26f090b164cf43619ddb4a3c9c38ae60
          Hostname: ArchX
           Storage: /var/lib/systemd/coredump/core.ccls.1000.efe30e1d1af340cdb19ae8455ccd625d.22625.1531126935000000.lz4
           Message: Process 22625 (ccls) of user 1000 dumped core.
                    
                    Stack trace of thread 22633:
                    #0  0x00007efe317f9d08 _ZN4llvm3sys2fs6detail28directory_iterator_constructERNS2_12DirIterStateENS_9StringRefEb (libLLVM-7svn.so)
                    #1  0x0000560f164d3bd8 n/a (ccls)
                    #2  0x0000560f163c39f1 n/a (ccls)
                    #3  0x0000560f163c4a3b n/a (ccls)
                    #4  0x0000560f163d81a5 n/a (ccls)
                    #5  0x0000560f1633495b _ZNK5clang6driver6Driver12getToolChainERKN4llvm3opt7ArgListERKNS2_6TripleE (ccls)
                    #6  0x0000560f16340343 _ZN5clang6driver6Driver16BuildCompilationEN4llvm8ArrayRefIPKcEE (ccls)
                    #7  0x0000560f1578a207 _ZN5clang31createInvocationFromCommandLineEN4llvm8ArrayRefIPKcEENS0_18IntrusiveRefCntPtrINS_17DiagnosticsEng
    ineEEENS5_INS_3vfs10FileSystemEEE (ccls)
                    #8  0x0000560f1562d71c _ZN4ccls3idx5IndexEP3VFSRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKSt6vectorIS8_SaIS8_EERKSB
    _I12FileContentsSaISG_EE (ccls)
                    #9  0x0000560f156679b1 n/a (ccls)
    ...skipping...
                    #7  0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22626:
                    #0  0x00007efe30498934 __read (libc.so.6)
                    #1  0x00007efe3042a788 [email protected]@GLIBC_2.2.5 (libc.so.6)
                    #2  0x00007efe3042b8a2 _IO_default_uflow (libc.so.6)
                    #3  0x00007efe304261f0 _IO_getc (libc.so.6)
                    #4  0x0000560f15638d5e _Z25ReadCharFromStdinBlockingv (ccls)
                    #5  0x0000560f156393e7 _Z22ReadJsonRpcContentFromB5cxx11St8functionIFSt8optionalIcEvEE (ccls)
                    #6  0x0000560f1563c30c _ZN15MessageRegistry20ReadMessageFromStdinB5cxx11EPSt10unique_ptrI9InMessageSt14default_deleteIS1_EE (ccls)
                    #7  0x0000560f15665606 n/a (ccls)
                    #8  0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #9  0x00007efe30772075 start_thread (libpthread.so.0)
                    #10 0x00007efe304a753f __clone (libc.so.6)
                    
                    Stack trace of thread 22631:
                    #0  0x00007efe30509669 __strlen_avx2 (libc.so.6)
                    #1  0x00007efe32a99b7c _ZNK4llvm3opt8OptTable11ParseOneArgERKNS0_7ArgListERjjj (libLLVM-7svn.so)
                    #2  0x00007efe32a9a17e _ZNK4llvm3opt8OptTable9ParseArgsENS_8ArrayRefIPKcEERjS6_jj (libLLVM-7svn.so)
                    #3  0x0000560f16326dbc _ZN5clang6driver6Driver15ParseArgStringsEN4llvm8ArrayRefIPKcEERb (ccls)
                    #4  0x0000560f1633fc2b _ZN5clang6driver6Driver16BuildCompilationEN4llvm8ArrayRefIPKcEE (ccls)
                    #5  0x0000560f1578a207 _ZN5clang31createInvocationFromCommandLineEN4llvm8ArrayRefIPKcEENS0_18IntrusiveRefCntPtrINS_17DiagnosticsEngineEEENS5_INS_3vfs10FileSystemEEE (ccls)
                    #6  0x0000560f1562d71c _ZN4ccls3idx5IndexEP3VFSRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESA_RKSt6vectorIS8_SaIS8_EERKSB_I12FileContentsSaISG_EE (ccls)
                    #7  0x0000560f156679b1 n/a (ccls)
                    #8  0x0000560f15668adc _ZN4ccls8pipeline12Indexer_MainEP20DiagnosticsPublisherP3VFSP7ProjectP12WorkingFiles (ccls)
                    #9  0x0000560f156d352d n/a (ccls)
                    #10 0x00007efe30c5bd4f execute_native_thread_routine (libstdc++.so.6)
                    #11 0x00007efe30772075 start_thread (libpthread.so.0)
                    #12 0x00007efe304a753f __clone (libc.so.6)
    

    ccls-log:

    $ cat /tmp/ccls.log             
    17:02:15 ccls           initialize.cc:431 I initializationOptions: {"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cacheDirectory":"/home/shaikh/Documents/modern.c++/part1/chap2/.ccls-cache/","cacheFormat":"binary","clang":{"extraArgs":["-D__cpp_deduction_guides=0","-Wno-macro-redefined"],"resourceDir":""},"client":{"snippetSupport":false},"codeLens":{"localVariables":true},"completion":{"caseSensitivity":2,"dropOldRequests":true,"detailedLabel":false,"filterAndSort":true,"includeBlacklist":[],"includeMaxPathSize":30,"includeSuffixWhitelist":[".h",".hpp",".hh"],"includeWhitelist":[]},"diagnostics":{"blacklist":[],"frequencyMs":0,"onParse":true,"onType":true,"whitelist":[]},"highlight":{"blacklist":[],"whitelist":[]},"index":{"attributeMakeCallsToCtor":true,"blacklist":[],"comments":2,"enabled":true,"onDidChange":false,"reparseForDependency":2,"threads":0,"whitelist":[]},"largeFileSize":2097152,"workspaceSymbol":{"caseSensitivity":1,"maxNum":1000,"sort":true},"xref":{"container":false,"maxNum":2000}}
    17:02:15 ccls           initialize.cc:435 I initialize in directory /home/shaikh/Documents/modern.c++/part1/chap2 with uri file:///home/shaikh/Documents/modern.c++/part1/chap2/
    17:02:15 ccls           initialize.cc:472 I Using -resource-dir=/usr/lib/clang/7.0.0
    17:02:15 ccls              project.cc:319 I loaded /home/shaikh/Documents/modern.c++/part1/chap2/compile_commands.json
    17:02:15 ccls           initialize.cc:506 I start 4 indexers
    17:02:15 ccls           initialize.cc:520 I dispatch initial index requests
    17:02:15 indexer2         pipeline.cc:219 I parse /home/shaikh/Documents/modern.c++/part1/chap2/2.4-const.cpp
    17:02:15 indexer3         pipeline.cc:219 I parse /home/shaikh/Documents/modern.c++/part1/chap2/2.1.2-type_conversions.cpp
    17:02:15 indexer1         pipeline.cc:219 I parse /home/shaikh/Documents/modern.c++/part1/chap2/2.3.2-pointers.cpp
    17:02:15 indexer0         pipeline.cc:219 I parse /home/shaikh/Documents/modern.c++/part1/chap2/2.3.3-compound_types.cpp
    17:02:15 ccls         message_handler.cc:152 I "/home/shaikh/Documents/modern.c++/part1/chap2/2.4-const.cpp" is being indexed.
    

    the test file 2.4-const.cpp has not been changed.

    ccls package version

    elpa/26.1/develop/ccls-20180708.1828
    

    lsp-mode version

    elpa/26.1/develop/lsp-mode-20180708.1914
    

    maybe I could roll back the emacs packages. but I don't know how to downgrade a aur/ccls-gt package. or should I build ccls by git and compiling the source code?

    question 
    opened by SyrakuShaikh 35
  • ccls hangs ps commands and then no responses in gvim

    ccls hangs ps commands and then no responses in gvim

    Observed behavior

    I try to use ccls on my extremely large proprietary codebase which I am unable to share.

    After a short amount of time, ccls ends up in a state that is very similar to what is described here: https://rachelbythebay.com/w/2014/10/27/ps/

    My "ps -ef" command hangs when it reaches "ccls". Also if I do "cat /proc//cmdline", I get a hang. I am using gvim 8.1.328 with "autozimu/LanguageClient-neovim" plugin. When I try commands like "hover" or "goto definition" in gvim, no response.

    I do not have these issues when using "cquery" on the same codebase with same compile_commands.json and same set of source files. I am able to browse with "cquery" but not with "ccls" due to this freeze.

    If I use ccls with a much much smaller sample project it works fine and I don't get this hang.

    I do not have root access on the machine where I do the source code development.

    I encountered these issues with ccls originally in September 2018 and was using cquery instead because of this problem. I decided to try ccls again and am still getting this issue.

    If I quit gvim, ccls is still hanging my ps commands. A simple "kill " won't stop ccls, I need to perform "kill -9 " to unhang ps.

    Expected behavior

    Should not get a hang on "ps -ef" when I use ccls, should not get a hang when I do

    Steps to reproduce

    1. gvim "my file"
    2. ccls starts indexing and eventually hangs the ps tools

    System information

    • ccls version (git describe --tags):

    $ git describe --tags 0.20181225.8

    • OS:

    $ uname -a Linux hostname 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

    • Editor:

    gvim 8.1.328

    • Language client (and version):

    autozimu/LanguageClient-neovim

    I don't know how to get the version? I installed it last fall. It works with cquery.

    bug 
    opened by rbresalier 27
  • CentOS 7.6 GCC 4.8.5 may need -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0

    CentOS 7.6 GCC 4.8.5 may need -DCMAKE_CXX_FLAGS=-D_GLIBCXX_USE_CXX11_ABI=0

    Observed behavior

    Server ccls:20680 status:starting exited with status signal. Do you want to restart it? (y or n) ccls-error:

    Process ccls stderr finished
    ccls: /root/.deploy/ccls/third_party/rapidjson/include/rapidjson/document.h:1251: rapidjson::GenericValue<Encoding, Allocator>::MemberIterator rapidjson::GenericValue<Encoding, Allocator>::FindMember(const rapidjson::GenericValue<Encoding, SourceAllocator>&) [with Source$
    #0 0x0000000001337d9a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/root/.deploy/ccls/Debug/ccls+0x1337d9a)
    #1 0x000000000133655a llvm::sys::RunSignalHandlers() (/root/.deploy/ccls/Debug/ccls+0x133655a)
    #2 0x000000000133668d SignalHandler(int) (/root/.deploy/ccls/Debug/ccls+0x133668d)
    #3 0x00007f5745cb25d0 __restore_rt (/lib64/libpthread.so.0+0xf5d0)
    #4 0x00007f57450ed207 __GI_raise (/lib64/libc.so.6+0x36207)
    #5 0x00007f57450ee8f8 __GI_abort (/lib64/libc.so.6+0x378f8)
    #6 0x00007f57450e6026 __assert_fail_base (/lib64/libc.so.6+0x2f026)
    #7 0x00007f57450e60d2 (/lib64/libc.so.6+0x2f0d2)
    #8 0x000000000052a7ab rapidjson::GenericMemberIterator<false, rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> > rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::FindMember<rapidjson::$
    #9 0x0000000000526b12 rapidjson::GenericValue<rapidjson::UTF8<char>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::FindMember(char const*) /root/.deploy/ccls/third_party/rapidjson/include/rapidjson/document.h:1231:28
    #10 0x00000000005cf2af ccls::JsonReader::Member(char const*, std::function<void ()>) /root/.deploy/ccls/src/serializer.cc:54:13
    #11 0x00000000004ccab3 void ccls::ReflectMember<std::string>(ccls::JsonReader&, char const*, std::string&) /root/.deploy/ccls/src/serializer.hh:389:3
    #12 0x00000000004cbae3 void ccls::Reflect<ccls::JsonReader>(ccls::JsonReader&, ccls::Config&) /root/.deploy/ccls/src/config.hh:359:1
    #13 0x000000000063fd6e void ccls::ReflectMember<ccls::Config>(ccls::JsonReader&, char const*, ccls::Config&)::'lambda'()::operator()() const /root/.deploy/ccls/src/serializer.hh:389:3
    #14 0x0000000000640429 std::_Function_handler<void (), void ccls::ReflectMember<ccls::Config>(ccls::JsonReader&, char const*, ccls::Config&)::'lambda'()>::_M_invoke(std::_Any_data const&) /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/std_function.h:299:7
    #15 0x00000000005d3f10 std::function<void ()>::operator()() const /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/std_function.h:687:71
    #16 0x00000000005cf31d ccls::JsonReader::Member(char const*, std::function<void ()>) /root/.deploy/ccls/src/serializer.cc:58:7
    #17 0x000000000063fdc3 void ccls::ReflectMember<ccls::Config>(ccls::JsonReader&, char const*, ccls::Config&) /root/.deploy/ccls/src/serializer.hh:389:3
    #18 0x0000000000638ea5 void ccls::(anonymous namespace)::Reflect<ccls::JsonReader>(ccls::JsonReader&, ccls::(anonymous namespace)::InitializeParam&) /root/.deploy/ccls/src/messages/initialize.cc:229:1
    #19 0x0000000000638597 ccls::MessageHandler::initialize(ccls::JsonReader&, ccls::ReplyOnce&) /root/.deploy/ccls/src/messages/initialize.cc:398:14
    #20 0x0000000000519cd5 ccls::MessageHandler::Bind(char const*, void (ccls::MessageHandler::*)(ccls::JsonReader&, ccls::ReplyOnce&))::'lambda'(ccls::JsonReader&, ccls::ReplyOnce&)::operator()(ccls::JsonReader&, ccls::ReplyOnce&) const /root/.deploy/ccls/src/message_handle$
    #21 0x000000000051e24b std::_Function_handler<void (ccls::JsonReader&, ccls::ReplyOnce&), ccls::MessageHandler::Bind(char const*, void (ccls::MessageHandler::*)(ccls::JsonReader&, ccls::ReplyOnce&))::'lambda'(ccls::JsonReader&, ccls::ReplyOnce&)>::_M_invoke(std::_Any_dat$
    #22 0x0000000000526d5d std::function<void (ccls::JsonReader&, ccls::ReplyOnce&)>::operator()(ccls::JsonReader&, ccls::ReplyOnce&) const /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/std_function.h:687:71
    #23 0x000000000051a7d1 ccls::MessageHandler::Run(ccls::InMessage&) /root/.deploy/ccls/src/message_handler.cc:223:19
    #24 0x0000000000544a56 ccls::pipeline::MainLoop() /root/.deploy/ccls/src/pipeline.cc:660:31
    #25 0x00000000004c8a46 main /root/.deploy/ccls/src/main.cc:163:10
    #26 0x00007f57450d93d5 __libc_start_main (/lib64/libc.so.6+0x223d5)
    #27 0x00000000004b8b95 _start (/root/.deploy/ccls/Debug/ccls+0x4b8b95)
    
    Process ccls stderr finished
    

    Expected behavior

    ccls run without exist.

    Steps to reproduce

    1. git clone https://github.com/hlissner/doom-emacs ~/.emacs.d -b develop (commit ab616cfb95a1)
    2. init.el enable lsp and (cc +lsp)
    3. open any c file

    System information

    • ccls version (git describe --tags --long): 0.20190314-0-g1976fec
    • clang version: clang version 7.0.1 (tags/RELEASE_701/final)
    • OS: Centos 7.6 3.10.0-957.10.1.el7.x86_64
    • Editor: GNU Emacs 26.1
    • Language client (and version): ccls-20190225.1410
    build 
    opened by ethercflow 21
  • Error occur during linking.

    Error occur during linking.

    OS: Archlinux With testing on and all up to date llvm packages and version:

    local/clang-compiler-rt-svn 7.0.0svn_r334049-1 (llvm-toolchain-svn)
        The "compiler-rt" set of runtime libraries for Clang and LLVM
    local/clang-svn 7.0.0svn_r334049-1 (llvm-toolchain-svn)
        C language family frontend for LLVM
    local/clang-tools-extra-svn 7.0.0svn_r334049-1 (llvm-toolchain-svn)
        Standalone tools for Clang: syntax checking, formatting, refactoring, etc.
    local/lib32-llvm-libs 6.0.0-1
        Low Level Virtual Machine (runtime library)(32-bit)
    local/lld-svn 7.0.0svn_r334049-1 (llvm-toolchain-svn)
        A linker from the LLVM project
    local/llvm-libs-svn 7.0.0svn_r334049-1 (llvm-toolchain-svn)
        The LLVM Compiler Infrastructure (runtime libraries)
    local/llvm-svn 7.0.0svn_r334049-1 (llvm-toolchain-svn)
        The LLVM Compiler Infrastructure
    

    When I installing ccls-git from aur, the error below occurred.

    [100%] Linking CXX executable ccls
    /usr/bin/ld: 找不到 -lLLVM_LIBRARY-NOTFOUND
    collect2: 错误:ld 返回 1
    make[2]: *** [CMakeFiles/ccls.dir/build.make:964:ccls] 错误 1
    make[1]: *** [CMakeFiles/Makefile2:68:CMakeFiles/ccls.dir/all] 错误 2
    make: *** [Makefile:130:all] 错误 2
    

    I don't know what to do now. :(

    duplicate 
    opened by ZWindL 18
  • How to install?????

    How to install?????

    The instructions are very confusing. I am trying to build and install on windows. I have installed cmake and llvm (via chocolaty), and then I ran "cmake --build . --config Release --target install". Output: Error: could not load cache

    What am I doing wrong?

    opened by pianocomposer321 17
  • link error to LLVMSupport

    link error to LLVMSupport

    CMakeFiles/ccls.dir/src/main.cc.o: In function `OptionValue':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:575: undefined reference to `vtable for llvm::cl::OptionValue<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `opt<char [5], llvm::cl::desc>':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:1359: undefined reference to `vtable for llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `parser':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:1028: undefined reference to `vtable for llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `OptionValue':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:575: undefined reference to `vtable for llvm::cl::OptionValue<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `opt<char [9], llvm::cl::desc, llvm::cl::value_desc>':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:1359: undefined reference to `vtable for llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `parser':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:1028: undefined reference to `vtable for llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `OptionValue':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:575: undefined reference to `vtable for llvm::cl::OptionValue<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `opt<char [16], llvm::cl::desc, llvm::cl::value_desc>':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:1359: undefined reference to `vtable for llvm::cl::opt<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, false, llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >'
    CMakeFiles/ccls.dir/src/main.cc.o: In function `parser':
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:1028: undefined reference to `vtable for llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
    /home/shc/code/repos/ccls/build/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/include/llvm/Support/CommandLine.h:1028: undefined reference to `vtable for llvm::cl::parser<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >'
    clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
    

    Is the bundled LLVM not compiled with c++11?

    build 
    opened by scturtle 17
  • Completion overwriting word

    Completion overwriting word

    Observed behavior

    I'm not quite sure where this is configured or what it stems from, but if I switch to clangd the behavior is as expected. Also not sure if this is something people generally want and I'm weird for reporting it, but here goes: When selecting a completion, the selected completion overwrites the current word my cursor is on. Screenshot_20200725_100912 Screenshot_20200725_100935 Screenshot_20200725_100951

    Expected behavior

    Insert the completion candidate, rather than overwriting the word at the cursor.

    Steps to reproduce

    1. Go to any word
    2. Type and select a completion option

    System information

    ccls version 0.20190823.6-22-gcb08df44 clang version 10.0.0

    • OS: Arch Linux (Linux Office-Arch 5.7.9-arch1-1 #1 SMP PREEMPT Thu, 16 Jul 2020 19:34:49 +0000 x86_64 GNU/Linux)
    • Editor: Emacs
    • Language client (and version): lsp-mode (Not sure where the version is, I use straight.el, so here's the last commit in the repo)
    lsp-mode: git log
    commit 41ba941797f5c0cb9b251af5ea37922595d772bc (HEAD -> master, origin/master, origin/HEAD)
    Author: kiennq <[email protected]>
    Date:   Fri Jul 24 18:42:10 2020 +0900
    
        type-formatting: do best effort async text edits applying (#1959)
    
    enhancement 
    opened by nickenchev 16
  • Can't find Clang::Clang on Raspberry Pi

    Can't find Clang::Clang on Raspberry Pi

    Hi, I try to build ccls on the Raspberry Pi platform (its OS is a Debian derivation) with the following package installed: sudo apt-get install clang libclang-dev libclang1 llvm llvm-dev clang-tools

    But run into error:

    $cmake -H.. -BRelease -DSYSTEM_CLANG=ON
    -- The CXX compiler identification is GNU 6.3.0
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Setting build type to 'Release' as none was specified.
    -- Using system Clang
    -- Could NOT find Clang (missing:  Clang_LIBRARY Clang_INCLUDE_DIR) (found suitable version "6.0.1", minimum required is "6.0.0")
    -- Looking for C++ include pthread.h
    -- Looking for C++ include pthread.h - found
    -- Looking for pthread_create
    -- Looking for pthread_create - not found
    -- Check if compiler accepts -pthread
    -- Check if compiler accepts -pthread - yes
    -- Found Threads: TRUE  
    -- Configuring done
    CMake Error at CMakeLists.txt:18 (add_executable):
      Target "ccls" links to target "Clang::Clang" but the target was not found.
      Perhaps a find_package() call is missing for an IMPORTED target, or an
      ALIAS target is missing?
    
    
    CMake Error in CMakeLists.txt:
      Target "ccls" requires the language dialect "CXX17" , but CMake does not
      know the compile flags to use to enable it.
    
    
    -- Generating done
    -- Build files have been written to: /home/pi/projects/ccls/build/Release
    

    I referred the build wiki, and checked some required file on my system:

    /usr/lib/llvm-6.0/include/clang/Config/config.h
    /usr/lib/llvm-6.0/lib/libclangIndex.a
    /usr/lib/llvm-6.0/lib/libclang.so
    $ clang -print-resource-dir
    /usr/lib/llvm-6.0/lib/clang/6.0.1
    

    How can I solve it? Thanks!

    opened by zhongweiy 16
  • Enhancement: idea to allow defering full indexing?

    Enhancement: idea to allow defering full indexing?

    Because full indexing of my projects takes a long time and a lot of CPU, and because I create and delete a number of worktrees quickly where I make smaller, superficial changes that don't need to be fully indexed, I'm looking for ways to reduce or defer indexing until it's needed. I understand that in this mode queries that rely on global reference information will be missing or incomplete.

    I'm aware of initialBlacklist, which is very useful in some situations, but was thinking about something more specifically targeted at this problem.

    An idea would be for a new configuration option introducing a "distance" parameter. If the distance value is 0 (the default), then all files in the project are indexed. If the value is 1, then only the file which is visited by the editor would be indexed (equivalent to blacklisting all files, if I understand that behavior correctly). If the value is 2, then when a file is visited that file plus files one "distance" removed from that file are indexed. Etc.

    By "distance" I mean a logical proximity to the visited file. I would define this as "the source files that define the declarations in a header file included by the original source file". So for example if we visit a file foo.c and it includes a file bar.h which declares classes or functions and those classes or functions are defined/implemented in a file bar.c, then bar.c is one "distance" removed from foo.c. If bar.c includes blah.h and blah.h declares classes or functions which are defined in blah.c, then blah.c is one "distance" removed from bar.c and two "distances" removed from foo.c.

    Of course there's no way to be sure, based on the current information available (without indexing!!), which source file defines the classes or functions declared in a given header file. However, I think it's a reasonable heuristic to use file names. Almost every project of any significant size (that would need to worry about reduced indexing) follows a convention that a file xyzzy.c (or xyzzy.cpp or xyzzy.cc) defines the classes / functions declared in xyzzy.h (or xyzzy.hpp).

    So then, the algorithm for this parameter would be something like:

    1. server receives a request for a new source file X
    2. set sources to [X]
    3. for (i = distance; i > 0; --i):
      • set newsources to []
      • for each file in sources:
        • index file
        • for each header found while indexing file, check to see if it has a corresponding source file (by name) which hasn't been indexed. if so, add to newsources
      • set sources to newsources

    The check for source file could be as simple as: chop the path and extension (after the final .) to get base then add all files found in the project named base plus a list of source extensions (.c, .cpp, .cc). If we index a few too many files it's not a big deal, and most projects won't have the same base name file multiple times anyway as it's confusing for developers (and some build systems!)

    Setting "distance" to "2" using this algorithm should be sufficient to allow "jump to definition" capability for any symbol in a file we visit, without requiring the full project to be indexed up-front. At least, for development environments following the most common organizational models. It wouldn't allow accurate "list all callers of this method"-style capability of course, unless you used "distance 0" (or otherwise caused everything to be indexed).

    opened by madscientist 15
  • Macro redefinition error inside header stops whole compilation

    Macro redefinition error inside header stops whole compilation

    UPD: My project uses warnings intensively: -Wall -Wextra -Werror=multichar -Wno-deprecated -Wno-unused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Werror -std=gnu++11 -Wno-unknown-pragmas.

    I see macro redefinition error in many c++ files despite project compiles successfully. This error stops compilation on the point of error and autocompletion becomes too limited. The error is in some deep nested boost header, there is macro redefinition (compile command contains -D for that macro). After this error takes place whole compilation stops.

    ORIGINAL COMMENT: I switched from c3b4b7f75f19aea16e03992a81f283ab5ac2b84e to 1111, since I get a lot of warnings in my project:

    • size_t not found
    • set, string, vector not found in std
    • tons of others
    opened by Yanpas 15
  • Triggering autocompletion in a `.h` header file that is considered as c++-header doesn't work (cross compiling for arm Infinitime project)

    Triggering autocompletion in a `.h` header file that is considered as c++-header doesn't work (cross compiling for arm Infinitime project)

    Here are some things you should try before filing a bug report:

    • For client issues related to emacs-ccls or vscode-ccls, report in their own repository.
    • For build problems, check https://github.com/MaskRay/ccls/wiki/Build
    • Check https://github.com/MaskRay/ccls/wiki/Debugging
    • Check the FAQ to see if your issue is mentioned.

    If none of those help, remove this section and fill out the four sections in the template below.


    Observed behavior

    triggering autocompletion in a .h header file that is considered as c++-header doesn't work, running ccls in vscode crosscompiling with arm, in Infinitime project, here is a gitpod setup: https://gitpod.io/#https://github.com/FederAndInk/InfiniTime/tree/feature/ccls

    • the .ccls:
    %compile_commands.json
    --target=arm-none-eabi
    --gcc-toolchain=/opt/gcc-arm-none-eabi-9-2020-q2-update
    %h -x
    %h c++-header
    %c -std=c99
    %cpp -std=c++14
    %h %hpp
    -isystem/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/include/c++/9.3.1
    -isystem/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/include/c++/9.3.1/arm-none-eabi
    -isystem/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/include/c++/9.3.1/backward
    -isystem/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/include
    -isystem/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/include-fixed
    -isystem/opt/gcc-arm-none-eabi-9-2020-q2-update/bin/../lib/gcc/arm-none-eabi/9.3.1/../../../../arm-none-eabi/include
    
    • Reduce to A minimal set of .c .cc .h .hh files that can still demonstrate the issue.

    open the src/displayapp/TouchEvents.h file and try ctrl+space to trigger autocompletion

    • Consider a screencast gif. Screenshot_20220510_000920

    ccls logs:

    22:22:38 stdin            pipeline.cc:571 V(2) receive RequestMessage: 2 $ccls/info
    22:22:38 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 2
    22:22:40 stdin            pipeline.cc:571 V(2) receive RequestMessage: 3 $ccls/info
    22:22:40 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 3
    22:22:42 stdin            pipeline.cc:573 V(2) receive NotificationMessage textDocument/didOpen
    22:22:42 ccls             pipeline.cc:849 V(2) NotificationMessage: $ccls/publishSkippedRanges
    22:22:42 ccls             pipeline.cc:849 V(2) NotificationMessage: $ccls/publishSemanticHighlight
    22:22:42 preamble     sema_manager.cc:779 I create session for /workspace/InfiniTime/src/displayapp/TouchEvents.h
      /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc --sysroot=/opt/gcc-arm-none-eabi-9-2020-q2-update/bin -DBOARD_PCA10040 -DCONFIG_GPIO_AS_PINRESET -DFREERTOS -DNIMBLE_CFG_CONTROLLER -DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_12 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_31 -DNRF52_PAN_36 -DNRF52_PAN_51 -DNRF52_PAN_54 -DNRF52_PAN_55 -DNRF52_PAN_58 -DNRF52_PAN_64 -DNRF52_PAN_74 -DOS_CPUTIME_FREQ -DQCBOR_DISABLE_EXP_AND_MANTISSA -DQCBOR_DISABLE_FLOAT_HW_USE -DQCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS -DQCBOR_DISABLE_PREFERRED_FLOAT -DQCBOR_DISABLE_UNCOMMON_TAGS -DUSEFULBUF_CONFIG_LITTLE_ENDIAN -D__HEAP_SIZE=4096 -D__STACK_SIZE=1024 -I/workspace/InfiniTime/build/src -I/workspace/InfiniTime/src/libs -I/workspace/InfiniTime/src/FreeRTOS -I/workspace/InfiniTime/src/libs/date/includes -I/workspace/InfiniTime/src/libs/mynewt-nimble/porting/npl/freertos/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/porting/nimble/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/controller/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/transport/ram/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/drivers/nrf52/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/ext/tinycrypt/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/services/gap/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/services/gatt/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/util/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/store/ram/include -I/opt/nRF5_SDK_15.3.0_59ac345/components/drivers_nrf/nrf_soc_nosd -I/opt/nRF5_SDK_15.3.0_59ac345/components -I/opt/nRF5_SDK_15.3.0_59ac345/components/boards -I/opt/nRF5_SDK_15.3.0_59ac345/components/softdevice/common -I/opt/nRF5_SDK_15.3.0_59ac345/integration/nrfx -I/opt/nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx/drivers/include -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx/hal -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx/mdk -I/opt/nRF5_SDK_15.3.0_59ac345/external/freertos/source/include -I/opt/nRF5_SDK_15.3.0_59ac345/components/toolchain/cmsis/include -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/atomic -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/atomic_fifo -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/atomic_flags -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/balloc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/bootloader/ble_dfu -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/cli -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/crc16 -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/crc32 -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/crypto -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/csense -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/csense_drv -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/delay -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/ecc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_section_vars -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_task_manager -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/fds -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/fstorage -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/gfx -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/gpiote -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/hardfault -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/hci -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/led_softblink -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/log -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/log/src -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/low_power_pwm -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/mem_manager -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/memobj -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/mpu -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/mutex -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/pwm -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/pwr_mgmt -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/queue -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/ringbuf -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/scheduler -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/sdcard -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/slip -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/sortlist -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/spi_mngr -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/stack_guard -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/strerror -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/svc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/timer -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/audio -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/cdc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/cdc/acm -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid/generic -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid/kbd -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid/mouse -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/msc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/util -I/opt/nRF5_SDK_15.3.0_59ac345/external/segger_rtt -I/opt/nRF5_SDK_15.3.0_59ac345/external/fprintf -I/opt/nRF5_SDK_15.3.0_59ac345/external/thedotfactory_fonts -isystem /workspace/InfiniTime/src/. -isystem /workspace/InfiniTime/src/.. -isystem /workspace/InfiniTime/src/libs/QCBOR/inc -g -mthumb -mabi=aapcs -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -ftree-vrp -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wreturn-type -Werror=return-type -fstack-usage -fno-exceptions -fno-non-call-exceptions -Wformat -Og -std=c99 -o CMakeFiles/pinetime-app.dir/displayapp/lv_pinetime_theme.c.o -c /workspace/InfiniTime/src/displayapp/lv_pinetime_theme.c --target=arm-none-eabi --gcc-toolchain=/opt/gcc-arm-none-eabi-9-2020-q2-update -x c++-header -std=c99 %hpp -Wall -Wextra -working-directory=/workspace/InfiniTime/build/src
    22:22:42 stdin            pipeline.cc:571 V(2) receive RequestMessage: 4 textDocument/codeAction
    22:22:42 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 4
    22:22:42 stdin            pipeline.cc:571 V(2) receive RequestMessage: 5 textDocument/documentSymbol
    22:22:42 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 5
    22:22:42 indexer10        pipeline.cc:386 I parse /workspace/InfiniTime/src/displayapp/TouchEvents.h
      /opt/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc --sysroot=/opt/gcc-arm-none-eabi-9-2020-q2-update/bin -DBOARD_PCA10040 -DCONFIG_GPIO_AS_PINRESET -DFREERTOS -DNIMBLE_CFG_CONTROLLER -DNRF52 -DNRF52832 -DNRF52832_XXAA -DNRF52_PAN_12 -DNRF52_PAN_15 -DNRF52_PAN_20 -DNRF52_PAN_31 -DNRF52_PAN_36 -DNRF52_PAN_51 -DNRF52_PAN_54 -DNRF52_PAN_55 -DNRF52_PAN_58 -DNRF52_PAN_64 -DNRF52_PAN_74 -DOS_CPUTIME_FREQ -DQCBOR_DISABLE_EXP_AND_MANTISSA -DQCBOR_DISABLE_FLOAT_HW_USE -DQCBOR_DISABLE_INDEFINITE_LENGTH_STRINGS -DQCBOR_DISABLE_PREFERRED_FLOAT -DQCBOR_DISABLE_UNCOMMON_TAGS -DUSEFULBUF_CONFIG_LITTLE_ENDIAN -D__HEAP_SIZE=4096 -D__STACK_SIZE=1024 -I/workspace/InfiniTime/build/src -I/workspace/InfiniTime/src/libs -I/workspace/InfiniTime/src/FreeRTOS -I/workspace/InfiniTime/src/libs/date/includes -I/workspace/InfiniTime/src/libs/mynewt-nimble/porting/npl/freertos/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/porting/nimble/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/controller/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/transport/ram/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/drivers/nrf52/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/ext/tinycrypt/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/services/gap/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/services/gatt/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/util/include -I/workspace/InfiniTime/src/libs/mynewt-nimble/nimble/host/store/ram/include -I/opt/nRF5_SDK_15.3.0_59ac345/components/drivers_nrf/nrf_soc_nosd -I/opt/nRF5_SDK_15.3.0_59ac345/components -I/opt/nRF5_SDK_15.3.0_59ac345/components/boards -I/opt/nRF5_SDK_15.3.0_59ac345/components/softdevice/common -I/opt/nRF5_SDK_15.3.0_59ac345/integration/nrfx -I/opt/nRF5_SDK_15.3.0_59ac345/integration/nrfx/legacy -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx/drivers/include -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx/hal -I/opt/nRF5_SDK_15.3.0_59ac345/modules/nrfx/mdk -I/opt/nRF5_SDK_15.3.0_59ac345/external/freertos/source/include -I/opt/nRF5_SDK_15.3.0_59ac345/components/toolchain/cmsis/include -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/atomic -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/atomic_fifo -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/atomic_flags -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/balloc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/bootloader/ble_dfu -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/cli -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/crc16 -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/crc32 -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/crypto -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/csense -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/csense_drv -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/delay -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/ecc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_section_vars -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/experimental_task_manager -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/fds -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/fstorage -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/gfx -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/gpiote -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/hardfault -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/hci -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/led_softblink -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/log -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/log/src -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/low_power_pwm -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/mem_manager -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/memobj -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/mpu -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/mutex -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/pwm -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/pwr_mgmt -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/queue -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/ringbuf -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/scheduler -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/sdcard -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/slip -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/sortlist -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/spi_mngr -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/stack_guard -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/strerror -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/svc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/timer -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/audio -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/cdc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/cdc/acm -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid/generic -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid/kbd -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/hid/mouse -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/usbd/class/msc -I/opt/nRF5_SDK_15.3.0_59ac345/components/libraries/util -I/opt/nRF5_SDK_15.3.0_59ac345/external/segger_rtt -I/opt/nRF5_SDK_15.3.0_59ac345/external/fprintf -I/opt/nRF5_SDK_15.3.0_59ac345/external/thedotfactory_fonts -isystem /workspace/InfiniTime/src/. -isystem /workspace/InfiniTime/src/.. -isystem /workspace/InfiniTime/src/libs/QCBOR/inc -g -mthumb -mabi=aapcs -Wall -Wextra -Warray-bounds=2 -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wformat-nonliteral -ftree-vrp -Wno-unused-parameter -Wno-missing-field-initializers -Wno-unknown-pragmas -Wno-expansion-to-defined -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wreturn-type -Werror=return-type -fstack-usage -fno-exceptions -fno-non-call-exceptions -Wformat -Og -std=c99 -o CMakeFiles/pinetime-app.dir/displayapp/lv_pinetime_theme.c.o -c /workspace/InfiniTime/src/displayapp/lv_pinetime_theme.c --target=arm-none-eabi --gcc-toolchain=/opt/gcc-arm-none-eabi-9-2020-q2-update -x c++-header -std=c99 %hpp -Wall -Wextra -working-directory=/workspace/InfiniTime/build/src
    
    22:22:49 stdin            pipeline.cc:571 V(2) receive RequestMessage: 18 textDocument/hover
    22:22:49 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 18
    22:22:50 stdin            pipeline.cc:571 V(2) receive RequestMessage: 19 $ccls/info
    22:22:50 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 19
    22:22:50 stdin            pipeline.cc:571 V(2) receive RequestMessage: 20 textDocument/completion
    22:22:52 stdin            pipeline.cc:571 V(2) receive RequestMessage: 21 $ccls/info
    22:22:52 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 21
    22:22:54 stdin            pipeline.cc:571 V(2) receive RequestMessage: 22 $ccls/info
    22:22:54 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 22
    22:22:56 stdin            pipeline.cc:571 V(2) receive RequestMessage: 23 $ccls/info
    22:22:56 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 23
    22:22:58 stdin            pipeline.cc:571 V(2) receive RequestMessage: 24 $ccls/info
    22:22:58 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 24
    22:23:00 stdin            pipeline.cc:571 V(2) receive RequestMessage: 25 $ccls/info
    22:23:00 ccls             pipeline.cc:878 V(2) respond to RequestMessage: 25
    22:23:02 stdin            pipeline.cc:571 V(2) receive RequestMessage: 26 $ccls/info
    

    we can see the receive RequestMessage: 20 textDocument/completion but no response.

    Expected behavior

    Autocompletion working

    Steps to reproduce

    1. open the gitpod: https://gitpod.io/#https://github.com/FederAndInk/InfiniTime/tree/feature/ccls
    2. install ccls and CMake Tools extensions
    3. open .vscode/cmake-variants.json file and hit ctrl+S to update the cmake extension (bug with the cmake extension)
    4. hit F1 and CMake: configure (select gcc and Debug OpenOCD No DFU)
    5. open the src/displayapp/TouchEvents.h file and try ctrl+space to trigger autocompletion

    System information

    • ccls version (git describe --tags --long): 0.20210330-12-g74458915
    • clang version: Ubuntu clang version 15.0.0-++20220509052941+3f64f0328941-1~exp1~20220509173041.246
    • OS: Ubuntu 20.04.4 LTS
    • Editor: vscode 1.67.0
    • Language client (and version): v0.1.29
    opened by FederAndInk 0
  • ccls jumps to definitions outside of translation unit with compile_commands.json present

    ccls jumps to definitions outside of translation unit with compile_commands.json present

    Observed behavior

    When multiple files (here .cpp files) are present and are mentioned in the compile_commands.json file, the `go-to-definition´ will jump into files with objects with equal name (tested here with classes), even though they are completely separate.

    Minimal testcase

    create a directory called test_case with the following files:

    CMakeLists.txt

    cmake_minimum_required(VERSION 3.23)
    
    set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
    
    add_executable(file1
        file1.cpp
        )
    add_executable(file2
        file2.cpp
        )
    set_target_properties(
       file1
       file2
       PROPERTIES
       FOLDER "test_case"
       )
    

    file1.cpp

    class A {};
    
    int main() {
      A a;
    }
    

    file2.cpp

    class A {};
    

    Compile with cmake . to get the compile_commands.json.

    Expected behavior

    When jumping from A a via the go to definition, I would expect it to only jump to the above declaration of the class. However for me (using neovim + native LSP), it opens a quickfix list with both files. Clangd on the other hand only jumps to the declaration in the same file (in my opinion the expected behaviour).

    Deleting the entry with file2 in the compile_commands.json gives the expected behaviour.

    System information

    • ccls version 0.20210330-12-g74458915
    • clang version: 13.0.1
    • OS: Arch Linux
    • Editor: NVIM v0.8.0-dev+41-g2caf5bbbc
    • Language client (and version):
    opened by jhossbach 0
  • Comparison with clangd

    Comparison with clangd

    As far as I understand there are currently only 2 state-of-the-art LSP servers for C/C++: ccls and clangd. Back then, when cquery development stalled and ccls emerged, it was clearly much more robust than clangd (e.g. had proper whole codebase index) so there was no doubt for one who wanted to choose most functional C/C++ server for his project.

    But since then clangd advanced a lot and today is pretty comparable to ccls in terms of functionality and robustness (IMO). I believe the community of C++ users will greatly benefit from having an unbiased comparison between these two great LSP servers. Some examples of areas to compare in:

    • Language features support (standard revision, particular "complex" features of C++ etc)
    • LSP protocol support, also protocol extensions.
    • Differences in editor-specific extensions.
    • Performance difference (parsing in both is done by libclang, but for example index implementations are different).

    @MaskRay do you track clangd progress and can share any information on that? Do you see a point in such comparison at all?

    PS. Sorry for posting it here, "discussions" page for ccls repo is disabled. Will gladly move this discussion to more appropriate place.

    opened by sergei-dyshel 2
  • [Request]: New tagged release for distributions packaging LLVM 14

    [Request]: New tagged release for distributions packaging LLVM 14

    Hey there, I'm one of the maintainers of Termux project which maintains ports for common UNIX utilities and also much of widely needed Linux software for Android platform. We have recently updated LLVM to 14.0.0, and as a part of our LLVM 14 transition, we are rebuilding packages depending on llvm.

    The latest tagged version of ccls (0.20210330) doesn't build with LLVM 14, I was however able to build locally ccls from the master branch. It would be great if a new release can be made available so that distributions which package ccls can update it with ease!

    opened by thunder-coding 0
  • Using MSVC with ccls

    Using MSVC with ccls

    Observed behavior

    Hi. I'm trying to use msvc with ccls but ccls keeps using clang for parsing the files. This causes my editor to show an error even though my code compiles fine with msvc.

    My .ccls file:

    cl
    %c -std=c11
    %cpp -std=c++2a
    %h -x
    %h c++-header
    -wd4201
    -wd4100
    -wd4505
    -wd4189
    -wd4146
    -wd4127
    -wd4312
    -wd4239
    -IE:\Tools\glfw\include\GLFW
    -IE:\Tools\glad\include
    

    The code that's causing the problem:

    struct Vector3
    {
        float x, y, z;
        Vector3( float x, float y, float z )
        {
            this->x = x;
            this->y = y;
            this->z = z;
        }
    };
    inline Vector3 operator-( Vector3 &a, Vector3 &b )
    {
        return Vector3( a.x - b.x, a.y - b.y, a.z - b.z );
    }
    
    inline Vector3 operator*( Vector3 &v, float s )
    {
        return Vector3( v.x * s, v.y * s, v.z * s );
    }
    
    inline float Dot( Vector3 &a, Vector3 &b )
    {
        return a.x * b.x + a.y * b.y + a.z * b.z;
    }
    
    inline Vector3 Reject( Vector3 &a, Vector3 &b )
    {
        return a - b * ( Dot( a, b ) / Dot( b, b ) ); // the error is here: invalid operands to binary expression ('Vector3' and 'Vector3')
    }
    

    The command I'm using to compile the code:

    @echo off
    
    if not exist build mkdir build
    
    set compiler_args=^
    -MTd ^
    -nologo ^
    -GR- ^
    -EHa ^
    -Od -Oi ^
    -WX -W4 ^
    -FC ^
    -Zi ^
    -diagnostics:caret ^
    -wd4201 ^
    -wd4100 ^
    -wd4505 ^
    -wd4189 ^
    -wd4146 ^
    -wd4127 ^
    -wd4312 ^
    -wd4239 ^
    -IE:\Tools\glfw\include\GLFW ^
    -IE:\Tools\glad\include ^
    
    set linker_args=^
    E:\Tools\glfw\build\src\Debug\glfw3.lib ^
    user32.lib gdi32.lib shell32.lib opengl32.lib
    
    pushd build
    
    cl %compiler_args% ..\src\main.cpp /link %linker_args%
    
    popd
    

    Expected behavior

    The error isn't shown in the editor.

    Steps to reproduce

    Paste the code to a cpp file and let ccls parse it using the .ccls file.

    System information

    • ccls version (git describe --tags --long): The command shows fatal: No names found, cannot describe anything. but I cloned the repo today with the latest commit being 790daca
    • clang version: 11.1.0
    • OS: Windows 11
    • Editor: Neovide with neovim v0.7.0
    • Language client (and version): nvim lsp
    opened by OrangeLightning219 0
  • Permanent

    Permanent "not indexed" error with Clang 12 and above

    Observed behavior

    Everything works great when I compile ccls against versions of Clang up to and including 11.1.0.

    When I compile ccls against anything newer (well, tested with 12.0 and 14.0), and no other changes at all just a different clang, then I get nothing: all I see in my LSP client is "not indexed". LSP mode shows in the minibuffer:

    LSP :: Error from the Language Server: not indexed (Invalid Request)
    

    I've enabled --log-file=ccls.out -v=9 and looked at the log file and there is absolutely nothing odd there: no error messages or warnings or anything.

    I've enabled client logging on the Emacs LSP mode and all I ever get back from ccls is:

    [Trace - 02:03:46 PM] Received response 'nil - (22)' in 999ms.
    Result: {
      "message": "not indexed",
      "code": -32600
    }
    
    [Trace - 02:03:46 PM] Received response 'textDocument/documentHighlight - (23)' in 31ms.
    Result: {
      "message": "not indexed",
      "code": -32600
    }
    

    It appears that indexing never proceeds or succeeds, but there's absolutely nothing that I can find in any logging that would explain why or how to fix it.

    Also, no files are ever created in the .ccls-cache directory!

    Steps to reproduce

    I doubt it's reproducible outside my environment, unless others also have problems using Clang 12+.

    What I really need is some kind of pointer that allows me to get more debugging or figure out why the indexing just never seems to do anything. Is there a way to compile ccls with more debugging output?

    System information

    • ccls version: 0.20210330-11-g790daca4
    • clang version: clang 12.0, clang 14.0
    • OS: GNU/Linux
    • Editor: Emacs 27.2
    • Language client (and version): Emacs lsp-mode 20220401.1003 (but have tried various) and ccls-20200820.308
    opened by madscientist 1
Releases(0.20210330)
  • 0.20210330(Apr 6, 2021)

  • 0.20201219(Oct 25, 2020)

    This release supports Clang 7~11.

    LSP

    • Support 3.15.0 serverInfo
    • Report index status via $/progress (WorkDoneProgressBegin/WorkDoneProgressReport/WorkDoneProgressEnd)

    Project

    • Better recursive .ccls files

    Misc

    • New initialization option completion.placeholder: change client.snippetSupport: false to drop ( and < #412
    • Infer -target and --driver-mode from argv[0] #511
    • Support CMake variable CLANG_LINK_CLANG_DYLIB (some distributions use this to provide libclang-cpp.so instead of libclang*.a or libclang*.so. This option is needed to link against libclang-cpp.so)
    • textDocument/documentSymbol: support unopened files #548
    • Disable PCH reading (the Clang library ccls links against may be different from the compiler. The compiler generated PCH files may cause ccls to error due to mismatching PCH versions)
    • indexer: log the number of errors and the first diagnostic
    • indexer: set the kind of static data members to Field instead of Var #593
    • Support workspace as a symlink and symlinks with workspace #639
    Source code(tar.gz)
    Source code(zip)
  • 0.20190314.4(Apr 22, 2020)

    0.20190823.6 is newer than this one!

    Building ccls requires at least clang 7. Support for Clang 6 was dropped. This release supports Clang 7, 8 and 9.

    -DSYSTEM_CLANG=on should not be used. clang/llvm auto-download mechanism was deleted.

    -DUSE_SYSTEM_RAPIDJSON=on is the default: use system rapidjson (instead of git submodule) if available.

    -DLLVM_ENABLE_RTTI= and -DUSE_SHARED_LLVM= should not be used. Since #313, LLVMConfig.cmake ClangConfig.cmake are consulted to set sane values for the two variables.

    Customization

    • New initialization option index.maxInitializerLines. Made some ServerCapabilities toggable.
    • Initialization option cacheDirectory was renamed to cache.directory #278
    • New initialization option cache.hierarchicalPath to work around NAME_MAX limitation: store cache files as $directory/a/b/c.cc.blob instead of $directory/[email protected]@c.cc.blob #278
    • New initialization option cache.retainInMemory: 2: change to 1 to avoid cache corruption if the index file is changed after the initial load, which may happen if several language clients open the same project and share the same cache directory #278
    • -log-file=stderr is the default #219
    • Initialization option `compilationDatabaseCommand** works on Windows #220

    Completion

    • Enable documentation for signatureHelp
    • Workaround for VSCode completion result sorting #210
    • Rebuild preamble if its size changes #190

    Index

    • Support some unhandled Decl::Kind
    • Index TemplateTypeParmDecl and ParmVarDecl in declarations for clang >= 9
    • Line numbers can be 0~65535 (was: 0~32767)
    • Support multi-byte UTF-8 characters #268
    • Decreased memory usage: "Change containers of Query*::Def fields from std::vector to ccls::Vec"
    • New initialization option index.initialNoLinkage: false: by default, the background indexer doesn't handle names of no linkage. This saves a lot of memory.

    Others

    • Make textDocument/hover more detailed: When hovering on a class, ccls tries hard to get the definition and displays struct D : B {}. It may display a forward declaration struct D before.
    • Normalize end-of-line sequences #293
    • Log {Request,Notification}Message, and timestamp change due to dependency
    • textDocument/rename: mitigate edits in the same place and edits in macro replacement #296
    • Use DiagnosticRelatedInformation in clients that support it #276
    • In textDocument/documentSymbol, override declaration's range/selectionRange with definition's #309
    • Better support when the workspace folder is a symlink #314
    Source code(tar.gz)
    Source code(zip)
  • 0.20181225.10(Dec 25, 2018)

    • workspace/didChangeWatchedFiles works (tested on VSCode and coc.nvim) and file deletion will remove index symbols
    • .ccls enhancement #171 added new directives %compile_commands.json %h %hpp %objective-c %objective-cpp
    • -v=1 dumps command line options of files for parsing
    • fuzzy_match: when the completion filter begins with a letter, builtin macros prefixed with an underscore will not be returned
    • Support textDocument/declaration and LocationLink[] return types.
    • Properly handle "exit" #159
    • Support signatureHelp.signatureInformationparameterInformation.labelOffsetSupport cf. https://github.com/Microsoft/language-server-protocol/issues/640
    • codeAction: fixed an incompatibility issue with VSCode

    Completion

    • More precise diagnostics/completion: an included file that has been changed does not need to be saved to take effect.
    • Decreased Content-Length: from 32K to 25K for some cases
    • On clang < 8, fixed #include < completion for -I dir
    • Macros are categorized as Text, instead of Interface
    • Refactor and rename (clang_complete.cc -> sema_manager.cc)
    • C++17 deduction guide #173

    Others

    • Support multiple -init=: "initializationOptions" from client are applied first, then -init=. Scalar options will be overridden while arrays will get concatenated

    Patch versions

    • 0.20181225.2 #182 textDocument/codeAction used incorrect range intersection
    • 0.20181225.3 #187 the new feature %h %hpp didn't take effect
    • 0.20181225.4 #197 keys in file->symbol2refcnt could be modified in message_handler.cc. Affected old releases. Tagged 0.20181010.1 0.20181024.1 0.20181111.2 0.20181225.4, respectively.
    • 0.20181225.6 make project.cc:GetSearchDirs recognize clang.extraArgs ; on Windows, normalize the drive letter used in g_config->cacheDirectory
    • 0.20181225.7 make workspace/didChangeWatchedFiles conservative https://github.com/MaskRay/ccls/issues/184#issuecomment-455095089
    • 0.20181225.8 bugfix: when neither .ccls nor compile_commands.json is specified, textDocument/didSave did not trigger re-index. The fix for the old issue (a plethora of "not indexed" errors) didn't take effect
    • 0.20181225.9 #316 bugfix: indexer.cc shouldn't use std::shared_lock to guard root2folder being concurrently written.
    Source code(tar.gz)
    Source code(zip)
  • 0.20181111.3(Nov 12, 2018)

    • Switched to Clang's native #include completion if clang >= 8. include_completion.cc is kept for clang<8

    • Refactored message handlers, deleted related static constructors and removed many ls prefixes from class/struct names.

    • textDocument/references and workspace/symbol get a new parameter vector<string> folders; to return results confined in specified folders.

    • hierarchical textDocument/documentSymbol lists member functions without definitions.

    • Fixed EnumConstantDecl's kind & EnumDecl's vars. $ccls/member on scoped enumerations lists its enumeration constants.

    • Fixed/worked around some preamble bugs

    • Fixed MSVC 2017 compatibility issues

    • tobik added a FreeBSD port

    Success stories with ClickHouse, Linux, and v8

    Source code(tar.gz)
    Source code(zip)
  • 0.20181024.2(Jan 9, 2019)

    Requests

    • textDocument/documentLink #include are represented as hyperlinks in vscode
    • textDocument/foldingRange
    • $ccls/setSkippedRanges -> $ccls/publishSkippedRanges
    • $ccls/publishSemanticHighlighting -> $ccls/publishSemanticHighlight
    • Uniquify textDocument/typeDefinition result

    Message handling has been refactored.

    Others

    • Support *.cu CUDA files
    • -DSYSTEM_CLANG=off (default) downloads Clang 7.0.0 prebuilt archives from <releases.llvm.org> now (6.0.1 before)
    • Add ExtentRef; merge symbol2refcnt and outline2refcnt
    • New command line option. ccls -index ~/llvm => index ~/llvm without starting the language server
    Source code(tar.gz)
    Source code(zip)
  • 0.20181010.2(Jan 9, 2019)

    New methods

    • textDocument/{formatting,onTypeFormatting,rangeFormatting} formatting/rangeFormatting can be used as replacement of the command line utility clang-format
    • $ccls/info: server status

    Completion

    • With clang>=7, completion items can replace . with -> or replace -> with . The client-side support of additionalTextEdits is required.
    • preamble stat cache
    • Some undesired candidates are blacklisted (e.g. destructors, injected class names)

    Others

    • Fixed hierarchical document symbol
    • Redesigned index: SymbolRef, Ref, Use, DeclRef. Decreased memory usage.
    • Fixed some issues applying $ccls/member on namespaces. anonymous namespaces/extern "C" are skipped, etc
    • Experimental workspace folders
    • Increased stack size
    • Revamped codeLens & codeAction
    Source code(tar.gz)
    Source code(zip)
  • 0.20180913.1(Oct 25, 2019)

    Lots of improvement

    Hierarchies have been renamed to: $ccls/call $ccls/member $ccls/inheritance and are available for flattened view (read custom cross references sections on wiki/LanguageClient-neovim and wiki/Emacs)

    Completion and diagnostics have been refactored from libclang to Clang C++.

    New $ccls/navigate for semantic navigation

    • https://www.reddit.com/r/emacs/comments/9dg13i/cclsnavigate_semantic_navigation_for_cc/
    • https://www.reddit.com/r/vim/comments/9dg60x/cclsnavigate_semantic_navigation_for_cc/

    Experimental index.onChange: true, index.multiVersion: true and cacheDirectory: "" https://github.com/MaskRay/ccls/wiki/Initialization-options

    Source code(tar.gz)
    Source code(zip)
  • 0.20180812.1(Aug 13, 2018)

  • 0.20180731.1(Aug 1, 2018)

  • 0.20180521.1(Oct 25, 2019)

  • 0.20180513.1(May 14, 2018)

  • 0.20190823.6(Apr 22, 2020)

    This release supports Clang 7~10.

    LSP conformance

    • Support null as initializationOptions
    • Set declarationProvider in server capabilities. Some client may need this capability to enable textDocument/declaration
    • Support non-numeric request ID #437

    Misc

    • Fix a double-free of llvm::MemoryBuffer when parsing fails #350
    • Keep comments from system headers and improve textDocument/hover #373
    • Fix the conformance issue that VersionedTextDocumentIdentifier.version was omitted. If one renames something spanning more than one document and some documents are not opened, the client may not apply the textDocument/rename change. #387
    • Some macro diagnostics were lost because Note::concerned was not propagated to Diag::concerned #391
    • index.onChange: true support non-existent files #443
    • textDocument/definition: don't jump to the type definition
    • Disable warnings and skip processed function bodies. This should provide massive performance improvement when indexing a project. I measured 2x improvement indexing ccls with 2 threads, more than 2x indexing llvm/clang/extra/lld/compiler-rt with 6 threads.

    Project

    • Fix some issues with hierarchical .ccls in #384
    • .ccls: support CUDA files with the %cu directive
    • compilationDatabaseDirectory can be absolute. #466
    • Improve heuristics for files not described by compile_commands.json "... but not so well for projects with separate include and source directories, e.g. "inc/long/path/to/my_file.h" and "src/long/path/to/my_file.cc" #441

    Windows

    • A Visual Studio 2017 STL bug prevented clang-cl from compiling ccls/src/utils.hh #371 #414
    • If the file is re-saved before the previous indexing has complete, various ambiguous errors might occur. Fixing this by making opened files volatile #235 #453

    Extension requests

    • $ccls/fileInfo: can optionally dump dependencies, includes and skipped_ranges

    Patches

    • 0.20190823.3 incorrect use of clang::FileEntry::getName on Arch Linux #487
    Source code(tar.gz)
    Source code(zip)
Owner
Fangrui Song
Retired Algo/CTF/Student Cluster Competition player
Fangrui Song
Visual Studio extension for assembly syntax highlighting and code completion in assembly files and the disassembly window

Asm-Dude Assembly syntax highlighting and code assistance for assembly source files and the disassembly window for Visual Studio 2015, 2017 and 2019.

Henk-Jan Lebbink 3.9k May 10, 2022
A cross-platform flutter plugin for C/C++/ObjC crash report via Google Breakpad

quick_breakpad A cross-platform flutter plugin for C/C++/ObjC crash report via Google Breakpad Use breakpad for quick_breakpad_example $CLI_BREAKPAD i

Woodemi Co., Ltd 15 Apr 26, 2022
All lab practicals c++ source code will be stored here, for future references.

Karnataka-State-Ist-PU-LAB-practicals-source-code All lab practicals c++ source code will be stored here, for future references. Sourced from this web

Sachit 1 Feb 1, 2022
Realtime Micro Kernel -- Event-driven Run-to-Completion RTOS with Active Objects, Timed Events, Memory Pools, and Message Queues

Realtime Micro Kernel Features Active Objects Message queues Variable sized, custom messages Periodic and single timed events Memory pools Supported P

null 2 Feb 25, 2022
A lightweight & cross-platform IDE supporting the most recent C++ standards

This project has moved to https://gitlab.com/cppit/jucipp. juCi++ a lightweight, platform independent C++-IDE with support for C++11, C++14 and C++17

cppit (zippit) 892 May 2, 2022
Cross-platform C++ input library supporting gamepads, keyboard, mouse, touch

This project is archived. It's neither maintained nor developed anymore. Gainput Gainput is the awesome C++ input library for your game: handles your

Johannes Kuhlmann 741 May 11, 2022
weggli is a fast and robust semantic search tool for C and C++ codebases. It is designed to help security researchers identify interesting functionality in large codebases.

weggli is a fast and robust semantic search tool for C and C++ codebases. It is designed to help security researchers identify interesting functionality in large codebases.

Google Project Zero 1.7k May 6, 2022
BAAF-Net - Semantic Segmentation for Real Point Cloud Scenes via Bilateral Augmentation and Adaptive Fusion (CVPR 2021)

Semantic Segmentation for Real Point Cloud Scenes via Bilateral Augmentation and Adaptive Fusion (CVPR 2021) This repository is for BAAF-Net introduce

null 82 May 13, 2022
Semantic version library written in ANSI C

semver.c Semantic version v2.0 parser and render written in ANSI C with zero dependencies. Features Standard compliant (otherwise, open an issue) Vers

Tom 168 Mar 15, 2022
Semantic Edge Detection with Diverse Deep Supervision

Semantic Edge Detection with Diverse Deep Supervision This repository contains the code for our IJCV paper: "Semantic Edge Detection with Diverse Deep

Yun Liu 10 May 12, 2022
Semantic Versioning for modern C++

_____ _ _ / ____| | | (_) | (___ ___ _ __ ___ __ _ _ __ | |_ _ ___ \

Daniil Goncharov 184 May 12, 2022
C parsing, semantic analys, generate a graph from a source code. An educational project during my third year of Computer Science Licence.

Pour compiler le programme, il suffit d'exécuter compiler.sh avec la commande "./compiler.sh" en se trouvant dans le dossier racine du projet. Un fich

Jean Philippe Carlens 3 Feb 3, 2022
The Kernel-Mode Winsock library, supporting TCP, UDP and Unix sockets (DGRAM and STREAM).

libwsk 简体中文 About libwsk is a wrapper for the WSK (Winsock-Kernel) interface. With libwsk, kernel-mode software modules can perform network I/O operat

MeeSong 85 May 10, 2022
Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on OpenGL 1.x-4.x supporting Windows, Linux and Mac OS X.

Visualization Library 2.2 Gallery About Visualization Library is a C++ middleware for high-performance 2D and 3D graphics applications based on the in

Michele 286 Apr 21, 2022
MDE is a model extraction tool that converts Destiny 2 dynamic models into fbx files supporting textures, skeletons, and all provided vertex data.

MDE is a model extraction tool that converts Destiny 2 dynamic models into fbx files. A dynamic model is one that is animated or is spawned in during the game.

Montague 28 Apr 25, 2022
Gamepad firmware for RP2040 microcontrollers supporting Nintendo Switch, XInput and DirectInput

GP2040 Firmware GP2040 is a gamepad firmware for the RP2040 microcontroller that provides high performance and a rich feature set across multiple plat

null 156 May 2, 2022
Open Redragon drivers for Linux. Currently only supporting some mice.

OpenDragon Open Redragon drivers for Linux. Currently only supporting some mice. Table of contents Support Installation Building from source Usage Sou

Alexa Ognjanovic 71 Apr 12, 2022
Supporting code for coroutines blog.

coroutines-blog Demonstration code for the Feabhas coroutines blog. Build the demos using make. Remove generated executables with make clean. Generate

Feabhas Ltd. 9 Mar 14, 2022