V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
MaskRay
V2EX  ›  程序员

C/C++/ObjC language server ccls 0.20181225 release

  •  
  •   MaskRay ·
    MaskRay · 2018-12-27 16:07:01 +08:00 · 2174 次点击
    这是一个创建于 2156 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://maskray.me/blog/2018-12-25-ccls-release

    聖誕發佈新版https://github.com/MaskRay/ccls/releases/tag/0.20181225

    • 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

    重點是

    • 更加精確的 diagnostics/completion(針對#include 中的依賴 unsaved buffers),之前 cquery/ccls 的做法都不好
    • 檔案刪除、重命名:之前這兩個專案都不會清理掉刪除的檔案 #170
    • #159 是之前 LSP exit 觸發exit(0)(中斷一個正在寫 cache 的 indexer thread 下次可能讀不出來,但非常罕見)
    • 補全的其他大大小小改進
    • 如果一個 textDocument 的索引未被加載,request (textDocument/documentHighlight textDocument/hover等)會報告not indexed,顯示在 echo area,比較惱人。我在pipeline.cc引入了一個 backlog 解決這一問題,詳見https://github.com/MaskRay/ccls/pull/176。code lens 可以用(add-hook 'lsp-after-open-hook #'ccls-code-lens-mode)而不需要(run-at-time 0.5 nil #'ccls-code-lens-mode)
    • 增強.cclscompile_commands.json的協作,詳見 Paul Smith 的分析https://github.com/MaskRay/ccls/issues/115#issuecomment-449455357

    其他

    • ccls/wiki/Emacs 拆分成wiki/lsp-modewiki/egot,後者還比較簡陋(歡迎貢獻)
    • eglot 支援workspace/didChangeWatchedFiles,lsp-mode 尚未
    • 我給 lsp-mode 加了LocationLink支援,targetSelectRange可以指向名字,而targetRange指向輪廓。mouse hover 時可以有可視效果(對於 Emacs 用途不大)
    • xref.el 的xref-file-location並非表示interface Range的良好選擇,因爲僅能表示點(line column),不能表示區間。lsp-ui-peek 裏需要區間信息 highlight 文本,無法良好地用 xref 表達,在 lsp-ui-peek 裏的實現有點噁心(希望有人能改好)
    ;; xref.el
    (defclass xref-file-location (xref-location)
      ((file :type string :initarg :file)
       (line :type fixnum :initarg :line :reader xref-location-line)
       (column :type fixnum :initarg :column :reader xref-file-location-column))
      :documentation "A file location is a file/line/column triple.
    Line numbers start from 1 and columns from 0.")
    
    ;; lsp-ui-peek.el
              (-if-let (uri (gethash "uri" x))
                  (-let (((&hash "start" (&hash "line" "character")) (gethash "range" x)))
                    (lsp-ui-peek--goto-xref `(:file ,(lsp--uri-to-path uri) :line ,line :column ,character)))
                (-let (((&hash "start" (&hash "line" "character")) (or (gethash "targetSelectionRange" x) (gethash "targetRange" x))))
                  (lsp-ui-peek--goto-xref `(:file ,(lsp--uri-to-path (gethash "targetUri" x)) :line ,line :column ,character))))
    
    
    4 条回复    2018-12-29 00:52:04 +08:00
    mxi1
        1
    mxi1  
       2018-12-27 16:13:14 +08:00
    一直没时间试, 等把 emacs 的 ccls 环境搭好,再来咨询.哈哈
    zivyou
        2
    zivyou  
       2018-12-27 18:51:56 +08:00
    mark
    visylar
        3
    visylar  
       2018-12-28 02:27:57 +08:00
    ccls for vscode is great! Thank you
    saintaugustinus
        4
    saintaugustinus  
       2018-12-29 00:52:04 +08:00
    支持支持
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5325 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 07:13 · PVG 15:13 · LAX 23:13 · JFK 02:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.