{"id":820,"date":"2017-12-16T23:28:34","date_gmt":"2017-12-16T15:28:34","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=820"},"modified":"2017-12-16T23:28:34","modified_gmt":"2017-12-16T15:28:34","slug":"%e4%bd%bf%e7%94%a8cquery%ef%bc%9ac-language-server","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/820","title":{"rendered":"\u4f7f\u7528cquery\uff1aC++ language server"},"content":{"rendered":"<div class=\"PostIndex-header av-paddingTop av-card\" data-zop=\"{&quot;authorName&quot;:&quot;MaskRay&quot;,&quot;itemId&quot;:&quot;31672451&quot;,&quot;title&quot;:&quot;\u4f7f\u7528cquery\uff1aC++ language server&quot;,&quot;type&quot;:&quot;article&quot;}\" data-za-module=\"PostItem\" data-za-module-info=\"{&quot;card&quot;:{&quot;content&quot;:{&quot;type&quot;:&quot;Post&quot;,&quot;token&quot;:&quot;31672451&quot;}}}\">\n<div class=\"TitleImage\"><img decoding=\"async\" class=\"TitleImage-imagePure TitleImage-imagePure--fixed\" src=\"https:\/\/pic1.zhimg.com\/v2-9230d134e5e577a1d16b6c495bf47fe7_r.jpg\" alt=\"\u4f7f\u7528cquery\uff1aC++ language server\" height=\"428px\" \/><\/div>\n<h1 class=\"PostIndex-title av-paddingSide av-titleFont\">\u4f7f\u7528cquery\uff1aC++ language server<\/h1>\n<div class=\"PostIndex-author\"><a href=\"https:\/\/www.zhihu.com\/people\/maskray\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"Avatar-hemingway PostIndex-authorAvatar Avatar--xs\" src=\"https:\/\/pic3.zhimg.com\/4691fd93a_xs.jpg\" srcset=\"https:\/\/pic3.zhimg.com\/4691fd93a_l.jpg 2x\" alt=\"MaskRay\" \/><\/a><a class=\"PostIndex-authorName\" href=\"https:\/\/www.zhihu.com\/people\/maskray\" target=\"_blank\" rel=\"noopener\">MaskRay<\/a><\/p>\n<div class=\"HoverTitle\" data-hover-title=\"2017 \u5e74 12\u6708 4 \u65e5\u661f\u671f\u4e00\u4e0b\u5348 12 \u70b9 31 \u5206\"><time datetime=\"Mon Dec 04 2017 12:31:37 GMT+0800 (CST)\">12 \u5929\u524d<\/time><\/div>\n<\/div>\n<\/div>\n<div class=\"RichText PostIndex-content av-paddingSide av-card\">\n<h2>\u539f\u6587\uff1a<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/maskray.me\/blog\/2017-12-03-c%2B%2B-language-server-cquery\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u4f7f\u7528cquery\uff1aC++ language server<i class=\"icon-external\"><\/i><\/a><\/h2>\n<h2><b>C++\u4ee3\u7801\u7d22\u5f15\u5de5\u5177\u73b0\u72b6<\/b><\/h2>\n<p>Tag system\u6d41\u6d3e<\/p>\n<ul>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/ctags.io\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Universal Ctags<i class=\"icon-external\"><\/i><\/a>\u5f88\u7cbe\u5999\uff0c\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u8df3\u8f6c\uff0c\u56e0\u6b64\u6587\u6863\u7f16\u8f91\u540e\u4ecd\u80fd\u4f7f\u7528\u3002<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/universal-ctags\/ctags\/blob\/master\/parsers\/c.c\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/universal-ct<\/span><span class=\"invisible\">ags\/ctags\/blob\/master\/parsers\/c.c<\/span><i class=\"icon-external\"><\/i><\/a>\u00a0\u4f46\u4e0d\u5e26\u5f15\u7528\uff0cVim\u4f1a\u7528\u4e8c\u5206\u67e5\u627e\uff0c\u5927\u7ea6\u4f1a\u6709log2(size\/4096)\u6b21seek\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=http%3A\/\/cscope.sourceforge.net\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Cscope<i class=\"icon-external\"><\/i><\/a>\u4f3c\u4e4e\u5df2\u7ecf\u8352\u5e9f\u4e86\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/www.gnu.org\/s\/global\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">GNU GLOBAL<i class=\"icon-external\"><\/i><\/a>\u00a0<code>libparser\/C.c<\/code><\/li>\n<\/ul>\n<p>clang\u6d41\u6d3e<\/p>\n<ul>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/ffevotte\/clang-tags\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">clang-tags<i class=\"icon-external\"><\/i><\/a>\u8352\u5e9f\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/Valloric\/YouCompleteMe\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">YouCompleteMe<i class=\"icon-external\"><\/i><\/a>\u4e0d\u591f\u597d\u7528\uff0c\u56e0\u4e3a\u53ea\u5904\u7406\u5355\u4e00translation unit\uff0c\u65e0\u6cd5\u67e5\u627e\u5f15\u7528\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/clang.llvm.org\/extra\/clangd.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">clangd<i class=\"icon-external\"><\/i><\/a>\u6700\u6709\u524d\u666f\uff0c\u6709\u5927\u5382\u5927\u9879\u76ee\u613f\u610f\u91c7\u7528\u3002\u4f46\u5c1a\u65e0\u5b58\u50a8\u7cfb\u7edf\uff0c\u5b9e\u8d28\u4e0a\u4e5f\u65e0\u6cd5\u5904\u7406\u591atranslation units\u3002\u4f5c\u4e3a<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/clang.llvm.org\/extra\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">clang-tools-extra<i class=\"icon-external\"><\/i><\/a>\u4e00\u90e8\u5206\uff0c\u800cclang+llvm\u6784\u5efa\/\u8d21\u732e\u95e8\u69db\u9ad8([<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/reviews.llvm.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">reviews.llvm.org\/<\/span><i class=\"icon-external\"><\/i><\/a>])\u3002\u76ee\u524d\u6709\u5c1d\u8bd5\u5f15\u5165\u5b58\u50a8\u6a21\u578b(MarkZ3)\uff0c\u4f46\u76ee\u524d\u8bbe\u8ba1\u8f83\u4e3a\u590d\u6742\uff0c\u800c\u5b9e\u9645\u4e0a\u4e0d\u5e26garbage collection\u7684<code>std::vector<\/code>(cquery\u98ce\u683c)\u8db3\u591f\u5e94\u5bf9\u5927\u90e8\u5206\u4f7f\u7528\u573a\u666f\u3002\u5f88\u62c5\u5fc3\u4ed6\u4eec\u8d70\u4e0a\u6b67\u8def\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/google\/kythe\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google Kythe<i class=\"icon-external\"><\/i><\/a>\uff0c(mostly) language-agnostic\uff0c\u6982\u5ff5\u590d\u6742\uff0c\u914d\u7f6e\u56f0\u96be\u3002\u4e0d\u91cd\u89c6language server protocol\uff0c<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/google\/kythe\/blob\/master\/kythe\/go\/languageserver\/languageserver.go\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">\u5f53\u524d<i class=\"icon-external\"><\/i><\/a>\u4ec5\u63d0\u4f9b<code>ReferencesProvider,HoverProvider,DefinitionProvider<\/code>\uff0c\u4e14\u4ea4\u4e92\u4f7f\u7528\u53ef\u80fd\u6709\u6781\u5927\u5ef6\u8fdf\u3002\u5927\u591a\u6570\u4eba\u5e76\u4e0d\u5728\u610fC++ Haskell Python\u4ee3\u7801\u95f4\u65e0\u7f1d\u8df3\u8f6c\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/Andersbakken\/rtags\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">rtags<i class=\"icon-external\"><\/i><\/a>\u53ef\u4ee5\u67e5\u627e\u5f15\u7528\uff0c\u4f46\u6bcf\u4e2atranslation unit 6\u4e2a\u6587\u4ef6<code>info,symbols,symnames,targets,tokens,usrs<\/code>(\u8fc7\u591a)\uff0c\u6ca1\u6709\u4f7f\u7528in-memory\u7d22\u5f15\uff0c\u67e5\u627e\u5f15\u7528\u8bf7\u6c42\u4f1a\u8bfb\u9879\u76ee\u6240\u6709translation units\u7684\u6587\u4ef6\u3002\u5bfc\u81f4\u6027\u80fd\u4f4e\u4e0b<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/Andersbakken\/rtags\/issues\/1007\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/Andersbakken<\/span><span class=\"invisible\">\/rtags\/issues\/1007<\/span><i class=\"icon-external\"><\/i><\/a>\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/jacobdufault\/cquery\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">cquery<i class=\"icon-external\"><\/i><\/a>\u73b0\u9636\u6bb5\u7684\u59a5\u534f\u3002\u4e3b\u8981\u6570\u636e\u7ed3\u6784\u4e3a\u4e0d\u5e26garbage collection(\u53d8\u91cf\/\u51fd\u6570\/\u7c7b\u578b\u7b49\u7684id\u4e0d\u4f1a\u56de\u6536)\u7684<code>std::vector<\/code>(<code>src\/indexer.h<\/code>)\u3002\u6709\u4e00\u4e9bEmacs\u7528\u6237\u79ef\u6781\u8d21\u732e<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/code.visualstudio.com\/docs\/editor\/editingevolved\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">code navigation\u529f\u80fd<i class=\"icon-external\"><\/i><\/a>\u3002<\/li>\n<\/ul>\n<p>IDE(Any sufficiently complicated IDE contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of C++.)<\/p>\n<ul>\n<li>NetBeans\u4f7f\u7528<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=http%3A\/\/llvm.org\/devmtg\/2017-03\/\/assets\/slides\/clank_java_port_of_c_cxx_compiler_frontend.pdf\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Clank<i class=\"icon-external\"><\/i><\/a><\/li>\n<li>Eclipse\u7528<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/www.eclipse.org\/cdt\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">CDT<i class=\"icon-external\"><\/i><\/a><\/li>\n<\/ul>\n<p><b>cquery\u5b89\u88c5\u3001\u914d\u7f6e<\/b><\/p>\n<h2><a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/jacobdufault\/cquery\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/jacobdufault<\/span><span class=\"invisible\">\/cquery<\/span><i class=\"icon-external\"><\/i><\/a>\u3002Arch Linux\u53ef\u7528<code>aur\/cquery-git<\/code>\u3002<\/h2>\n<ul>\n<li>\u6784\u5efalanguage server\u53ef\u6267\u884c\u6587\u4ef6<\/li>\n<li>\u7f16\u8f91\u5668\u5b89\u88c5language client\u63d2\u4ef6<\/li>\n<li>\u914d\u7f6elanguage client\uff0c\u6253\u5f00C++\u6587\u4ef6\u65f6\u8fd0\u884clanguage server\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u901a\u8fc7stdio\u7528<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=http%3A\/\/www.jsonrpc.org\/specification\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">JSON-RPC 2.0<i class=\"icon-external\"><\/i><\/a>\u901a\u4fe1\n<ul>\n<li>\u5149\u6807\u79fb\u52a8\u65f6\u5411language server\u53d1\u9001<code>textDocument\/hover<\/code>\u8bf7\u6c42\uff0clanguage server\u8fd4\u56de\u53d8\u91cf\/\u51fd\u6570\u58f0\u660e\u4fe1\u606f<\/li>\n<li>\u67e5\u627e\u5b9a\u4e49\u53d1\u9001<code>textDocument\/definition<\/code>\u8bf7\u6c42<\/li>\n<li>\u67e5\u627e\u5f15\u7528\u53d1\u9001<code>textDocument\/references<\/code>\u8bf7\u6c42<\/li>\n<li>\u67e5\u627e\u5f53\u524d\u6587\u6863\u5b9a\u4e49\u7684\u7b26\u53f7(\u901a\u5e38\u662f\u9876\u5c42\u7684outline)\u53d1\u9001<code>textDocument\/documentSymbol<\/code>\u8bf7\u6c42<\/li>\n<li>\u67e5\u627e\u9879\u76ee\u5b9a\u4e49\u7684\u7b26\u53f7(\u901a\u5e38\u662f\u9876\u5c42\u7684outline)\u53d1\u9001<code>textDocument\/workspaceSymbol<\/code>\u8bf7\u6c42<\/li>\n<li>\u8865\u5168<code>textDocument\/completion<\/code><\/li>\n<li>\u6587\u6863\u7f16\u8f91\u64cd\u4f5c\u53d1\u9001<code>textDocument\/didChange<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2><b>Emacs<\/b><\/h2>\n<p>\u53c2\u7167<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/jacobdufault\/cquery\/wiki\/Emacs\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/jacobdufault<\/span><span class=\"invisible\">\/cquery\/wiki\/Emacs<\/span><i class=\"icon-external\"><\/i><\/a>\u914d\u7f6e\u3002\u6709\u51e0\u4e2a\u76f8\u5173\u7ec4\u4ef6\uff1a<\/p>\n<ul>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/emacs-lsp\/lsp-mode\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lsp-mode<i class=\"icon-external\"><\/i><\/a>\u00a0Emacs\u91cc\u7684LSP\u5ba2\u6237\u7aef\uff0clanguage server\u4e2d\u6027\u3002\u53e6\u6709lsp-rust\u3001lsp-haskell\u7b49language server\u76f8\u5173\u8bbe\u7f6e\u3002<\/li>\n<li>cquery Wiki\u91cc\u63d0\u5230\u7684<code>cquery.el<\/code>\u3002\u5730\u4f4d\u4e0elsp-rust\u3001lsp-haskell\u7b49\u7c7b\u4f3c\uff0c\u628acquery\u9002\u914d\u5230lsp-mode\u3002\u53e6\u5916\u63d0\u4f9b\u4e00\u4e9bLSP\u4e2d\u672a\u5b9a\u4e49\u7684cquery\u7279\u5b9a\u529f\u80fd\u3002<\/li>\n<li><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/emacs-lsp\/lsp-ui\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">lsp-ui<i class=\"icon-external\"><\/i><\/a>\u00a0lsp-mode\u6709\u8ba1\u5212\u5e76\u5165Emacs\u3002\u5176\u4ed6UI\u76f8\u5173\u6216\u56e0\u534f\u8bae\u7b49\u95ee\u9898\u4e0d\u9002\u5408\u5728\u6838\u5fc3lsp-mode\u5305\u7684\u7ec4\u4ef6\u653e\u5728\u8fd9\u91cc\u3002\u5f53\u524d\u6709\uff1a\n<ul>\n<li>lsp-flycheck \u7528language server\u7684diagnostics\u4fe1\u606f\u5b9e\u73b0flucheck\u7684checker<\/li>\n<li>lsp-line \u5373\u65f6\u663e\u793a\u5f53\u524d\u884c\u6240\u6709\u6807\u8bc6\u7b26\u7684<code>textDocument\/hover<\/code>\u4fe1\u606f<\/li>\n<li>lsp-xref \u57fa\u4e8e<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/cpitclaudel\/quick-peek\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">quick-peek<i class=\"icon-external\"><\/i><\/a>\u7684<code>find-{definitions,references,apropos}<\/code>\u3002\u4f46\u5bf9\u4e8e\u8fd9\u4e2a\u529f\u80fd\u6211\u66f4\u504f\u597dhelm-xref<\/li>\n<li>\u672a\u6765\u53ef\u80fd\u6dfb\u52a0\u66f4\u591acode lens\u529f\u80fd<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li><code>xref.el<\/code>\u00a0lsp-mode\u8bbe\u7f6e<code>xref-backend-functions<\/code>\uff0c\u4ecelanguage server\u83b7\u53d6\u5b9a\u4e49\u3001\u5f15\u7528\u7b49\u4fe1\u606f\u540e\uff0c\u4ea4\u7ed9<code>xref.el<\/code>\u663e\u793a\u3002<\/li>\n<\/ul>\n<h2><b><code>xref.el<\/code><\/b><\/h2>\n<p>\u4ee5\u4e0b\u4e09\u4e2a\u51fd\u6570\u662f\u6700\u5e38\u7528\u7684\u4ea4\u4e92\u547d\u4ee4\u3002<\/p>\n<ul>\n<li><code>xref-find-definitions<\/code>\u00a0(\u9ed8\u8ba4<code>M-.<\/code>)\uff0c\u5bf9\u5e94LSP\u4e2d\u7684<code>textDocument\/definition<\/code><\/li>\n<li><code>xref-find-references<\/code>\u00a0(\u9ed8\u8ba4<code>M-?<\/code>)\uff0c\u5bf9\u5e94<code>textDocument\/references<\/code><\/li>\n<li><code>xref-find-apropos<\/code>\u00a0(\u9ed8\u8ba4<code>C-M-.<\/code>)\uff0c\u5bf9\u5e94<code>workspace\/symbol<\/code><\/li>\n<\/ul>\n<p>\u6ce8\u610f\uff0c\u5982\u679c\u8981\u4f7f\u7528<code>xref-find-references<\/code>\uff0c\u8bf7\u9605\u8bfb<code>xref-prompt-for-identifier<\/code>\u6587\u6863\uff0c\u5e76\u628a<code>xref-find-references<\/code>\u6dfb\u52a0\u8fdb\u53bb\u3002\u5426\u5219<code>M-?<\/code>\u4f1a\u89e6\u53d1<code>xref--read-identifier<\/code>\u4f1a\u5728minibuffer\u4e2d\u8981\u6c42\u8bfb\u5165\u4e00\u4e2a\u4e32\uff0c\u800c\u952e\u5165\u7684\u5b57\u4e32\u6ca1\u6709text properties\u63d0\u4f9b\u4f4d\u7f6e\u4fe1\u606f\uff0clanguage server\u65e0\u6cd5\u8df3\u8f6c\u5230\u5f15\u7528\u3002\u6211\u63d0\u4ea4\u4e86\u4e00\u4e2abug\u5230Emacs\uff1a<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/debbugs.gnu.org\/cgi\/bugreport.cgi%3Fbug%3D29619\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">debbugs.gnu.org\/cgi\/bug<\/span><span class=\"invisible\">report.cgi?bug=29619<\/span><i class=\"icon-external\"><\/i><\/a>\uff0c\u4f46maintainer\u9700\u8981\u4e86\u89e3\u66f4\u591a\u7528\u6237\u7684\u53cd\u9988\u624d\u4f1a\u4fee\u6539<code>xref-prompt-for-identifier<\/code>\u9ed8\u8ba4\u503c\u3002<\/p>\n<h2><b><code>cquery.el<\/code><\/b><\/h2>\n<p>cquery\u9879\u76ee\u4e2d\u7684<code>cquery.el<\/code>\u9002\u914dcquery\u5230lsp-mode\uff0c\u540c\u65f6\u63d0\u4f9b\u4e00\u4e9bLSP\u534f\u8bae\u672a\u5b9a\u4e49\u7684\u529f\u80fd\u3002\u5982inactive region\uff0c\u628apreprocessor\u5ffd\u7565\u6389\u7684\u884c\u7528\u7070\u8272\u663e\u793a\uff1a<\/p>\n<p>\u6211\u7528\u4ee5\u4e0bC\/C++ mode hook\u5728\u9879\u76ee\u6839\u76ee\u5f55\u6709<code>compile_commands.json<\/code>\u65f6\u81ea\u52a8\u542f\u7528`lsp-cquery-enable\u3002<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">(defun my\/\/enable-cquery-if-compile-commands-json ()\r\n  (when-let\r\n      ((_ (not (and (boundp 'lsp-mode) lsp-mode)))\r\n       (_ (cl-notany (lambda (x) (string-match-p x buffer-file-name)) my-cquery-blacklist))\r\n       (root (projectile-project-root))\r\n       (_ (or (file-exists-p (concat root \"compile_commands.json\"))\r\n              (file-exists-p (concat root \".cquery\")))))\r\n    (lsp-cquery-enable)\r\n    (lsp-enable-imenu)))\r\n<\/code><\/pre>\n<\/div>\n<p><b>helm-xref<\/b><\/p>\n<p><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/emacs-helm\/helm\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">helm<i class=\"icon-external\"><\/i><\/a>\u7528\u6237\u53ef\u4ee5\u8003\u8651\u5b89\u88c5<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=ttps%3A\/\/github.com\/brotzeit\/helm-xref\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">helm-xref<i class=\"icon-external\"><\/i><\/a>\uff0c<code>(setq xref-show-xrefs-function 'helm-xref-show-xrefs)<\/code>\u5373\u53ef\u3002<code>xref-find-{definitions,references,apropos}<\/code>\u4f1a\u7528helm\u663e\u793a\uff0c\u66ff\u4ee3<code>xref.el<\/code>\u7684\u754c\u9762\u3002<\/p>\n<h2><b>xref\u7684\u53cc\u5411jump list<\/b><\/h2>\n<p>\u6211\u559c\u6b22\u67e5\u627e\u5b9a\u4e49\u3001\u5f15\u7528\u7684jump list\u548c\u6b63\u5e38jump list(Evil\u4e2d<code>C-o<\/code>\u00a0<code>C-i<\/code>)\u5206\u79bb\u3002\u56e0\u4e3a\u67e5\u627e\u5b9a\u4e49\/\u5f15\u7528\u540e\u4f1a\u8fdb\u884c\u4e00\u4e9b\u5c40\u90e8\u8df3\u8f6c\uff0c\u559c\u6b22\u6709\u5feb\u6377\u952e\u56de\u5230\u5b9a\u4e49\/\u5f15\u7528\u8df3\u8f6c\u524d\u7684\u4f4d\u7f6e\u3002 Emacs Lisp dynamic scoping\u4f7f\u5f97\u6211\u4eec\u53ef\u4ee5\u5f88\u5bb9\u6613\u590d\u7528evil-jumps\u505a\u4e00\u4e2a\u7528\u4e8exref\u7684jump list\uff0c\u540c\u65f6\u8fd8\u652f\u6301\u53cc\u5411\u79fb\u52a8\uff0c\u6bd4<code>xref.el<\/code>\u4e2d\u7684<code>xref-pop-marker-stack<\/code>\u66f4\u65b9\u4fbf\u3002<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">(defmacro my-xref\/\/with-evil-jumps (&amp;rest body)\r\n  \"Make `evil-jumps.el' commands work on `my-xref--jumps'.\"\r\n  (declare (indent 1))\r\n  `(let ((evil--jumps-window-jumps ,my-xref--jumps))\r\n     ,@body))\r\n(with-eval-after-load 'evil-jumps\r\n  (evil-define-motion my-xref\/evil-jump-backward (count)\r\n    (my-xref\/\/with-evil-jumps\r\n        (evil--jump-backward count)\r\n      (run-hooks 'xref-after-return-hook)))\r\n  (evil-define-motion my-xref\/evil-jump-forward (count)\r\n    (my-xref\/\/with-evil-jumps\r\n        (evil--jump-forward count)\r\n      (run-hooks 'xref-after-return-hook))))\r\n<\/code><\/pre>\n<\/div>\n<p><b>\u5176\u4ed6<\/b><\/p>\n<ul>\n<li>lsp-mode\u4e2d\u7684<code>lsp-imenu.el<\/code>\u7528imenu\u6765\u663e\u793a<code>textDocument\/documentSymbol<\/code>\u4fe1\u606f\u3002\u8df3\u8f6c\u5230\u5f53\u524d\u6863\u6848\u7684\u7b26\u53f7\u5f88\u65b9\u4fbf\u3002<\/li>\n<li>LSP\u751f\u6001\u7cfb\u7edf\u89e3\u51b3\u7684\u4e00\u5927\u75db\u70b9\u662f\u4ee5\u524d\u5bf9\u4e8e\u4e0d\u540c\u8bed\u8a00\uff0c\u8981\u4f7f\u7528\u4e0d\u540c\u5de5\u5177\uff0c\u8bbe\u7f6e\u4e0d\u540c\u5feb\u6377\u952e\u3002\u7528\u4e86language client\u5c31\u53ef\u4ee5\u7edf\u4e00\u4e86\u3002<\/li>\n<\/ul>\n<p>\u6ce8\u610f<code><a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github%3C\/code%3E.com\/Microsoft\/language-server-protocol\/blob\/master\/protocol.md%23textDocument_references\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">textDocument\/references\u534f\u8bae<i class=\"icon-external\"><\/i><\/a>\u4e2d\u5b9a\u4e49\u8fd4\u56de\u7ed3\u679c\u4e3aLocation[] | null\uff0c\u53ea\u542b\u4f4d\u7f6e\u4fe1\u606f\uff0c\u4e0d\u5305\u542b\u4ee3\u7801\u884c\u5185\u5bb9\u3002\u663e\u793a\u884c\u5185\u5bb9\u662flsp-mode\u505a\u7684\u3002<\/code><\/p>\n<p><a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/MaskRay\/Config\/blob\/master\/home\/.emacs.d\/layers\/%252Bmy\/my-code\/funcs.el\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/MaskRay\/Conf<\/span><span class=\"invisible\">ig\/blob\/master\/home\/.emacs.d\/layers\/%2Bmy\/my-code\/funcs.el<\/span><i class=\"icon-external\"><\/i><\/a><\/p>\n<ul>\n<li>\u5e0c\u671b<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=http%3A\/\/spacemacs.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">spacemacs<i class=\"icon-external\"><\/i><\/a>\u652f\u6301LSP\u3002<code>reference-handler<\/code>(\u7c7b\u4f3c\u4e8e\u8df3\u8f6c\u5230\u5b9a\u4e49\u7684<code>jump-handler<\/code>)\u4e5f\u5f88\u6709\u7528\uff1a<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/syl20bnr\/spacemacs\/pull\/9911\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/syl20bnr\/spa<\/span><span class=\"invisible\">cemacs\/pull\/9911<\/span><i class=\"icon-external\"><\/i><\/a><\/li>\n<li>lsp-mode\u548c<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/leoliu\/ggtags\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">ggtags<i class=\"icon-external\"><\/i><\/a>\u90fd\u4f1a<code>(setq-local eldoc-documentation-function ...)<\/code>\uff0c\u5bf9\u4e8e\u8fd9\u7c7bminor-mode\u51b2\u7a81\u95ee\u9898\uff0c\u5982\u679c\u80fd\u8bbe\u7f6e\u4f18\u5148\u7ea7\u5c31\u80fd\u4f18\u96c5\u89e3\u51b3\u3002<\/li>\n<\/ul>\n<h2><b>Neovim<\/b><\/h2>\n<p>\u53c2\u7167<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/autozimu\/LanguageClient-neovim\/wiki\/cquery\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/autozimu\/Lan<\/span><span class=\"invisible\">guageClient-neovim\/wiki\/cquery<\/span><i class=\"icon-external\"><\/i><\/a><\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">nn &lt;leader&gt;ji :Denite documentSymbol&lt;cr&gt;\r\nnn &lt;leader&gt;jI :Denite workspaceSymbol&lt;cr&gt;\r\n\" \u7ec8\u7aef\u9650\u5236\uff0c&lt;C-,&gt;\u4e0d\u53ef\u7528\u3002ord(`,`) &amp; 64\u4e3a0\u65e0\u6cd5\u8868\u793a\r\nnn &lt;M-,&gt; :Denite references&lt;cr&gt;\r\nnn &lt;silent&gt; &lt;C-j&gt; :MarkPush&lt;cr&gt;:call LanguageClient_textDocument_definition()&lt;cr&gt;\r\n<\/code><\/pre>\n<\/div>\n<p>\u4e0d\u6e05\u695a\u600e\u4e48\u628a\u5b9a\u4e49\/\u5f15\u7528\u6539\u9020\u6210\u4f7f\u7528\u53ef\u53cc\u5411\u79fb\u52a8\u7684jump list\u3002<\/p>\n<figure><img decoding=\"async\" class=\"origin_image zh-lightbox-thumb lazy\" src=\"https:\/\/pic1.zhimg.com\/50\/v2-394e339a80932a66f740af3160e5cf7a_hd.jpg\" width=\"831\" data-caption=\"\" data-size=\"normal\" data-rawwidth=\"831\" data-rawheight=\"693\" data-original=\"https:\/\/pic1.zhimg.com\/v2-394e339a80932a66f740af3160e5cf7a_r.jpg\" data-actualsrc=\"https:\/\/pic1.zhimg.com\/v2-394e339a80932a66f740af3160e5cf7a_b.jpg\" \/><\/figure>\n<h2><b>\u95ee\u9898<\/b><\/h2>\n<ul>\n<li>Task lists\u00a0<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/jacobdufault\/cquery\/issues\/30\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/jacobdufault<\/span><span class=\"invisible\">\/cquery\/issues\/30<\/span><i class=\"icon-external\"><\/i><\/a>\u00a0Polish before publishing (to GitHub Marketplace)<\/li>\n<li>libclang\u591a\u7ebf\u7a0bparse translation unit(\u7d22\u5f15\u4e3b\u8981\u74f6\u9888)\u6709race condition\u00a0<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/jacobdufault\/cquery\/issues\/43%23issuecomment-347614504\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/jacobdufault<\/span><span class=\"invisible\">\/cquery\/issues\/43#issuecomment-347614504<\/span><i class=\"icon-external\"><\/i><\/a>\u3002\u82e5\u91c7\u7528\u591a\u8fdb\u7a0b\u6a21\u578b\uff0c\u5f88\u591a\u8f7b\u91cf\u7ea7\u6570\u636e\u5e93\u4e0d\u652f\u6301\u6216\u6709\u8f83\u96be\u5904\u7406\u7684\u95ee\u9898(\u5982\u679c\u6709\u9700\u6c42\u628a\u73b0\u5728in-memory+JSON\u6539\u6210\u6709\u5176\u4ed6\u5b58\u50a8\u6a21\u578b)\u3002\u6ce8\u8bb0\uff0c<code>SQLITE_ENABLE_LOCKING_STYLE<\/code>\u3001flock\u5f88\u96be\u3002<\/li>\n<\/ul>\n<h2><b>\u5176\u4ed6<\/b><\/h2>\n<p>\u7d22\u5f15Linux kernel<\/p>\n<div class=\"highlight\">\n<pre><code class=\"language-text\">wget 'https:\/\/git.archlinux.org\/svntogit\/packages.git\/plain\/trunk\/config?h=packages\/linux' -O .config\r\nyes '' | make config\r\nbear make -j bzImage modules\r\n<\/code><\/pre>\n<\/div>\n<p>\u751f\u62103GiB\u6587\u4ef6\u3002<\/p>\n<p>\u67e5\u770bLSP requests\/responses<\/p>\n<p>sudo sysdig -As999 &#8211;unbuffered -p &#8216;%evt.type %evt.buffer&#8217; &#8220;proc.pid=$(pgrep -fn build\/app) and fd.type=pipe&#8221; | egrep -v &#8216;^Content|^$&#8217;<\/p>\n<p>\u751f\u6210<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/clang.llvm.org\/docs\/JSONCompilationDatabase.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">compile_commands.json<i class=\"icon-external\"><\/i><\/a>\uff0c\u53c2\u8003<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/jacobdufault\/cquery\/wiki\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/jacobdufault<\/span><span class=\"invisible\">\/cquery\/wiki<\/span><i class=\"icon-external\"><\/i><\/a>\u3002<\/p>\n<p>\u5e0c\u671b\u6709\u671d\u4e00\u65e5Debug Protocol\u4e5f\u80fd\u83b7\u5f97\u91cd\u89c6\uff0c<a class=\" external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/Microsoft\/vscode-debugadapter-node\/blob\/master\/protocol\/src\/debugProtocol.ts\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><span class=\"invisible\">https:\/\/<\/span><span class=\"visible\">github.com\/Microsoft\/vs<\/span><span class=\"invisible\">code-debugadapter-node\/blob\/master\/protocol\/src\/debugProtocol.ts<\/span><i class=\"icon-external\"><\/i><\/a>\uff0c\u8ba9<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=https%3A\/\/github.com\/realgud\/realgud\/wiki\/Debuggers-Supported\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">realgud<i class=\"icon-external\"><\/i><\/a>\u8f7b\u677e\u4e00\u70b9\u3002<\/p>\n<p>\u548cYouCompleteMe\u7b49\u9879\u76ee\u4e00\u6837\uff0ccquery\u9ed8\u8ba4\u4e0b\u8f7d<a class=\" wrap external\" href=\"http:\/\/link.zhihu.com\/?target=http%3A\/\/releases.llvm.org\/download.html\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">prebuilt clang+llvm<i class=\"icon-external\"><\/i><\/a>\uff0c\u5373<code>.h .so .a<\/code>\u3002\u7528\u6237\u4e0d\u9700\u8981\u7f16\u8bd1\u5b8c\u6574\u7684llvm\uff0c\u5f00\u53d1\u95e8\u69db\u6bd4clangd\u4f4e\u3002<\/p>\n<\/div>\n<div class=\"PostIndex-footer\">\n<div class=\"PostIndex-topics TopicItem-wrapper\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528cquery\uff1aC++ languag<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[118],"class_list":["post-820","post","type-post","status-publish","format-standard","hentry","tag-02-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/820","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=820"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/820\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=820"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=820"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=820"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}