├── .gitignore ├── .gitmodules ├── .style.yapf ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── __init__.py ├── autoload └── crcs.vim ├── doc └── crcs.txt ├── format_code.sh ├── plugin └── crcs.vim ├── render ├── __init__.py ├── render.py ├── test_render.py └── testdata │ ├── call-graph-01.json │ ├── call-graph-01.json.actual │ ├── call-graph-01.json.expected │ ├── call-graph-02.json │ ├── call-graph-02.json.actual │ ├── call-graph-02.json.expected │ ├── rebaseline.sh │ ├── search-response-01.json │ ├── search-response-01.json.actual │ ├── search-response-01.json.expected │ ├── search-response-02.json │ ├── search-response-02.json.actual │ ├── search-response-02.json.expected │ ├── search-response-03.json │ ├── search-response-03.json.actual │ ├── search-response-03.json.expected │ ├── search-response-04.json │ ├── search-response-04.json.actual │ ├── search-response-04.json.expected │ ├── xrefs-response-01.json │ ├── xrefs-response-01.json.actual │ ├── xrefs-response-01.json.expected │ ├── xrefs-response-02.json │ ├── xrefs-response-02.json.actual │ ├── xrefs-response-02.json.expected │ ├── xrefs-response-03.json │ ├── xrefs-response-03.json.actual │ └── xrefs-response-03.json.expected ├── resources ├── calls.gif ├── searching.gif ├── tour-targets.gif └── xrefs.gif ├── run_tests.sh ├── vimsupport.py └── vroom ├── basic.vroom ├── default.init.vim ├── responses ├── 24172e13a7560a2ccc1caae190e1cef9165672e3.json ├── 37874fbcd5b2b3e0b7528a20d4fc273d8ee135b7.json ├── 5926aa1370b51dfebeec36a88be39ffd7f8e8070.json ├── aaf2aeaacda5951dbaa14531b363ec23a860d429.json └── e7fe3906a079e8198ca6784851f5a86c535f4b7e.json ├── search.vroom ├── testdata └── src │ ├── .gn │ └── base │ ├── base64.cc │ ├── base64.h │ └── path_service.cc └── xrefs.vroom /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | doc/tags 3 | .mypy_cache 4 | 5 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "third_party/codesearch-py"] 2 | path = third_party/codesearch-py 3 | url = https://github.com/chromium/codesearch-py.git 4 | -------------------------------------------------------------------------------- /.style.yapf: -------------------------------------------------------------------------------- 1 | [style] 2 | based_on_style = chromium 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | **ARCHIVED: As of August 30, 20201 this repository is archived. The service 2 | end-point that this library depended on has been turned down, and as 3 | a consequence this plugin is no longer functional.** 4 | 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // 3 | // Redistribution and use in source and binary forms, with or without 4 | // modification, are permitted provided that the following conditions are 5 | // met: 6 | // 7 | // * Redistributions of source code must retain the above copyright 8 | // notice, this list of conditions and the following disclaimer. 9 | // * Redistributions in binary form must reproduce the above 10 | // copyright notice, this list of conditions and the following disclaimer 11 | // in the documentation and/or other materials provided with the 12 | // distribution. 13 | // * Neither the name of Google Inc. nor the names of its 14 | // contributors may be used to endorse or promote products derived from 15 | // this software without specific prior written permission. 16 | // 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **ARCHIVED: As of August 30, 20201 this repository is archived. The service 2 | end-point that this library depended on has been turned down, and as 3 | a consequence this plugin is no longer functional.** 4 | 5 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Chromium Authors. 2 | # 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file or at 5 | # https://developers.google.com/open-source/licenses/bsd. 6 | -------------------------------------------------------------------------------- /autoload/crcs.vim: -------------------------------------------------------------------------------- 1 | " Copyright 2017 The Chromium Authors. 2 | " 3 | " Use of this source code is governed by a BSD-style 4 | " license that can be found in the LICENSE file or at 5 | " https://developers.google.com/open-source/licenses/bsd. 6 | 7 | " Sets up a buffer for displaying pre-rendered codesearch output. 8 | function! crcs#SetupCodesearchBuffer(bufname, dirname, buftype) 9 | if exists("s:cs_buffer_" . a:buftype) 10 | if bufexists(s:cs_buffer_{a:buftype}) 11 | exec 'buffer' s:cs_buffer_{a:buftype} 12 | 13 | if a:dirname != '' 14 | let b:cs_root_path = a:dirname 15 | endif 16 | exec 'file' fnameescape(a:bufname) 17 | return s:cs_buffer_{a:buftype} 18 | endif 19 | endif 20 | 21 | " Will fail if hidden is not set 22 | enew 23 | let s:cs_buffer_{a:buftype} = bufnr('$') 24 | let b:cs_buftype = a:buftype 25 | 26 | syn clear 27 | syn sync fromstart 28 | 29 | " Include cpp.vim under @embddedC. Currently this is only used to link 30 | " highlight groups that are defined in c.vim and cpp.vim. This way we'll 31 | " hopefully apply the correct theme settings when displaying code snippets. 32 | " 33 | " Optionally we can defer highlighting of embedded code snippets entirely to 34 | " c.vim/cpp.vim by something like: 35 | " syn region csEmbeddedCpp start=... end=... contains=@embddedC 36 | syn include @embddedC $VIMRUNTIME/syntax/cpp.vim 37 | unlet b:current_syntax 38 | 39 | " csMarkedupCode is a generic container for formatted code snippets based on 40 | " codesearch responses. Any markup that's applied based on FormatGroup 41 | " should be described in this section. 42 | syn cluster csFormatGroups contains=csKeyword,csString,csComment,csNumber,csMacro,csClass,csConst,csDeprecatd,csQueryMatch,csLineNum 43 | 44 | syn region csMacro concealends matchgroup=csConceal start=/\^D{/ end=/}D_/ contained 45 | syn region csClass concealends matchgroup=csConceal start=/\^C{/ end=/}C_/ contained 46 | syn region csConst concealends matchgroup=csConceal start=/\^K{/ end=/}K_/ contained 47 | syn region csNumber concealends matchgroup=csConceal start=/\^0{/ end=/}0_/ contained 48 | syn region csEscape concealends matchgroup=csConceal start=/\^\\{/ end=/}\\_/ contained 49 | syn region csString concealends matchgroup=csConceal start=/\^s{/ end=/}s_/ contained contains=@csFormatGroups 50 | syn region csComment concealends matchgroup=csConceal start=/\^c{/ end=/}c_/ contained contains=@csFormatGroups 51 | syn region csKeyword concealends matchgroup=csConceal start=/\^k{/ end=/}k_/ contained 52 | syn region csDeprecatd concealends matchgroup=csConceal start=/\^-{/ end=/}-_/ contained 53 | syn region csQueryMatch concealends matchgroup=csConceal start=/\^\${/ end=/}\$_/ contained 54 | syn match csLineNum /^ *\d*/ contained contains=NONE 55 | syn match csContinuation /\[\.\.\.\]/ contains=NONE 56 | 57 | syn region csMarkedupCode concealends matchgroup=csConceal start=/\^>{/ end=/}>_/ transparent contains=@csFormatGroups 58 | 59 | syn region csQuery concealends matchgroup=csConceal start=/\^q{/ end=/}q_/ 60 | 61 | hi def link csKeyword cStatement 62 | hi def link csString cString 63 | hi def link csComment cComment 64 | hi def link csNumber cNumber 65 | hi def link csMacro cPreProc 66 | hi def link csClass cppStructure 67 | hi def link csConst cConstant 68 | hi def link csEscape cSpecial 69 | hi def link csDeprecatd cSpecial 70 | hi def link csQueryMatch Underlined 71 | hi def link csConceal Conceal 72 | hi def link csLineNum Comment 73 | hi def link csContinuation Comment 74 | hi def link csQuery Special 75 | 76 | " High level syntax groups for describing search results. 77 | if a:buftype ==# 'search' 78 | if has('conceal') 79 | syn region csMatchFileSpec start=/^\d*\. /rs=s end=/\^>{$/me=e-3,re=e contains=csMatchNum,csMatchFileName keepend 80 | else 81 | syn region csMatchFileSpec start=/^\d*\. /rs=s end=/$/ contains=csMatchNum,csMatchFileName keepend 82 | endif 83 | syn match csMatchNum /^\d*\./he=e-1 contained nextgroup=csMatchFileName 84 | syn match csMatchFileName / .*$/hs=s+1 contained 85 | hi def link csMatchFileName Directory 86 | hi def link csMatchNum Number 87 | 88 | nnoremap [[ :call crcs#JumpToNextFile() 89 | nnoremap ]] :call crcs#JumpToPrevFile() 90 | endif 91 | 92 | " Xref results 93 | if a:buftype ==# 'xref' 94 | syn region csCategory concealends matchgroup=csConceal start=/\^Cat{/ end=/}Cat_/ contains=NONE nextgroup=csFilename 95 | syn region csFilename concealends matchgroup=csConceal start=/\^F{/ end=/}F_/ contains=NONE nextgroup=csLine 96 | syn match csLine /^ *\d+:/me=e-1 nextgroup=csMarkedupCode 97 | hi def link csCategory Special 98 | hi def link csLine LineNr 99 | hi def link csFilename Directory 100 | 101 | nnoremap [[ :call crcs#JumpToNextFile() 102 | nnoremap ]] :call crcs#JumpToPrevFile() 103 | endif 104 | 105 | if a:buftype ==# 'call' 106 | syn region csNode concealends matchgroup=csConceal start=/\^N{/ end=/}N_/ contains=csNode,csExpander,csSymbol,csMarkedupCode,csFilename nextgroup=csExpander transparent 107 | syn match csExpander /\[[-+\*]\]/ nextgroup=csSymbol 108 | syn region csSymbol concealends matchgroup=csConceal start=/\^S{/ end=/}S_/ nextgroup=csFilename contained 109 | syn region csFilename concealends matchgroup=csConceal start=/\^F{/ end=/}F_/ contains=NONE nextgroup=csMarkedupCode 110 | 111 | hi def link csExpander Special 112 | hi def link csSymbol Directory 113 | 114 | nnoremap za :call crcs#OpenCallgraphFold() 115 | nnoremap zc :call crcs#CloseCallgraphFold() 116 | endif 117 | 118 | let b:cs_root_path = "" 119 | if a:dirname != '' 120 | let b:cs_root_path = a:dirname 121 | endif 122 | 123 | setlocal buftype=nofile 124 | setlocal noswapfile 125 | setlocal nomodifiable 126 | setlocal nospell 127 | setlocal conceallevel=3 128 | setlocal concealcursor=nc 129 | setlocal cursorline 130 | setlocal nonumber 131 | setlocal norelativenumber 132 | 133 | exec 'file' fnameescape(a:bufname) 134 | exec 'au BufDelete call crcs#OnBufferUnload(expand(""), "' . a:buftype . '")' 135 | 136 | nnoremap :call crcs#JumpToContext() 137 | let b:current_syntax = 'codesearch' 138 | 139 | return s:cs_buffer_{a:buftype} 140 | endfunction 141 | 142 | let s:cs_buffer = -1 143 | let s:initialized = 0 144 | let s:plugin_root = resolve(expand(':p:h:h')) 145 | 146 | " This needs to be called from a BufDelete auto command where |bufnr| is set 147 | " to and the |buftype| is set to the type of the buffer. 148 | function! crcs#OnBufferUnload(bufnr, buftype) 149 | if s:cs_buffer_{a:buftype} == a:bufnr 150 | let s:cs_buffer_{a:buftype} = -1 151 | endif 152 | exec 'py' 'CleanupBuffer(' . a:bufnr . ')' 153 | endfunction 154 | 155 | function! crcs#Setup() 156 | if s:initialized 157 | return 158 | endif 159 | let s:initialized = 1 160 | 161 | py import sys 162 | py import os 163 | exec "py CR_CS_PYTHON_ROOT = r'" . s:plugin_root . "'" 164 | exec "pyf" fnameescape(s:plugin_root . "/vimsupport.py") 165 | 166 | if !has('conceal') 167 | py DisableConcealableMarkup() 168 | endif 169 | 170 | if !has('hidden') 171 | endif 172 | endfunction 173 | 174 | function! crcs#CodeSearch(query) 175 | call crcs#Setup() 176 | exec 'py' 'RunCodeSearch("' . escape(a:query, '"') . '")' 177 | endfunction 178 | 179 | function! crcs#JumpToContext() 180 | " Should only be called after initialization. Check just in case. 181 | if s:initialized != 1 182 | return 183 | endif 184 | py JumpToContext() 185 | endfunction 186 | 187 | function! crcs#XrefSearch() 188 | call crcs#Setup() 189 | py RunXrefSearch() 190 | endfunction 191 | 192 | function! crcs#Callgraph() 193 | call crcs#Setup() 194 | py RunCallgraphSearch() 195 | endfunction 196 | 197 | function! crcs#JumpToCallers() 198 | call crcs#Setup() 199 | let l:callers=pyeval('GetCallers()') 200 | if l:callers != '' 201 | cexpr l:callers 202 | endif 203 | endfunction 204 | 205 | function! crcs#JumpToNextFile() 206 | py JumpToNextFile() 207 | endfunction 208 | 209 | function! crcs#JumpToPrevFile() 210 | py JumpToPrevFile() 211 | endfunction 212 | 213 | function! crcs#RefTypeCompleter(arglead, cmdline, cursorpos) 214 | call crcs#Setup() 215 | return pyeval("ReferenceTypeCompleter('" . a:arglead . "', '" . a:cmdline . "', '" . a:cursorpos . "')") 216 | endfunction 217 | 218 | function! crcs#GoToRef(t) 219 | call crcs#Setup() 220 | let l:refs = pyeval("GetReferences('" . a:t . "')") 221 | if length(l:refs) != 0 222 | cexpr l:refs 223 | endif 224 | endfunction 225 | 226 | function! crcs#ShowAnnotationsHere() 227 | call crcs#Setup() 228 | py ShowAnnotationsHere() 229 | endfunction 230 | 231 | function! crcs#ShowSignature() 232 | call crcs#Setup() 233 | py ShowSignature() 234 | endfunction 235 | 236 | function! crcs#OpenCallgraphFold() 237 | " Should only be called from a callgraph buffer. 238 | py RunCallgraphSearch() 239 | endfunction 240 | 241 | function! crcs#CloseCallgraphFold() 242 | " Should only be called from a callgraph buffer. 243 | py CloseCallgraphFold() 244 | endfunction 245 | 246 | function! crcs#PrepareForTesting() 247 | call crcs#Setup() 248 | py PrepareForTesting() 249 | endfunction 250 | -------------------------------------------------------------------------------- /doc/crcs.txt: -------------------------------------------------------------------------------- 1 | *crcs.txt* Vim integration for Chromium CodeSearch 2 | 3 | 1. Warnings |crcs-warnings| 4 | 2. Overview |crcs-overview| 5 | 3. Commands |crcs-commands| 6 | 4. Search results buffer |crcs-search-buffer| 7 | 5. Cross references buffer |crcs-xref-buffer| 8 | 6. Call graph buffer |crcs-call-graph-buffer| 9 | 7. Tours |crcs-tours| 10 | 8. Settings |crcs-settings| 11 | 9. Default key bindings |crcs-default-keybindings| 12 | 10. Contributing and bugs |crcs-bugs| 13 | 14 | This plugin is not supported by the Chromium team. It's maintained by 15 | volunteers. If you run into any problems, please contact one of the folks in 16 | the `OWNERS` file for assistance. As always, patches welcome. 17 | 18 | ============================================================================== 19 | WARNINGS *crcs-warnings* 20 | 21 | NOTE: This plugin makes network requests to the codesearch server. This may 22 | not jive with the privacy expectations of a text editor. If you need a code 23 | indexing solution that doesn't depend on a live internet connection, or y'know 24 | possibly broadcast what you are working on, then this is not going to work. 25 | > 26 | ^^^ Lookie there ^^^ Read the warning ^^^ 27 | < 28 | NOTE: Effective use of the plugin requires a recent checkout. The codesearch 29 | data is refreshed every couple of hours. The plugin relies on the local 30 | checkout for navigating through search results. If there's a large difference 31 | between the locally checked out source files and the files as known to code 32 | search, then you'll see confusing behavior. 33 | 34 | ============================================================================== 35 | OVERVIEW *crcs-overview* 36 | 37 | Congratulations! You've successfully installed the Chromium codesearch plugin. 38 | In addition to having approximate feature parity with http://cs.chromium.org, 39 | this plugin aims to be a platform for building editor features that are backed 40 | by Chromium codesearch data. 41 | 42 | Here's a quick overview of basic functionality: 43 | 44 | Start by visiting a file inside your Chromium checkout. This would be file 45 | under `src/`. The plugin uses the path of the current buffer, failing which, 46 | the current directory to locate the Chromium checkout. (See |crcs-settings| 47 | for details on how to configure how the plugin locates the Chromium checkout). 48 | 49 | Now start a search: 50 | > 51 | :CrSearch hello world 52 | 53 | No quotes or whitespace escapes are needed when including whitespace. 54 | Everything after `:CrSearch` is passed along as the search string. You'll be 55 | taken to a search results buffer. (See |crcs-results-buffer| for more 56 | information about this mode). Here you can navigate using your favorite Vim 57 | keybindings and his to jump directly to the source file corresponding 58 | to the search result. 59 | 60 | Let's try looking up a call graph. 61 | 62 | 1. Open a `.cc` file. Say `src/base/logging.cc`. 63 | 2. Locate a function definition. Place your cusor on the identifier. 64 | 3. Invoke a callgraph search: 65 | > 66 | :CrCallgraph 67 | 68 | This should take you to the call graph buffer. (See |crcs-call-graph-buffer| 69 | for more information about this mode). Much like the search results buffer, 70 | you can hit on a search result to jump to the source file 71 | corresponding to the search result. 72 | 73 | Also, try out a cross reference search. 74 | 75 | 1. Open a `.cc` file, or a `.h` file. Say `src/base/logging.cc` 76 | 2. Place your cursor on some symbol. 77 | 3. Invoke a cross reference search: > 78 | 79 | :CrXrefSearch 80 | 81 | The command takes you to the cross reference buffer showing the references 82 | that code search knows about. (See |crcs-xref-buffer| for more details about 83 | this mode). 84 | 85 | ============================================================================== 86 | COMMANDS *crcs-commands* 87 | 88 | *:CrSearch* 89 | :CrSearch {search-terms} Invokes a code search for {search-terms} which 90 | may contain whitespace. In addition to free 91 | text search, the CodeSearch backend supports 92 | several additional search tags. E.g.: 93 | > 94 | class:base::File 95 | symbol:std::vector 96 | file:(code|[^or]g)search 97 | < 98 | As can be seen, the search terms may contain 99 | regular expressions. 100 | 101 | The search results will be presented in search 102 | results buffer which is explained in 103 | |crcs-results-buffer|. 104 | 105 | *:CrXrefSearch* 106 | :CrXrefSearch Invokes a cross reference search for the 107 | symbol under the cursor. The current buffer 108 | must be inside a Chromium checkout and the 109 | corrsponding file should be known to the code 110 | search backend. 111 | 112 | Results are displayed in a cross reference 113 | buffer which is explained in 114 | |crcs-xref-buffer|. 115 | 116 | 117 | *:CrCallGraph* 118 | :CrCallGraph Invokes a call graph search for the symbol 119 | under the cursor. Similar to `:CrXrefSearch`, 120 | the current buffer must be inside a Chromium 121 | checkout and the corresponding file should be 122 | known to the code search backend. 123 | 124 | Results are displayed in a call graph buffer 125 | which is explained in |crcs-call-graph-buffer|. 126 | 127 | *:CrTour* 128 | :CrTour {tour-type} Start a code tour of the specified type based 129 | on the symbol under the cursor. As always, the 130 | current buffer must be inside a Chromium 131 | checkout and the corresponding file should be 132 | known to the code search backend. 133 | 134 | Based on {tour-type}, the command loads a 135 | list of locations to the |quickfix| list. You 136 | can use your favorite quickfix navigation 137 | techniques to navigate the tour. 138 | 139 | The list of {tour-type}s is discussed in 140 | |crcs-tours|. 141 | 142 | ============================================================================== 143 | SEARCH RESULTS BUFFER *crcs-search-buffer* 144 | 145 | The |:CrSearch| command uses this type of buffer to render code search 146 | results. In addition to regular text mode keybindings, the following 147 | keybindings are available: 148 | 149 | Jump to context. If the cursor is on a 150 | filename or a snippet, pressing loads the 151 | corresponding source file and jumps to the 152 | corresponding location. 153 | 154 | [[ Jump to search results from the next file. 155 | 156 | ]] Jump to search results from the previous file. 157 | 158 | ============================================================================== 159 | CROSS REFERENCES BUFFER *crcs-xref-buffer* 160 | 161 | The |:CrXrefSearch| command uses this type of buffer to render cross 162 | references. 163 | 164 | Jump to context. If the cursor is on a 165 | filename or a snippet, pressing loads the 166 | corresponding source file and jumps to the 167 | corresponding location. 168 | 169 | [[ Jump to search results from the next file. 170 | 171 | ]] Jump to search results from the previous file. 172 | 173 | ============================================================================== 174 | CALL GRAPH BUFFER *crcs-call-graph-buffer* 175 | 176 | The |:CrCallgraph| command uses this type of buffer to render call graphs. In 177 | addition to regular text mode keybindings, the following keybindings are 178 | available: 179 | 180 | Jump to context. If the cursor is on a 181 | filename or a snippet, pressing loads the 182 | corresponding source file and jumps to the 183 | corresponding location. 184 | 185 | za Expand the call graph at the node under the 186 | cursor. 187 | 188 | zc Collapse the call graph at the node under the 189 | cursor. 190 | 191 | Nodes for which the callgraph hasn't been expanded are indicated with `[+]`, 192 | while expanded nodes are indicated with `[-]`. A `[*]` means that there are no 193 | callers for the corresponding node. 194 | 195 | ============================================================================== 196 | TOURS *crcs-tours* 197 | 198 | Tours are just a fancy term for an operation that loads bunch of locations in 199 | the codebase to the |quickfix| list. Such an operation is useful in a number 200 | of scenarios, which is why this concept exists. 201 | 202 | When invoking the |:CrTour| command, you can choose from a number of tour 203 | types as described below: 204 | 205 | *crcs-tour-caller* *crcs-tour-called-at* 206 | `caller` or `called` `at` Visits all the known call sites for the symbol 207 | under the cursor. > 208 | 209 | :CrTour caller 210 | :CrTour called at 211 | < 212 | 213 | *crcs-tour-call-targets* 214 | `call` `targets` Visits the possible targets of the function 215 | call or method invocation under the cursor. 216 | If the method invocation is for a virtual 217 | method, then visits all possible overrides of 218 | the method. > 219 | 220 | :CrTour call targets 221 | 222 | < 223 | *crcs-tour-declaration* 224 | `declaration` Jumps to the declaration for the symbol under 225 | the cursor. 226 | > 227 | :CrTour declaration 228 | < 229 | 230 | *crcs-tour-definition* 231 | `definition` Jumps to the definition of the symbol under 232 | the cursor. 233 | > 234 | :CrTour definition 235 | < 236 | 237 | *crcs-tour-instantiations* 238 | `instantiations` Loads the locations of the known 239 | instantiations of the class under the cursor. 240 | > 241 | :CrTour instantiations 242 | < 243 | *crcs-tour-overridden-by* 244 | `overridden` `by` Navigates to the classes or methods that 245 | override the symbol under the cursor. 246 | > 247 | :CrTour overridden by 248 | < 249 | *crcs-tour-overrides* 250 | `overrides` Navigates to the class or method that the 251 | symbol under the cursor overrides. 252 | > 253 | :CrTour overrides 254 | < 255 | ============================================================================== 256 | SETTINGS *crcs-settings* 257 | 258 | `g:codesearch_default_bindings` If set to a non-zero value, causes the default 259 | keybindings to be bound globally at Vim 260 | startup. See |crcs-default-keybindings|. 261 | 262 | `g:codesearch_source_root` Set this to the directory above the root of 263 | the local Chromium checkout. If this setting 264 | is not present, then the root of the source 265 | checkout will be determined based on the path 266 | of the current buffer. 267 | 268 | E.g. If you have Chromium checked out at 269 | `~/src/chrome/src` such that 270 | `~/src/chrome/src/.gn` file exists:, then 271 | `g:codesearch_source_root` should be set to 272 | `~/src/chrome/`. 273 | 274 | ============================================================================== 275 | DEFAULT KEY BINDINGS *crcs-default-keybindings* 276 | 277 | You almost never should be using the default key bindings since they use the 278 | prefix. Instead consider binding the |crcs-commands| directly 279 | yourself. 280 | 281 | The default keybindings are: 282 | 283 | s |:CrSearch| 284 | x |:CrXrefSearch| 285 | g |:CrCallgraph| 286 | j |:CrLoadCallers| 287 | gd |:CrTour| `declarations` 288 | gD |:CrTour| `definitions` 289 | l |:CrTour| 290 | 291 | ============================================================================== 292 | BUGS *crcs-bugs* 293 | 294 | You will no doubt run into bugs. Please file issues at 295 | https://github.com/chromium/vim-codesearch 296 | 297 | vim:tw=78:ts=8:ft=help:norl: 298 | 299 | 300 | -------------------------------------------------------------------------------- /format_code.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Copyright 2017 The Chromium Authors. 4 | # 5 | # Use of this source code is governed by a BSD-style 6 | # license that can be found in the LICENSE file or at 7 | # https://developers.google.com/open-source/licenses/bsd. 8 | 9 | # Run this script after making a change to a .py file to reformat it according 10 | # to the Chromium style guide. In case you are curious, the .style.yapf file at 11 | # the root of the source tree defines the style that YAPF applies to code it 12 | # finds in the repository. 13 | 14 | command -v yapf >/dev/null 2>&1 || { 15 | echo Please install YAPF if you would like to format code. 16 | echo https://github.com/google/yapf 17 | exit 1 18 | } 19 | 20 | yapf -i -r . 21 | echo Don\'t forget to \'git commit\' any changed files. 22 | 23 | -------------------------------------------------------------------------------- /plugin/crcs.vim: -------------------------------------------------------------------------------- 1 | " Copyright 2017 The Chromium Authors. 2 | " 3 | " Use of this source code is governed by a BSD-style 4 | " license that can be found in the LICENSE file or at 5 | " https://developers.google.com/open-source/licenses/bsd. 6 | 7 | if ! &hidden 8 | echoerr "'set hidden' is required for correct functionality of Chromium CodeSearch." 9 | endif 10 | 11 | command! -nargs=1 CrSearch call crcs#CodeSearch() 12 | command! CrXrefSearch call crcs#XrefSearch() 13 | command! CrCallgraph call crcs#Callgraph() 14 | command! CrLoadCallers call crcs#JumpToCallers() 15 | command! CrShowSignature call crcs#ShowSignature() 16 | 17 | command! -nargs=1 -complete=customlist,crcs#RefTypeCompleter CrTour call crcs#GoToRef() 18 | 19 | if has_key(g:, 'codesearch_default_bindings') && g:codesearch_default_bindings 20 | nnoremap s :CrSearch 21 | nnoremap x :CrXrefSearch 22 | nnoremap g :CrCallgraph 23 | nnoremap j :CrLoadCallers 24 | nnoremap gd :CrTour declarations 25 | nnoremap gD :CrTour definitions 26 | nnoremap l :CrTour 27 | endif 28 | 29 | -------------------------------------------------------------------------------- /render/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Chromium Authors. 2 | # 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file or at 5 | # https://developers.google.com/open-source/licenses/bsd. 6 | -------------------------------------------------------------------------------- /render/render.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Chromium Authors. 2 | # 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file or at 5 | # https://developers.google.com/open-source/licenses/bsd. 6 | 7 | import os 8 | import sys 9 | import re 10 | from contextlib import contextmanager 11 | 12 | import codesearch as cs 13 | 14 | # For type checking. Not needed at runtime. 15 | try: 16 | from typing import Any, Optional, List, Dict, Union, Type, Tuple 17 | except ImportError: 18 | pass 19 | 20 | SNIPPET_INDENT = 4 21 | 22 | TAG_START_FORMAT = '^{:s}{{' 23 | TAG_END_FORMAT = '}}{:s}_' 24 | 25 | 26 | def StartTag(s): 27 | assert isinstance(s, str) 28 | return TAG_START_FORMAT.format(s) 29 | 30 | 31 | def EndTag(s): 32 | assert isinstance(s, str) 33 | return TAG_END_FORMAT.format(s) 34 | 35 | 36 | RE_BLOCK_START_META = re.compile(r'\^[^{]+{') 37 | RE_BLOCK_END_META = re.compile(r'}[^_]+_') 38 | 39 | 40 | def CountBlockMarkupOverhead(s): 41 | # type: (str) -> int 42 | """\ 43 | Return the number of characters that have been used up by |s| for 44 | markup. 45 | 46 | Only counts complete tags. I.e. "^S{foo}S_" will 47 | return 6: 48 | 49 | >>> CountBlockMarkupOverhead("^S{foo}S_") 50 | 6 51 | 52 | , but CountBlockMarkupOverhead("^S{foo}S") will return 3. 53 | 54 | >>> CountBlockMarkupOverhead("^S{foo}S") 55 | 3 56 | """ 57 | return len(''.join(RE_BLOCK_START_META.findall(s))) + \ 58 | len(''.join(RE_BLOCK_END_META.findall(s))) 59 | 60 | 61 | @contextmanager 62 | def TaggedBlock(mapper, block_type): 63 | '''\ 64 | Context for writing the contents of a tagged block. Automatically writes the 65 | start and end blocks with no additional newlines. 66 | 67 | Use as: 68 | with TaggedBlock(mapper, 'x'): 69 | mapper.write(...) 70 | ''' 71 | mapper.write(StartTag(block_type)) 72 | yield 73 | mapper.write(EndTag(block_type)) 74 | 75 | 76 | class LocationMapper(object): 77 | 78 | def __init__(self): 79 | self.jump_map_ = {} 80 | self.signature_map_ = {} 81 | self.lines_ = [''] 82 | 83 | def SetSignatureForLine(self, sig): 84 | current_line = len(self.lines_) - 1 85 | self.signature_map_[current_line] = sig 86 | 87 | def SetTargetForPos(self, fn, line): 88 | assert line > 0 89 | current_line = len(self.lines_) - 1 90 | self.jump_map_[current_line] = (fn, line - 1, self.column()) 91 | 92 | def column(self): 93 | return len(self.lines_[-1]) 94 | 95 | def write(self, s): 96 | assert isinstance(s, str) 97 | lines = s.split('\n') 98 | self.lines_[-1] += lines[0] 99 | self.lines_.extend(lines[1:]) 100 | 101 | def newline(self): 102 | self.lines_.extend(['']) 103 | 104 | def Lines(self): 105 | return self.lines_ 106 | 107 | def JumpTargetAt(self, line, column): 108 | # line and column are counting from 1 109 | assert line > 0 110 | assert column > 0 111 | line -= 1 112 | column -= 1 113 | if line not in self.jump_map_: 114 | candidates = [l for l in self.jump_map_.keys() if l < line] 115 | if len(candidates) == 0: 116 | return None 117 | line = max(candidates) 118 | filename, target_line, offset_column = self.jump_map_[line] 119 | if offset_column < column: 120 | overhead = CountBlockMarkupOverhead( 121 | self.lines_[line][offset_column:column]) 122 | target_column = column - offset_column - overhead 123 | assert target_column >= 0 124 | else: 125 | target_column = 0 126 | return (filename, target_line + 1, target_column + 1) 127 | 128 | def PreviousFileLocation(self, line): 129 | current_file, _, _ = self.jump_map_.get(line, ('', 0, 0)) 130 | 131 | line -= 2 132 | while line >= 1: 133 | f, _, _ = self.jump_map_.get(line, ('', 0, 0)) 134 | if f and f != current_file: 135 | new_file = f 136 | break 137 | line -= 1 138 | 139 | old_line = line 140 | line -= 1 141 | while line >= 1: 142 | f, _, _ = self.jump_map_.get(line, ('', 0, 0)) 143 | if f != new_file: 144 | return old_line + 1 145 | old_line = line 146 | line -= 1 147 | return 1 148 | 149 | def NextFileLocation(self, line): 150 | original_line = line 151 | current_file, _, _ = self.jump_map_.get(line, ('', 0, 0)) 152 | while line <= len(self.lines_): 153 | f, _, _ = self.jump_map_.get(line, ('', 0, 0)) 154 | if f and f != current_file: 155 | return line + 1 156 | line += 1 157 | return original_line 158 | 159 | def SignatureAt(self, line): 160 | assert line > 0 161 | line -= 1 162 | if line not in self.signature_map_: 163 | candidates = [l for l in self.signature_map_.keys() if l < line] 164 | if len(candidates) == 0: 165 | return None 166 | 167 | line = max(candidates) 168 | return self.signature_map_[line] 169 | 170 | 171 | def GetBlockTypeFromFormatType(r): 172 | return { 173 | cs.FormatType.SYNTAX_KEYWORD: 'k', 174 | cs.FormatType.SYNTAX_STRING: 's', 175 | cs.FormatType.SYNTAX_COMMENT: 'c', 176 | cs.FormatType.SYNTAX_NUMBER: '0', 177 | cs.FormatType.SYNTAX_MACRO: 'D', 178 | cs.FormatType.SYNTAX_CLASS: 'C', 179 | cs.FormatType.SYNTAX_CONST: 'K', 180 | cs.FormatType.SYNTAX_ESCAPE_SEQUENCE: '\\', 181 | cs.FormatType.SYNTAX_DEPRECATED: '-', 182 | cs.FormatType.SYNTAX_KEYWORD_STRONG: 'k', 183 | cs.FormatType.QUERY_MATCH: '$', 184 | cs.FormatType.SNIPPET_QUERY_MATCH: '$' 185 | }.get(r, None) 186 | 187 | 188 | def RenderAnnotatedText(mapper, 189 | annotated_text, 190 | indent, 191 | filename, 192 | first_line_number=1): 193 | text_lines = annotated_text.text.split('\n') 194 | 195 | # Max number of digits it takes to represent the line number 196 | line_number_width = len(str(first_line_number + len(text_lines) - 1)) 197 | 198 | insertions = [] 199 | 200 | for r in annotated_text.range: 201 | block_type = GetBlockTypeFromFormatType(r.type) 202 | if block_type is None: 203 | continue 204 | if r.range.end_column == 1 and r.range.start_line != r.range.end_line: 205 | r.range.end_line -= 1 206 | r.range.end_column = len(text_lines[r.range.end_line - 1]) + 1 207 | insertions.append( 208 | (r.range.end_line, r.range.end_column, EndTag(block_type))) 209 | insertions.append( 210 | (r.range.start_line, r.range.start_column, StartTag(block_type))) 211 | 212 | insertions.sort(lambda i1, i2: i2[0] - i1[0] 213 | if i2[0] != i1[0] else i2[1] - i1[1]) 214 | 215 | for line, column, tag in insertions: 216 | assert line > 0 217 | assert column > 0 218 | line -= 1 219 | column -= 1 220 | text = text_lines[line] 221 | text_lines[line] = text[:column] + tag + text[column:] 222 | 223 | for index, text in enumerate(text_lines): 224 | mapper.newline() 225 | mapper.write(' ' * indent) 226 | mapper.write('{:{}d} '.format(index + first_line_number, line_number_width)) 227 | mapper.SetTargetForPos(filename, index + first_line_number) 228 | mapper.write(text) 229 | 230 | 231 | def RenderSnippet(mapper, 232 | s_index, 233 | snippet, 234 | filename, 235 | level=1, 236 | aux_first_line_number=1): 237 | first_line_number = snippet.first_line_number if snippet.first_line_number else aux_first_line_number 238 | if s_index != 0: 239 | mapper.newline() 240 | mapper.write(' ' * SNIPPET_INDENT * level) 241 | mapper.write('[...]') 242 | mapper.SetTargetForPos(filename, first_line_number) 243 | RenderAnnotatedText(mapper, snippet.text, SNIPPET_INDENT * level, filename, 244 | first_line_number) 245 | 246 | 247 | def RenderSearchResult(mapper, index, search_result): 248 | filename = search_result.top_file.file.name 249 | mapper.SetTargetForPos(filename, 1) 250 | mapper.write('{}. {}'.format(index + 1, filename)) 251 | for s_index, snippet in enumerate(search_result.snippet): 252 | with TaggedBlock(mapper, '>'): 253 | RenderSnippet(mapper, s_index, snippet, filename) 254 | mapper.newline() 255 | 256 | 257 | def RenderSearchResponse(mapper, query, search_response): 258 | assert isinstance(search_response, cs.SearchResponse) 259 | 260 | if search_response.search_result: 261 | mapper.write('CodeSearch results for ') 262 | with TaggedBlock(mapper, 'q'): 263 | mapper.write(query) 264 | mapper.newline() 265 | mapper.newline() 266 | 267 | for index, result in enumerate(search_response.search_result): 268 | RenderSearchResult(mapper, index + search_response.results_offset, result) 269 | mapper.newline() 270 | 271 | if search_response.hit_max_results: 272 | mapper.write( 273 | 'Search results are truncated. Showing {} results out of an estimated {}.' 274 | .format( 275 | len(search_response.search_result), 276 | search_response.estimated_total_number_of_results)) 277 | mapper.newline() 278 | else: 279 | mapper.write('No results for query ') 280 | with TaggedBlock(mapper, 'q'): 281 | mapper.write(query) 282 | mapper.newline() 283 | mapper.newline() 284 | 285 | if search_response.status_message: 286 | mapper.write('Server status: {}'.format(search_response.status_message)) 287 | mapper.newline() 288 | mapper.write('Status code : {}'.format(search_response.status)) 289 | mapper.newline() 290 | 291 | 292 | def RenderXrefResults(mapper, results): 293 | 294 | def XrefResultSorter(r1, r2): 295 | if r1[0].name == r2[0].name: 296 | return cmp(r1[1].line_number, r2[1].line_number) 297 | return cmp(r1[0].name, r2[0].name) 298 | 299 | results.sort(cmp=XrefResultSorter) 300 | 301 | last_fn = None 302 | for result in results: 303 | fn, m = result 304 | if fn.name != last_fn: 305 | if last_fn is not None: 306 | mapper.newline() 307 | last_fn = fn.name 308 | mapper.write(' ' * 2) 309 | mapper.SetTargetForPos(fn.name, 1) 310 | with TaggedBlock(mapper, 'F'): 311 | mapper.write(fn.name) 312 | mapper.newline() 313 | mapper.write('{indent:s}{line:d}: '.format( 314 | indent=' ' * 4, line=m.line_number)) 315 | mapper.SetTargetForPos(last_fn, m.line_number) 316 | with TaggedBlock(mapper, '>'): 317 | mapper.write(m.line_text) 318 | mapper.newline() 319 | 320 | 321 | def RenderXrefSearchResponse(mapper, xref_search_response): 322 | # Failed? 323 | if xref_search_response.status != 0: 324 | mapper.write('No results for query\n') 325 | if xref_search_response.status_message: 326 | mapper.write('Server status: {}'.format( 327 | xref_search_response.status_message)) 328 | mapper.write('Status code : {}'.format(xref_search_response.status)) 329 | return 330 | 331 | class Bin: 332 | 333 | def __init__(self, name, order): 334 | self.name = name 335 | self.order = order 336 | 337 | # Each element in the list is a tuple, of which the first element 338 | # is a cs.FileSpec, and the second element is a XrefSingleMatch. 339 | self.bin = [] 340 | 341 | collectors = { 342 | cs.KytheXrefKind.DEFINITION: Bin('Definition', 1), 343 | cs.KytheXrefKind.DECLARATION: Bin('Declaration', 2), 344 | cs.KytheXrefKind.CALLED_BY: Bin('Called by', 3), 345 | cs.KytheXrefKind.INSTANTIATION: Bin('Instantiations', 4), 346 | cs.KytheXrefKind.OVERRIDDEN_BY: Bin('Overridden by', 5), 347 | cs.KytheXrefKind.OVERRIDES: Bin('Overrides', 6), 348 | cs.KytheXrefKind.EXTENDED_BY: Bin('Extended by', 7), 349 | cs.KytheXrefKind.EXTENDS: Bin('Extends', 8), 350 | cs.KytheXrefKind.GENERATES: Bin('Generates', 9), 351 | cs.KytheXrefKind.GENERATED_BY: Bin('Generated by', 10), 352 | cs.KytheXrefKind.ANNOTATES: Bin('Annotates', 11), 353 | cs.KytheXrefKind.ANNOTATED_BY: Bin('Annotated by', 12), 354 | 355 | # Everything else. 356 | 0: Bin('References', 100) 357 | } 358 | 359 | for search_result in xref_search_response.search_result: 360 | for match in search_result.match: 361 | if match.type_id in collectors: 362 | target_bin = collectors[match.type_id] 363 | else: 364 | target_bin = collectors[0] 365 | target_bin.bin.append((search_result.file, match)) 366 | 367 | bins = collectors.values() 368 | bins.sort(key=lambda b: b.order) 369 | 370 | for ref_bin in bins: 371 | if len(ref_bin.bin) == 0: 372 | continue 373 | with TaggedBlock(mapper, 'Cat'): 374 | mapper.write('{}:\n'.format(ref_bin.name)) 375 | RenderXrefResults(mapper, ref_bin.bin) 376 | mapper.newline() 377 | 378 | 379 | NODE_INDENT = 4 380 | 381 | 382 | # Shorten display names by adding elided sections for template parameters. 383 | def AbbreviateCppSymbol(s): 384 | s = s.replace('', '{}') 385 | short = '' 386 | template_count = 0 387 | for c in s: 388 | if c == '>': 389 | template_count -= 1 390 | 391 | if template_count == 0: 392 | short += c 393 | 394 | if c == '<': 395 | template_count += 1 396 | if template_count == 1: 397 | short += '...' 398 | return short 399 | 400 | 401 | def RenderNode(mapper, node, level): 402 | 403 | with TaggedBlock(mapper, 'N'): 404 | # Rendered text looks like: 405 | # 406 | # [-] namespace::Bar() (filename.cc) 407 | # 38 InvokeBaz(1, 2, true); 408 | # 409 | # [+] Quux() (filename.cc) 410 | # 10 Bar() 411 | # 412 | 413 | # Widget 414 | mapper.SetSignatureForLine(node.signature) 415 | 416 | if node.children: 417 | expander = '[-]' if len(node.children) > 0 else ' * ' 418 | else: 419 | expander = '[+]' 420 | 421 | mapper.write('{indent}{expander} '.format( 422 | indent=' ' * (level * NODE_INDENT), expander=expander)) 423 | 424 | # Symbol 425 | if node.file_path and node.identifier: 426 | with TaggedBlock(mapper, 'S'): 427 | if node.call_scope_range.start_line: 428 | start_line = node.call_scope_range.start_line 429 | elif node.call_site_range.start_line: 430 | start_line = node.call_site_range.start_line 431 | else: 432 | start_line = 1 433 | mapper.SetTargetForPos(node.file_path, start_line) 434 | mapper.write(AbbreviateCppSymbol(node.identifier)) 435 | mapper.write(' ') 436 | with TaggedBlock(mapper, 'F'): 437 | mapper.write(node.file_path) 438 | 439 | # Render snippet 440 | if node.snippet_file_path: 441 | aux_first_line_number = node.call_site_range.start_line \ 442 | if node.call_site_range.start_line else 1 443 | with TaggedBlock(mapper, '>'): 444 | RenderSnippet(mapper, 0, node.snippet, node.snippet_file_path, 445 | level + 1, aux_first_line_number) 446 | mapper.newline() 447 | else: 448 | mapper.newline() 449 | 450 | # Add some padding. Otherwise it looks too "busy". 451 | mapper.newline() 452 | 453 | for c in node.children: 454 | RenderNode(mapper, c, level + 1) 455 | 456 | 457 | def RenderCompoundResponse(compound_response, query): 458 | mapper = LocationMapper() 459 | 460 | if compound_response.search_response: 461 | assert isinstance(compound_response.search_response, list) 462 | assert len(compound_response.search_response) == 1 463 | RenderSearchResponse(mapper, query, compound_response.search_response[0]) 464 | 465 | elif compound_response.xref_search_response: 466 | assert isinstance(compound_response.xref_search_response, list) 467 | assert len(compound_response.xref_search_response) == 1 468 | RenderXrefSearchResponse(mapper, compound_response.xref_search_response[0]) 469 | 470 | elif compound_response.call_graph_response: 471 | assert isinstance(compound_response.call_graph_response, list) 472 | assert len(compound_response.call_graph_response) == 1 473 | RenderNode(mapper, compound_response.call_graph_response[0].node, 0) 474 | 475 | else: 476 | raise Exception("Unknown response type") 477 | 478 | return mapper 479 | 480 | 481 | def DisableConcealableMarkup(): 482 | global TAG_START_FORMAT 483 | global TAG_END_FORMAT 484 | 485 | TAG_START_FORMAT = '' 486 | TAG_END_FORMAT = '' 487 | -------------------------------------------------------------------------------- /render/test_render.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Chromium Authors. 2 | # 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file or at 5 | # https://developers.google.com/open-source/licenses/bsd. 6 | 7 | import json 8 | import sys 9 | import unittest 10 | import os 11 | 12 | SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) 13 | sys.path.append(SCRIPT_DIR) 14 | 15 | CODESEARCH_DIR = os.path.join( 16 | os.path.dirname(SCRIPT_DIR), 'third_party', 'codesearch-py') 17 | sys.path.append(CODESEARCH_DIR) 18 | 19 | import render as r 20 | import codesearch as cs 21 | 22 | 23 | def TestDataPath(p): 24 | return os.path.join(SCRIPT_DIR, 'testdata', p) 25 | 26 | 27 | def LocationMapToString(l): 28 | s = [ 29 | '''\ 30 | This file contains the rendered output per line and its associated metadata. 31 | 32 | Lines that begin with a line number contains (after the '|') the contents that 33 | will be inserted into the vim buffer at that line. The immediately following 34 | line contains an object representing associated metadata. 35 | ------------------------------------------------------------------------------- 36 | ''' 37 | ] 38 | for index, line in enumerate(l.Lines()): 39 | o = {} 40 | if index in l.jump_map_: 41 | o['j'] = l.jump_map_[index] 42 | if index in l.signature_map_: 43 | o['s'] = l.signature_map_[index] 44 | s.append('{:03d}|{}\n |{}'.format(index + 1, line, str(o))) 45 | return '\n'.join(s) + '\n' 46 | 47 | 48 | class TestRenderers(unittest.TestCase): 49 | 50 | def run_render_test(self, test_file_name, query='unspecified'): 51 | with open(TestDataPath(test_file_name), 'r') as f: 52 | d = json.load(f) 53 | m = cs.Message.Coerce(d, cs.CompoundResponse) 54 | location_map = r.RenderCompoundResponse(m, query) 55 | serialized = LocationMapToString(location_map) 56 | with open(TestDataPath(test_file_name + '.actual'), 'w') as f: 57 | f.write(serialized) 58 | with open(TestDataPath(test_file_name + '.expected'), 'r') as f: 59 | expected = f.read() 60 | self.assertMultiLineEqual(expected, serialized) 61 | return location_map 62 | 63 | def test_search_response_01(self): 64 | l_map = self.run_render_test('search-response-01.json') 65 | 66 | fn, l, c = l_map.JumpTargetAt(50, 1) 67 | self.assertEqual('src/chrome/browser/download/download_prefs.cc', fn) 68 | self.assertEqual(409, l) 69 | self.assertEqual(1, c) 70 | 71 | _, _, c = l_map.JumpTargetAt(50, 30) 72 | self.assertEqual(16, c) 73 | 74 | def test_search_response_02(self): 75 | l_map = self.run_render_test('search-response-02.json') 76 | 77 | fn, l, c = l_map.JumpTargetAt(22, 1) 78 | self.assertEqual('src/base/at_exit.cc', fn) 79 | self.assertEqual(96, l) 80 | self.assertEqual(1, c) 81 | 82 | self.assertEqual(3, l_map.NextFileLocation(1)) 83 | self.assertEqual(1, l_map.PreviousFileLocation(1)) 84 | self.assertEqual(3, l_map.PreviousFileLocation(35)) 85 | self.assertEqual(35, l_map.PreviousFileLocation(45)) 86 | self.assertEqual(45, l_map.NextFileLocation(45)) 87 | 88 | def test_search_response_03(self): 89 | self.run_render_test('search-response-03.json') 90 | 91 | def test_search_response_04(self): 92 | self.run_render_test('search-response-04.json') 93 | 94 | def test_xref_search_response_01(self): 95 | self.run_render_test('xrefs-response-01.json') 96 | 97 | def test_xref_search_response_02(self): 98 | self.run_render_test('xrefs-response-02.json') 99 | 100 | def test_xref_search_response_03(self): 101 | self.run_render_test('xrefs-response-03.json') 102 | 103 | def test_call_graph_01(self): 104 | self.run_render_test('call-graph-01.json') 105 | 106 | def test_call_graph_02(self): 107 | self.run_render_test('call-graph-02.json') 108 | 109 | 110 | if __name__ == '__main__': 111 | unittest.main() 112 | -------------------------------------------------------------------------------- /render/testdata/call-graph-01.json.actual: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^N{[-] 9 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler.h#JeFRw996xZZVV9czj%2FFb1cDpm3lK9KygMuH3I5j8Gvs%3D'} 10 | 002| 11 | |{} 12 | 003|^N{ [+] ^S{MaybeGenerateAuthToken}S_ ^F{src/net/http/http_auth_controller.cc}F_^>{ 13 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_controller.cc#KT6dW2Oyiv3OtfDK3Auh0pjK2V2ZCCzASfU34HIjU1A%3D', 'j': ('src/net/http/http_auth_controller.cc', 144, 14)} 14 | 004| 159 int rv = handler_->GenerateAuthToken( 15 | |{'j': ('src/net/http/http_auth_controller.cc', 158, 12)} 16 | 005|}>_ 17 | |{} 18 | 006|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_basic_unittest.cc}F_^>{ 19 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_basic_unittest.cc#rGyD7PGS8PcACbNF5dm7cMXAM6Dsg2C7f2H2w45x0Xo%3D', 'j': ('src/net/http/http_auth_handler_basic_unittest.cc', 25, 17)} 20 | 007| 54 int rv = basic->GenerateAuthToken(&credentials, &request_info, 21 | |{'j': ('src/net/http/http_auth_handler_basic_unittest.cc', 53, 11)} 22 | 008|}>_ 23 | |{} 24 | 009|}N_^N{ [+] ^S{RespondToChallenge}S_ ^F{src/net/http/http_auth_handler_digest_unittest.cc}F_^>{ 25 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_digest_unittest.cc#NWXPUm5fOZr6UiWzw8QJpbFF8qT%2Bbs0%2FWxz%2Bz6rxCAE%3D', 'j': ('src/net/http/http_auth_handler_digest_unittest.cc', 37, 17)} 26 | 010| 80 int rv_generate = handler->GenerateAuthToken( 27 | |{'j': ('src/net/http/http_auth_handler_digest_unittest.cc', 79, 11)} 28 | 011|}>_ 29 | |{} 30 | 012|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 31 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#K4ikCIS9mEQ2mHfCRGMW5LQewkaTRwkdAaRECIIEiX8%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 246, 17)} 32 | 013| 257 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 33 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 256, 12)} 34 | 014|}>_ 35 | |{} 36 | 015|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 37 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#VfqfOw7DzVIjSOvfAoZkrsRnILsU2svoU3J3QXGEKdE%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 265, 17)} 38 | 016| 275 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 39 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 274, 12)} 40 | 017|}>_ 41 | |{} 42 | 018|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 43 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#MazmFIKzSqLuiLofsfY1tlOdgXUaTXxd8SccEVJ9HWw%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 283, 17)} 44 | 019| 293 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 45 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 292, 12)} 46 | 020|}>_ 47 | |{} 48 | 021|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 49 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#g7ofIg8EBdx3S%2Bg8ITGeYjzFy5DEXZ4SDF5UPD7BpcI%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 301, 17)} 50 | 022| 311 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 51 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 310, 12)} 52 | 023|}>_ 53 | |{} 54 | 024|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 55 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#7FHB99jS0bE%2BoVdt265ONAIqYAdc4DR5kppiAcF0YSE%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 319, 17)} 56 | 025| 329 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 57 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 328, 12)} 58 | 026|}>_ 59 | |{} 60 | 027|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 61 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#Rrtf%2FzL8yfwFbA8Xf%2B5Q6%2FnOxpoky4ikgHiK7MnTTVE%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 342, 17)} 62 | 028| 352 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 63 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 351, 12)} 64 | 029|}>_ 65 | |{} 66 | 030|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 67 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#d7IMoCLUefiYaXMDOaxLMz2FMx7QtVnkwNSfvTNNtxc%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 358, 17)} 68 | 031| 368 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 69 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 367, 12)} 70 | 032|}>_ 71 | |{} 72 | 033|}N_^N{ [+] ^S{GenerateAuthToken}S_ ^F{src/net/http/http_auth_handler_ntlm_portable_unittest.cc}F_^>{ 73 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_ntlm_portable_unittest.cc#MLDmQc3F5wGTwKNVa06Shcenysy7X%2FMfsWLA3KgPVt4%3D', 'j': ('src/net/http/http_auth_handler_ntlm_portable_unittest.cc', 78, 17)} 74 | 034| 82 return callback.GetResult(GetAuthHandler()->GenerateAuthToken( 75 | |{'j': ('src/net/http/http_auth_handler_ntlm_portable_unittest.cc', 81, 11)} 76 | 035|}>_ 77 | |{} 78 | 036|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_unittest.cc}F_^>{ 79 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_unittest.cc#GA%2Bgg3Wjb9br4%2BfIxRALnWq0B%2BIzV4PD4r7%2FPajlk9Y%3D', 'j': ('src/net/http/http_auth_handler_unittest.cc', 24, 17)} 80 | 037| 56 mock_handler.GenerateAuthToken(&credentials, &request, 81 | |{'j': ('src/net/http/http_auth_handler_unittest.cc', 55, 11)} 82 | 038|}>_ 83 | |{} 84 | 039|}N_}N_ 85 | |{} 86 | -------------------------------------------------------------------------------- /render/testdata/call-graph-01.json.expected: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^N{[-] 9 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler.h#JeFRw996xZZVV9czj%2FFb1cDpm3lK9KygMuH3I5j8Gvs%3D'} 10 | 002| 11 | |{} 12 | 003|^N{ [+] ^S{MaybeGenerateAuthToken}S_ ^F{src/net/http/http_auth_controller.cc}F_^>{ 13 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_controller.cc#KT6dW2Oyiv3OtfDK3Auh0pjK2V2ZCCzASfU34HIjU1A%3D', 'j': ('src/net/http/http_auth_controller.cc', 144, 14)} 14 | 004| 159 int rv = handler_->GenerateAuthToken( 15 | |{'j': ('src/net/http/http_auth_controller.cc', 158, 12)} 16 | 005|}>_ 17 | |{} 18 | 006|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_basic_unittest.cc}F_^>{ 19 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_basic_unittest.cc#rGyD7PGS8PcACbNF5dm7cMXAM6Dsg2C7f2H2w45x0Xo%3D', 'j': ('src/net/http/http_auth_handler_basic_unittest.cc', 25, 17)} 20 | 007| 54 int rv = basic->GenerateAuthToken(&credentials, &request_info, 21 | |{'j': ('src/net/http/http_auth_handler_basic_unittest.cc', 53, 11)} 22 | 008|}>_ 23 | |{} 24 | 009|}N_^N{ [+] ^S{RespondToChallenge}S_ ^F{src/net/http/http_auth_handler_digest_unittest.cc}F_^>{ 25 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_digest_unittest.cc#NWXPUm5fOZr6UiWzw8QJpbFF8qT%2Bbs0%2FWxz%2Bz6rxCAE%3D', 'j': ('src/net/http/http_auth_handler_digest_unittest.cc', 37, 17)} 26 | 010| 80 int rv_generate = handler->GenerateAuthToken( 27 | |{'j': ('src/net/http/http_auth_handler_digest_unittest.cc', 79, 11)} 28 | 011|}>_ 29 | |{} 30 | 012|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 31 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#K4ikCIS9mEQ2mHfCRGMW5LQewkaTRwkdAaRECIIEiX8%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 246, 17)} 32 | 013| 257 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 33 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 256, 12)} 34 | 014|}>_ 35 | |{} 36 | 015|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 37 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#VfqfOw7DzVIjSOvfAoZkrsRnILsU2svoU3J3QXGEKdE%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 265, 17)} 38 | 016| 275 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 39 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 274, 12)} 40 | 017|}>_ 41 | |{} 42 | 018|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 43 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#MazmFIKzSqLuiLofsfY1tlOdgXUaTXxd8SccEVJ9HWw%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 283, 17)} 44 | 019| 293 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 45 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 292, 12)} 46 | 020|}>_ 47 | |{} 48 | 021|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 49 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#g7ofIg8EBdx3S%2Bg8ITGeYjzFy5DEXZ4SDF5UPD7BpcI%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 301, 17)} 50 | 022| 311 EXPECT_EQ(OK, callback.GetResult(auth_handler->GenerateAuthToken( 51 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 310, 12)} 52 | 023|}>_ 53 | |{} 54 | 024|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 55 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#7FHB99jS0bE%2BoVdt265ONAIqYAdc4DR5kppiAcF0YSE%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 319, 17)} 56 | 025| 329 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 57 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 328, 12)} 58 | 026|}>_ 59 | |{} 60 | 027|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 61 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#Rrtf%2FzL8yfwFbA8Xf%2B5Q6%2FnOxpoky4ikgHiK7MnTTVE%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 342, 17)} 62 | 028| 352 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 63 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 351, 12)} 64 | 029|}>_ 65 | |{} 66 | 030|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_negotiate_unittest.cc}F_^>{ 67 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#d7IMoCLUefiYaXMDOaxLMz2FMx7QtVnkwNSfvTNNtxc%3D', 'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 358, 17)} 68 | 031| 368 EXPECT_EQ(ERR_IO_PENDING, auth_handler->GenerateAuthToken( 69 | |{'j': ('src/net/http/http_auth_handler_negotiate_unittest.cc', 367, 12)} 70 | 032|}>_ 71 | |{} 72 | 033|}N_^N{ [+] ^S{GenerateAuthToken}S_ ^F{src/net/http/http_auth_handler_ntlm_portable_unittest.cc}F_^>{ 73 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_ntlm_portable_unittest.cc#MLDmQc3F5wGTwKNVa06Shcenysy7X%2FMfsWLA3KgPVt4%3D', 'j': ('src/net/http/http_auth_handler_ntlm_portable_unittest.cc', 78, 17)} 74 | 034| 82 return callback.GetResult(GetAuthHandler()->GenerateAuthToken( 75 | |{'j': ('src/net/http/http_auth_handler_ntlm_portable_unittest.cc', 81, 11)} 76 | 035|}>_ 77 | |{} 78 | 036|}N_^N{ [+] ^S{TestBody}S_ ^F{src/net/http/http_auth_handler_unittest.cc}F_^>{ 79 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_unittest.cc#GA%2Bgg3Wjb9br4%2BfIxRALnWq0B%2BIzV4PD4r7%2FPajlk9Y%3D', 'j': ('src/net/http/http_auth_handler_unittest.cc', 24, 17)} 80 | 037| 56 mock_handler.GenerateAuthToken(&credentials, &request, 81 | |{'j': ('src/net/http/http_auth_handler_unittest.cc', 55, 11)} 82 | 038|}>_ 83 | |{} 84 | 039|}N_}N_ 85 | |{} 86 | -------------------------------------------------------------------------------- /render/testdata/call-graph-02.json: -------------------------------------------------------------------------------- 1 | { 2 | "call_graph_response": [ 3 | { 4 | "node": { 5 | "call_scope_range": { 6 | "start_line": 0, 7 | "end_line": 0, 8 | "start_column": 0, 9 | "end_column": 0 10 | }, 11 | "call_site_range": { 12 | "start_line": 0, 13 | "end_line": 0, 14 | "start_column": 0, 15 | "end_column": 0 16 | }, 17 | "snippet": { 18 | "text": {}, 19 | "first_line_number": 0, 20 | "match_reason": { 21 | "blame": false, 22 | "content": false, 23 | "filename_lineno": false, 24 | "scoped_symbol": false, 25 | "filename": false 26 | } 27 | }, 28 | "node_kind": "FUNCTION", 29 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#K4ikCIS9mEQ2mHfCRGMW5LQewkaTRwkdAaRECIIEiX8%3D", 30 | "override": false 31 | }, 32 | "is_from_kythe": true, 33 | "return_code": 1, 34 | "results_offset": 0, 35 | "estimated_total_number_results": 0, 36 | "is_call_graph": true 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /render/testdata/call-graph-02.json.actual: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^N{[+] 9 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#K4ikCIS9mEQ2mHfCRGMW5LQewkaTRwkdAaRECIIEiX8%3D'} 10 | 002| 11 | |{} 12 | 003|}N_ 13 | |{} 14 | -------------------------------------------------------------------------------- /render/testdata/call-graph-02.json.expected: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^N{[+] 9 | |{'s': 'kythe://chromium?lang=c%2B%2B?path=src/net/http/http_auth_handler_negotiate_unittest.cc#K4ikCIS9mEQ2mHfCRGMW5LQewkaTRwkdAaRECIIEiX8%3D'} 10 | 002| 11 | |{} 12 | 003|}N_ 13 | |{} 14 | -------------------------------------------------------------------------------- /render/testdata/rebaseline.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # Copyright 2017 The Chromium Authors. 4 | # 5 | # Use of this source code is governed by a BSD-style 6 | # license that can be found in the LICENSE file or at 7 | # https://developers.google.com/open-source/licenses/bsd. 8 | 9 | # Rebaselines the tests after a change to the layout logic. Please examine the 10 | # resulting .expected files to make sure the output is correct. 11 | # 12 | # Cannot be used to "rebaseline" the inputs. See the README.md file in this 13 | # directory for details. 14 | 15 | pushd `dirname ${BASH_SOURCE[0]}` > /dev/null 16 | python -m unittest discover .. "test_*.py" 17 | for json_file in *.json; do 18 | if [ -r ${json_file}.actual ]; then 19 | cp ${json_file}.actual ${json_file}.expected 20 | git add ${json_file}.expected 21 | fi 22 | done 23 | popd > /dev/null 24 | 25 | echo "Don't forget to check and commit the updated .expected files" 26 | -------------------------------------------------------------------------------- /render/testdata/search-response-01.json.actual: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|CodeSearch results for ^q{unspecified}q_ 9 | |{} 10 | 002| 11 | |{} 12 | 003|1. src/chrome/browser/download/download_target_determiner.h^>{ 13 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 0, 0)} 14 | 004| 49 ^c{//}c_ 15 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 48, 7)} 16 | 005| 50 ^c{// The only public entrypoint is the static Start() method which creates an}c_ 17 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 49, 7)} 18 | 006| 51 ^c{// instance of ^${DownloadTargetDeterminer}$_.}c_ 19 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 50, 7)} 20 | 007| 52 ^k{class}k_ ^${DownloadTargetDeterminer}$_ : ^k{public}k_ download::DownloadItem::Observer { 21 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 51, 7)} 22 | 008| 53 ^k{public}k_: 23 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 52, 7)} 24 | 009| 54 ^k{using}k_ CompletionCallback = 25 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 53, 7)} 26 | 010| 55 base::Callback<^k{void}k_(std::unique_ptr)>; 27 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 54, 7)} 28 | 011| 56 }>_ 29 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 55, 7)} 30 | 012| 31 | |{} 32 | 013|2. src/chrome/browser/download/download_target_determiner.cc^>{ 33 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 0, 0)} 34 | 014| 86 ^${DownloadTargetDeterminer}$_Delegate::~^${DownloadTargetDeterminer}$_Delegate() { 35 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 85, 7)} 36 | 015| 87 } 37 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 86, 7)} 38 | 016| 88 39 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 87, 7)} 40 | 017| 89 ^${DownloadTargetDeterminer}$_::^${DownloadTargetDeterminer}$_( 41 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 88, 7)} 42 | 018| 90 DownloadItem* download, 43 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 89, 7)} 44 | 019| 91 ^k{const}k_ base::FilePath& initial_virtual_path, 45 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 90, 7)} 46 | 020| 92 DownloadPathReservationTracker::FilenameConflictAction conflict_action, 47 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 91, 7)} 48 | 021| 93 DownloadPrefs* download_prefs, 49 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 92, 7)} 50 | 022| 94 ^${DownloadTargetDeterminer}$_Delegate* delegate, 51 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 93, 7)} 52 | 023| 95 }>_ 53 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 94, 7)} 54 | 024| 55 | |{} 56 | 025|3. src/chrome/browser/download/download_target_determiner_delegate.h^>{ 57 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 0, 0)} 58 | 026| 21 ^k{class}k_ DownloadItem; 59 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 20, 7)} 60 | 027| 22 } 61 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 21, 7)} 62 | 028| 23 63 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 22, 7)} 64 | 029| 24 ^c{// Delegate for ^${DownloadTargetDeterminer}$_. The delegate isn't owned by}c_ 65 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 23, 7)} 66 | 030| 25 ^c{// ^${DownloadTargetDeterminer}$_ and is expected to outlive it.}c_ 67 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 24, 7)} 68 | 031| 26 ^k{class}k_ ^${DownloadTargetDeterminer}$_Delegate { 69 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 25, 7)} 70 | 032| 27 ^k{public}k_: 71 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 26, 7)} 72 | 033| 28 ^c{// Callback to be invoked after NotifyExtensions() completes. The}c_ 73 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 27, 7)} 74 | 034| 29 ^c{// |new_virtual_path| should be set to a new path if an extension wishes to}c_ 75 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 28, 7)} 76 | 035| 30 }>_ 77 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 29, 7)} 78 | 036| 79 | |{} 80 | 037|4. src/chrome/browser/download/download_target_determiner_unittest.cc^>{ 81 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 0, 0)} 82 | 038| 238 ^k{const}k_ LocalPathCallback& callback); 83 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 237, 8)} 84 | 039| 239 }; 85 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 238, 8)} 86 | 040| 240 87 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 239, 8)} 88 | 041| 241 ^k{class}k_ ^${DownloadTargetDeterminer}$_Test : ^k{public}k_ ChromeRenderViewHostTestHarness { 89 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 240, 8)} 90 | 042| 242 ^k{public}k_: 91 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 241, 8)} 92 | 043| 243 ^${DownloadTargetDeterminer}$_Test() = ^k{default}k_; 93 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 242, 8)} 94 | 044| 244 95 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 243, 8)} 96 | 045| 245 ^c{// ::testing::Test}c_ 97 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 244, 8)} 98 | 046| 246 ^k{void}k_ SetUp() ^k{override}k_; 99 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 245, 8)} 100 | 047| 247 }>_ 101 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 246, 8)} 102 | 048| 103 | |{} 104 | 049|5. src/chrome/browser/download/download_prefs.cc^>{ 105 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 0, 0)} 106 | 050| 409 ^k{bool}k_ DownloadPrefs::ShouldOpenPdfInSystemReader() ^k{const}k_ { 107 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 408, 8)} 108 | 051| 410 ^D{#if}D_ defined(OS_WIN) 109 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 409, 8)} 110 | 052| 411 ^k{if}k_ (IsAdobeReaderDefaultPDFViewer() && 111 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 410, 8)} 112 | 053| 412 !^${DownloadTargetDeterminer}$_::IsAdobeReaderUpToDate()) { 113 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 411, 8)} 114 | 054| 413 ^k{return}k_ ^k{false}k_; 115 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 412, 8)} 116 | 055| 414 } 117 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 413, 8)} 118 | 056| 415 ^D{#endif}D_ 119 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 414, 8)} 120 | 057| 416 }>_ 121 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 415, 8)} 122 | 058| 123 | |{} 124 | 059|6. src/chrome/browser/download/download_browsertest.cc^>{ 125 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 0, 0)} 126 | 060| 1972 ^c{// slow download job.}c_ 127 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1971, 9)} 128 | 061| 1973 history::DownloadRow& row(downloads_in_database->at(^0{0}0_)); 129 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1972, 9)} 130 | 062| 1974 EXPECT_EQ(DestinationFile(browser(), file), row.target_path); 131 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1973, 9)} 132 | 063| 1975 EXPECT_EQ(^${DownloadTargetDeterminer}$_::GetCrDownloadPath( 133 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1974, 9)} 134 | 064| 1976 DestinationFile(browser(), file)), 135 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1975, 9)} 136 | 065| 1977 row.current_path); 137 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1976, 9)} 138 | 066| 1978 ASSERT_EQ(^0{2}0_u, row.url_chain.size()); 139 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1977, 9)} 140 | 067| 1979 }>_ 141 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1978, 9)} 142 | 068| 143 | |{} 144 | 069|7. src/chrome/browser/download/download_commands.cc^>{ 145 | |{'j': ('src/chrome/browser/download/download_commands.cc', 0, 0)} 146 | 070| 420 ^k{bool}k_ is_adobe_pdf_reader_up_to_date = ^k{false}k_; 147 | |{'j': ('src/chrome/browser/download/download_commands.cc', 419, 8)} 148 | 071| 421 ^k{if}k_ (IsDownloadPdf() && IsAdobeReaderDefaultPDFViewer()) { 149 | |{'j': ('src/chrome/browser/download/download_commands.cc', 420, 8)} 150 | 072| 422 is_adobe_pdf_reader_up_to_date = 151 | |{'j': ('src/chrome/browser/download/download_commands.cc', 421, 8)} 152 | 073| 423 ^${DownloadTargetDeterminer}$_::IsAdobeReaderUpToDate(); 153 | |{'j': ('src/chrome/browser/download/download_commands.cc', 422, 8)} 154 | 074| 424 } 155 | |{'j': ('src/chrome/browser/download/download_commands.cc', 423, 8)} 156 | 075| 425 ^k{return}k_ IsDownloadPdf() && 157 | |{'j': ('src/chrome/browser/download/download_commands.cc', 424, 8)} 158 | 076| 426 (IsAdobeReaderDefaultPDFViewer() ? is_adobe_pdf_reader_up_to_date 159 | |{'j': ('src/chrome/browser/download/download_commands.cc', 425, 8)} 160 | 077| 427 }>_ 161 | |{'j': ('src/chrome/browser/download/download_commands.cc', 426, 8)} 162 | 078| 163 | |{} 164 | 079|8. src/chrome/browser/download/chrome_download_manager_delegate.cc^>{ 165 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 0, 0)} 166 | 080| 132 }; 167 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 131, 8)} 168 | 081| 133 169 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 132, 8)} 170 | 082| 134 ^c{// Returns a path in the form that that is expected by platform_util::OpenItem /}c_ 171 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 133, 8)} 172 | 083| 135 ^c{// platform_util::ShowItemInFolder / ^${DownloadTargetDeterminer}$_.}c_ 173 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 134, 8)} 174 | 084| 136 ^c{//}c_ 175 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 135, 8)} 176 | 085| 137 ^c{// DownloadItems corresponding to Drive downloads use a temporary file as the}c_ 177 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 136, 8)} 178 | 086| 138 ^c{// target path. The paths returned by DownloadItem::GetFullPath() /}c_ 179 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 137, 8)} 180 | 087| 139 }>_ 181 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 138, 8)} 182 | 088| 183 | |{} 184 | 089|9. src/chrome/browser/download/download_confirmation_reason.h^>{ 185 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 0, 0)} 186 | 090| 5 ^D{#ifndef}D_ CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CONFIRMATION_REASON_H_ 187 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 4, 7)} 188 | 091| 6 ^D{#define}D_ CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CONFIRMATION_REASON_H_ 189 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 5, 7)} 190 | 092| 7 191 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 6, 7)} 192 | 093| 8 ^c{// Reason why ^${DownloadTargetDeterminer}$_ requested additional confirmation for the}c_ 193 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 7, 7)} 194 | 094| 9 ^c{// target path via RequestConfirmation delegate method.}c_ 195 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 8, 7)} 196 | 095| 10 ^k{enum}k_ ^k{class}k_ DownloadConfirmationReason { 197 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 9, 7)} 198 | 096| 11 NONE, 199 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 10, 7)} 200 | 097| 12 }>_ 201 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 11, 7)} 202 | 098| 203 | |{} 204 | 099|10. src/chrome/browser/download/chrome_download_manager_delegate.h^>{ 205 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 0, 0)} 206 | 100| 51 ^k{class}k_ ChromeDownloadManagerDelegate 207 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 50, 7)} 208 | 101| 52 : ^k{public}k_ content::DownloadManagerDelegate, 209 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 51, 7)} 210 | 102| 53 ^k{public}k_ content::NotificationObserver, 211 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 52, 7)} 212 | 103| 54 ^k{public}k_ ^${DownloadTargetDeterminer}$_Delegate { 213 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 53, 7)} 214 | 104| 55 ^k{public}k_: 215 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 54, 7)} 216 | 105| 56 ^k{explicit}k_ ChromeDownloadManagerDelegate(Profile* profile); 217 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 55, 7)} 218 | 106| 57 ~ChromeDownloadManagerDelegate() ^k{override}k_; 219 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 56, 7)} 220 | 107| 58 }>_ 221 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 57, 7)} 222 | 108| 223 | |{} 224 | 109|11. src/chrome/browser/extensions/api/downloads/downloads_api.cc^>{ 225 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 0, 0)} 226 | 110| 1691 ^c{// chrome.downloads.onDeterminingFilename.addListener, which adds an}c_ 227 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1690, 9)} 228 | 111| 1692 ^c{// EventListener object to ExtensionEventRouter::listeners().}c_ 229 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1691, 9)} 230 | 112| 1693 ^c{//}c_ 231 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1692, 9)} 232 | 113| 1694 ^c{// When a download's filename is being determined, ^${DownloadTargetDeterminer}$_ (via}c_ 233 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1693, 9)} 234 | 114| 1695 ^c{// ChromeDownloadManagerDelegate (CDMD) ::NotifyExtensions()) passes 2 callbacks}c_ 235 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1694, 9)} 236 | 115| 1696 ^c{// to ExtensionDownloadsEventRouter::OnDeterminingFilename (ODF), which stores}c_ 237 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1695, 9)} 238 | 116| 1697 ^c{// the callbacks in the item's ExtensionDownloadsEventRouterData (EDERD) along}c_ 239 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1696, 9)} 240 | 117| 1698 }>_ 241 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1697, 9)} 242 | 118| 243 | |{} 244 | 119|12. src/chrome/browser/download/download_confirmation_result.h^>{ 245 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 0, 0)} 246 | 120| 8 ^D{#include}D_ ^s{"build/build_config.h"}s_ 247 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 7, 7)} 248 | 121| 9 249 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 8, 7)} 250 | 122| 10 ^c{// Result of RequestConfirmation delegate method for}c_ 251 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 9, 7)} 252 | 123| 11 ^c{// ^${DownloadTargetDeterminer}$_Delegate.}c_ 253 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 10, 7)} 254 | 124| 12 ^k{enum}k_ ^k{class}k_ DownloadConfirmationResult { 255 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 11, 7)} 256 | 125| 13 ^c{// The user confirmed the path. Only use this value if the user was explicitly}c_ 257 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 12, 7)} 258 | 126| 14 ^c{// shown the path or at least the filename being downloaded.}c_ 259 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 13, 7)} 260 | 127| 15 }>_ 261 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 14, 7)} 262 | 128| 263 | |{} 264 | 129|13. src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc^>{ 265 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 0, 0)} 266 | 130| 150 ^c{// DownloadPathReservationTracker talks to the underlying file system. For}c_ 267 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 149, 8)} 268 | 131| 151 ^c{// tests we are going to mock it out so that we can test how}c_ 269 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 150, 8)} 270 | 132| 152 ^c{// ChromeDownloadManagerDelegate reponds to various ^${DownloadTargetDeterminer}$_}c_ 271 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 151, 8)} 272 | 133| 153 ^c{// results.}c_ 273 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 152, 8)} 274 | 134| 154 ^k{void}k_ ReserveVirtualPath( 275 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 153, 8)} 276 | 135| 155 download::DownloadItem* download, 277 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 154, 8)} 278 | 136| 156 }>_ 279 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 155, 8)} 280 | 137| 281 | |{} 282 | 138|14. src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc^>{ 283 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 0, 0)} 284 | 139| 2928 EXPECT_EQ(^s{""}s_, error); 285 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2927, 9)} 286 | 140| 2929 287 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2928, 9)} 288 | 141| 2930 ^c{// Calling DetermineFilename again should return an error instead of calling}c_ 289 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2929, 9)} 290 | 142| 2931 ^c{// ^${DownloadTargetDeterminer}$_.}c_ 291 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2930, 9)} 292 | 143| 2932 ASSERT_FALSE(ExtensionDownloadsEventRouter::DetermineFilename( 293 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2931, 9)} 294 | 144| 2933 current_browser()->profile(), ^k{false}k_, GetExtensionId(), result_id, 295 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2932, 9)} 296 | 145| 2934 base::FilePath(FILE_PATH_LITERAL(^s{"different"}s_)), 297 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2933, 9)} 298 | 146| 2935 }>_ 299 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2934, 9)} 300 | 147| 301 | |{} 302 | 148|15. src/chrome/browser/download/download_path_reservation_tracker_unittest.cc^>{ 303 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 0, 0)} 304 | 149| 246 ASSERT_EQ(^0{0}0_, base::WriteFile(path, ^s{""}s_, ^0{0}0_)); 305 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 245, 8)} 306 | 150| 247 ASSERT_EQ(^0{0}0_, 307 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 246, 8)} 308 | 151| 248 base::WriteFile( 309 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 247, 8)} 310 | 152| 249 ^${DownloadTargetDeterminer}$_::GetCrDownloadPath(path1), ^s{""}s_, ^0{0}0_)); 311 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 248, 8)} 312 | 153| 250 ASSERT_TRUE(IsPathInUse(path)); 313 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 249, 8)} 314 | 154| 251 315 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 250, 8)} 316 | 155| 252 base::FilePath reserved_path; 317 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 251, 8)} 318 | 156| 253 }>_ 319 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 252, 8)} 320 | 157| 321 | |{} 322 | 158|16. src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc^>{ 323 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 0, 0)} 324 | 159| 21 ^k{namespace}k_ { 325 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 20, 7)} 326 | 160| 22 327 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 21, 7)} 328 | 161| 23 ^k{void}k_ CreateNewFileDone( 329 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 22, 7)} 330 | 162| 24 ^k{const}k_ ^${DownloadTargetDeterminer}$_Delegate::ConfirmationCallback& callback, 331 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 23, 7)} 332 | 163| 25 PathValidationResult result, 333 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 24, 7)} 334 | 164| 26 ^k{const}k_ base::FilePath& target_path) { 335 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 25, 7)} 336 | 165| 27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 337 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 26, 7)} 338 | 166| 28 }>_ 339 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 27, 7)} 340 | 167| 341 | |{} 342 | 168| 343 | |{} 344 | -------------------------------------------------------------------------------- /render/testdata/search-response-01.json.expected: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|CodeSearch results for ^q{unspecified}q_ 9 | |{} 10 | 002| 11 | |{} 12 | 003|1. src/chrome/browser/download/download_target_determiner.h^>{ 13 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 0, 0)} 14 | 004| 49 ^c{//}c_ 15 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 48, 7)} 16 | 005| 50 ^c{// The only public entrypoint is the static Start() method which creates an}c_ 17 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 49, 7)} 18 | 006| 51 ^c{// instance of ^${DownloadTargetDeterminer}$_.}c_ 19 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 50, 7)} 20 | 007| 52 ^k{class}k_ ^${DownloadTargetDeterminer}$_ : ^k{public}k_ download::DownloadItem::Observer { 21 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 51, 7)} 22 | 008| 53 ^k{public}k_: 23 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 52, 7)} 24 | 009| 54 ^k{using}k_ CompletionCallback = 25 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 53, 7)} 26 | 010| 55 base::Callback<^k{void}k_(std::unique_ptr)>; 27 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 54, 7)} 28 | 011| 56 }>_ 29 | |{'j': ('src/chrome/browser/download/download_target_determiner.h', 55, 7)} 30 | 012| 31 | |{} 32 | 013|2. src/chrome/browser/download/download_target_determiner.cc^>{ 33 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 0, 0)} 34 | 014| 86 ^${DownloadTargetDeterminer}$_Delegate::~^${DownloadTargetDeterminer}$_Delegate() { 35 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 85, 7)} 36 | 015| 87 } 37 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 86, 7)} 38 | 016| 88 39 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 87, 7)} 40 | 017| 89 ^${DownloadTargetDeterminer}$_::^${DownloadTargetDeterminer}$_( 41 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 88, 7)} 42 | 018| 90 DownloadItem* download, 43 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 89, 7)} 44 | 019| 91 ^k{const}k_ base::FilePath& initial_virtual_path, 45 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 90, 7)} 46 | 020| 92 DownloadPathReservationTracker::FilenameConflictAction conflict_action, 47 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 91, 7)} 48 | 021| 93 DownloadPrefs* download_prefs, 49 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 92, 7)} 50 | 022| 94 ^${DownloadTargetDeterminer}$_Delegate* delegate, 51 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 93, 7)} 52 | 023| 95 }>_ 53 | |{'j': ('src/chrome/browser/download/download_target_determiner.cc', 94, 7)} 54 | 024| 55 | |{} 56 | 025|3. src/chrome/browser/download/download_target_determiner_delegate.h^>{ 57 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 0, 0)} 58 | 026| 21 ^k{class}k_ DownloadItem; 59 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 20, 7)} 60 | 027| 22 } 61 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 21, 7)} 62 | 028| 23 63 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 22, 7)} 64 | 029| 24 ^c{// Delegate for ^${DownloadTargetDeterminer}$_. The delegate isn't owned by}c_ 65 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 23, 7)} 66 | 030| 25 ^c{// ^${DownloadTargetDeterminer}$_ and is expected to outlive it.}c_ 67 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 24, 7)} 68 | 031| 26 ^k{class}k_ ^${DownloadTargetDeterminer}$_Delegate { 69 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 25, 7)} 70 | 032| 27 ^k{public}k_: 71 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 26, 7)} 72 | 033| 28 ^c{// Callback to be invoked after NotifyExtensions() completes. The}c_ 73 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 27, 7)} 74 | 034| 29 ^c{// |new_virtual_path| should be set to a new path if an extension wishes to}c_ 75 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 28, 7)} 76 | 035| 30 }>_ 77 | |{'j': ('src/chrome/browser/download/download_target_determiner_delegate.h', 29, 7)} 78 | 036| 79 | |{} 80 | 037|4. src/chrome/browser/download/download_target_determiner_unittest.cc^>{ 81 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 0, 0)} 82 | 038| 238 ^k{const}k_ LocalPathCallback& callback); 83 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 237, 8)} 84 | 039| 239 }; 85 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 238, 8)} 86 | 040| 240 87 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 239, 8)} 88 | 041| 241 ^k{class}k_ ^${DownloadTargetDeterminer}$_Test : ^k{public}k_ ChromeRenderViewHostTestHarness { 89 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 240, 8)} 90 | 042| 242 ^k{public}k_: 91 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 241, 8)} 92 | 043| 243 ^${DownloadTargetDeterminer}$_Test() = ^k{default}k_; 93 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 242, 8)} 94 | 044| 244 95 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 243, 8)} 96 | 045| 245 ^c{// ::testing::Test}c_ 97 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 244, 8)} 98 | 046| 246 ^k{void}k_ SetUp() ^k{override}k_; 99 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 245, 8)} 100 | 047| 247 }>_ 101 | |{'j': ('src/chrome/browser/download/download_target_determiner_unittest.cc', 246, 8)} 102 | 048| 103 | |{} 104 | 049|5. src/chrome/browser/download/download_prefs.cc^>{ 105 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 0, 0)} 106 | 050| 409 ^k{bool}k_ DownloadPrefs::ShouldOpenPdfInSystemReader() ^k{const}k_ { 107 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 408, 8)} 108 | 051| 410 ^D{#if}D_ defined(OS_WIN) 109 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 409, 8)} 110 | 052| 411 ^k{if}k_ (IsAdobeReaderDefaultPDFViewer() && 111 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 410, 8)} 112 | 053| 412 !^${DownloadTargetDeterminer}$_::IsAdobeReaderUpToDate()) { 113 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 411, 8)} 114 | 054| 413 ^k{return}k_ ^k{false}k_; 115 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 412, 8)} 116 | 055| 414 } 117 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 413, 8)} 118 | 056| 415 ^D{#endif}D_ 119 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 414, 8)} 120 | 057| 416 }>_ 121 | |{'j': ('src/chrome/browser/download/download_prefs.cc', 415, 8)} 122 | 058| 123 | |{} 124 | 059|6. src/chrome/browser/download/download_browsertest.cc^>{ 125 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 0, 0)} 126 | 060| 1972 ^c{// slow download job.}c_ 127 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1971, 9)} 128 | 061| 1973 history::DownloadRow& row(downloads_in_database->at(^0{0}0_)); 129 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1972, 9)} 130 | 062| 1974 EXPECT_EQ(DestinationFile(browser(), file), row.target_path); 131 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1973, 9)} 132 | 063| 1975 EXPECT_EQ(^${DownloadTargetDeterminer}$_::GetCrDownloadPath( 133 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1974, 9)} 134 | 064| 1976 DestinationFile(browser(), file)), 135 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1975, 9)} 136 | 065| 1977 row.current_path); 137 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1976, 9)} 138 | 066| 1978 ASSERT_EQ(^0{2}0_u, row.url_chain.size()); 139 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1977, 9)} 140 | 067| 1979 }>_ 141 | |{'j': ('src/chrome/browser/download/download_browsertest.cc', 1978, 9)} 142 | 068| 143 | |{} 144 | 069|7. src/chrome/browser/download/download_commands.cc^>{ 145 | |{'j': ('src/chrome/browser/download/download_commands.cc', 0, 0)} 146 | 070| 420 ^k{bool}k_ is_adobe_pdf_reader_up_to_date = ^k{false}k_; 147 | |{'j': ('src/chrome/browser/download/download_commands.cc', 419, 8)} 148 | 071| 421 ^k{if}k_ (IsDownloadPdf() && IsAdobeReaderDefaultPDFViewer()) { 149 | |{'j': ('src/chrome/browser/download/download_commands.cc', 420, 8)} 150 | 072| 422 is_adobe_pdf_reader_up_to_date = 151 | |{'j': ('src/chrome/browser/download/download_commands.cc', 421, 8)} 152 | 073| 423 ^${DownloadTargetDeterminer}$_::IsAdobeReaderUpToDate(); 153 | |{'j': ('src/chrome/browser/download/download_commands.cc', 422, 8)} 154 | 074| 424 } 155 | |{'j': ('src/chrome/browser/download/download_commands.cc', 423, 8)} 156 | 075| 425 ^k{return}k_ IsDownloadPdf() && 157 | |{'j': ('src/chrome/browser/download/download_commands.cc', 424, 8)} 158 | 076| 426 (IsAdobeReaderDefaultPDFViewer() ? is_adobe_pdf_reader_up_to_date 159 | |{'j': ('src/chrome/browser/download/download_commands.cc', 425, 8)} 160 | 077| 427 }>_ 161 | |{'j': ('src/chrome/browser/download/download_commands.cc', 426, 8)} 162 | 078| 163 | |{} 164 | 079|8. src/chrome/browser/download/chrome_download_manager_delegate.cc^>{ 165 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 0, 0)} 166 | 080| 132 }; 167 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 131, 8)} 168 | 081| 133 169 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 132, 8)} 170 | 082| 134 ^c{// Returns a path in the form that that is expected by platform_util::OpenItem /}c_ 171 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 133, 8)} 172 | 083| 135 ^c{// platform_util::ShowItemInFolder / ^${DownloadTargetDeterminer}$_.}c_ 173 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 134, 8)} 174 | 084| 136 ^c{//}c_ 175 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 135, 8)} 176 | 085| 137 ^c{// DownloadItems corresponding to Drive downloads use a temporary file as the}c_ 177 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 136, 8)} 178 | 086| 138 ^c{// target path. The paths returned by DownloadItem::GetFullPath() /}c_ 179 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 137, 8)} 180 | 087| 139 }>_ 181 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.cc', 138, 8)} 182 | 088| 183 | |{} 184 | 089|9. src/chrome/browser/download/download_confirmation_reason.h^>{ 185 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 0, 0)} 186 | 090| 5 ^D{#ifndef}D_ CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CONFIRMATION_REASON_H_ 187 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 4, 7)} 188 | 091| 6 ^D{#define}D_ CHROME_BROWSER_DOWNLOAD_DOWNLOAD_CONFIRMATION_REASON_H_ 189 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 5, 7)} 190 | 092| 7 191 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 6, 7)} 192 | 093| 8 ^c{// Reason why ^${DownloadTargetDeterminer}$_ requested additional confirmation for the}c_ 193 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 7, 7)} 194 | 094| 9 ^c{// target path via RequestConfirmation delegate method.}c_ 195 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 8, 7)} 196 | 095| 10 ^k{enum}k_ ^k{class}k_ DownloadConfirmationReason { 197 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 9, 7)} 198 | 096| 11 NONE, 199 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 10, 7)} 200 | 097| 12 }>_ 201 | |{'j': ('src/chrome/browser/download/download_confirmation_reason.h', 11, 7)} 202 | 098| 203 | |{} 204 | 099|10. src/chrome/browser/download/chrome_download_manager_delegate.h^>{ 205 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 0, 0)} 206 | 100| 51 ^k{class}k_ ChromeDownloadManagerDelegate 207 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 50, 7)} 208 | 101| 52 : ^k{public}k_ content::DownloadManagerDelegate, 209 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 51, 7)} 210 | 102| 53 ^k{public}k_ content::NotificationObserver, 211 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 52, 7)} 212 | 103| 54 ^k{public}k_ ^${DownloadTargetDeterminer}$_Delegate { 213 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 53, 7)} 214 | 104| 55 ^k{public}k_: 215 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 54, 7)} 216 | 105| 56 ^k{explicit}k_ ChromeDownloadManagerDelegate(Profile* profile); 217 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 55, 7)} 218 | 106| 57 ~ChromeDownloadManagerDelegate() ^k{override}k_; 219 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 56, 7)} 220 | 107| 58 }>_ 221 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate.h', 57, 7)} 222 | 108| 223 | |{} 224 | 109|11. src/chrome/browser/extensions/api/downloads/downloads_api.cc^>{ 225 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 0, 0)} 226 | 110| 1691 ^c{// chrome.downloads.onDeterminingFilename.addListener, which adds an}c_ 227 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1690, 9)} 228 | 111| 1692 ^c{// EventListener object to ExtensionEventRouter::listeners().}c_ 229 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1691, 9)} 230 | 112| 1693 ^c{//}c_ 231 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1692, 9)} 232 | 113| 1694 ^c{// When a download's filename is being determined, ^${DownloadTargetDeterminer}$_ (via}c_ 233 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1693, 9)} 234 | 114| 1695 ^c{// ChromeDownloadManagerDelegate (CDMD) ::NotifyExtensions()) passes 2 callbacks}c_ 235 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1694, 9)} 236 | 115| 1696 ^c{// to ExtensionDownloadsEventRouter::OnDeterminingFilename (ODF), which stores}c_ 237 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1695, 9)} 238 | 116| 1697 ^c{// the callbacks in the item's ExtensionDownloadsEventRouterData (EDERD) along}c_ 239 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1696, 9)} 240 | 117| 1698 }>_ 241 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api.cc', 1697, 9)} 242 | 118| 243 | |{} 244 | 119|12. src/chrome/browser/download/download_confirmation_result.h^>{ 245 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 0, 0)} 246 | 120| 8 ^D{#include}D_ ^s{"build/build_config.h"}s_ 247 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 7, 7)} 248 | 121| 9 249 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 8, 7)} 250 | 122| 10 ^c{// Result of RequestConfirmation delegate method for}c_ 251 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 9, 7)} 252 | 123| 11 ^c{// ^${DownloadTargetDeterminer}$_Delegate.}c_ 253 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 10, 7)} 254 | 124| 12 ^k{enum}k_ ^k{class}k_ DownloadConfirmationResult { 255 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 11, 7)} 256 | 125| 13 ^c{// The user confirmed the path. Only use this value if the user was explicitly}c_ 257 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 12, 7)} 258 | 126| 14 ^c{// shown the path or at least the filename being downloaded.}c_ 259 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 13, 7)} 260 | 127| 15 }>_ 261 | |{'j': ('src/chrome/browser/download/download_confirmation_result.h', 14, 7)} 262 | 128| 263 | |{} 264 | 129|13. src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc^>{ 265 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 0, 0)} 266 | 130| 150 ^c{// DownloadPathReservationTracker talks to the underlying file system. For}c_ 267 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 149, 8)} 268 | 131| 151 ^c{// tests we are going to mock it out so that we can test how}c_ 269 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 150, 8)} 270 | 132| 152 ^c{// ChromeDownloadManagerDelegate reponds to various ^${DownloadTargetDeterminer}$_}c_ 271 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 151, 8)} 272 | 133| 153 ^c{// results.}c_ 273 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 152, 8)} 274 | 134| 154 ^k{void}k_ ReserveVirtualPath( 275 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 153, 8)} 276 | 135| 155 download::DownloadItem* download, 277 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 154, 8)} 278 | 136| 156 }>_ 279 | |{'j': ('src/chrome/browser/download/chrome_download_manager_delegate_unittest.cc', 155, 8)} 280 | 137| 281 | |{} 282 | 138|14. src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc^>{ 283 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 0, 0)} 284 | 139| 2928 EXPECT_EQ(^s{""}s_, error); 285 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2927, 9)} 286 | 140| 2929 287 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2928, 9)} 288 | 141| 2930 ^c{// Calling DetermineFilename again should return an error instead of calling}c_ 289 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2929, 9)} 290 | 142| 2931 ^c{// ^${DownloadTargetDeterminer}$_.}c_ 291 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2930, 9)} 292 | 143| 2932 ASSERT_FALSE(ExtensionDownloadsEventRouter::DetermineFilename( 293 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2931, 9)} 294 | 144| 2933 current_browser()->profile(), ^k{false}k_, GetExtensionId(), result_id, 295 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2932, 9)} 296 | 145| 2934 base::FilePath(FILE_PATH_LITERAL(^s{"different"}s_)), 297 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2933, 9)} 298 | 146| 2935 }>_ 299 | |{'j': ('src/chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc', 2934, 9)} 300 | 147| 301 | |{} 302 | 148|15. src/chrome/browser/download/download_path_reservation_tracker_unittest.cc^>{ 303 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 0, 0)} 304 | 149| 246 ASSERT_EQ(^0{0}0_, base::WriteFile(path, ^s{""}s_, ^0{0}0_)); 305 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 245, 8)} 306 | 150| 247 ASSERT_EQ(^0{0}0_, 307 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 246, 8)} 308 | 151| 248 base::WriteFile( 309 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 247, 8)} 310 | 152| 249 ^${DownloadTargetDeterminer}$_::GetCrDownloadPath(path1), ^s{""}s_, ^0{0}0_)); 311 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 248, 8)} 312 | 153| 250 ASSERT_TRUE(IsPathInUse(path)); 313 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 249, 8)} 314 | 154| 251 315 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 250, 8)} 316 | 155| 252 base::FilePath reserved_path; 317 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 251, 8)} 318 | 156| 253 }>_ 319 | |{'j': ('src/chrome/browser/download/download_path_reservation_tracker_unittest.cc', 252, 8)} 320 | 157| 321 | |{} 322 | 158|16. src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc^>{ 323 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 0, 0)} 324 | 159| 21 ^k{namespace}k_ { 325 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 20, 7)} 326 | 160| 22 327 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 21, 7)} 328 | 161| 23 ^k{void}k_ CreateNewFileDone( 329 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 22, 7)} 330 | 162| 24 ^k{const}k_ ^${DownloadTargetDeterminer}$_Delegate::ConfirmationCallback& callback, 331 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 23, 7)} 332 | 163| 25 PathValidationResult result, 333 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 24, 7)} 334 | 164| 26 ^k{const}k_ base::FilePath& target_path) { 335 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 25, 7)} 336 | 165| 27 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 337 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 26, 7)} 338 | 166| 28 }>_ 339 | |{'j': ('src/chrome/browser/android/download/chrome_duplicate_download_infobar_delegate.cc', 27, 7)} 340 | 167| 341 | |{} 342 | 168| 343 | |{} 344 | -------------------------------------------------------------------------------- /render/testdata/search-response-02.json: -------------------------------------------------------------------------------- 1 | { 2 | "search_response": [ 3 | { 4 | "hit_max_results": false, 5 | "status": 0, 6 | "estimated_total_number_of_results": 2, 7 | "search_result": [ 8 | { 9 | "docid": "A8sapeUr92w", 10 | "match_reason": { 11 | "blame": false, 12 | "content": true, 13 | "filename_lineno": false, 14 | "scoped_symbol": true, 15 | "filename": false 16 | }, 17 | "language": "c++", 18 | "best_matching_line_number": 23, 19 | "snippet": [ 20 | { 21 | "scope": "base", 22 | "first_line_number": 20, 23 | "match_reason": { 24 | "blame": false, 25 | "content": true, 26 | "filename_lineno": false, 27 | "scoped_symbol": true, 28 | "filename": false 29 | }, 30 | "text": { 31 | "text": "// version of the constructor, and if we are building a dynamic library we may\n// end up with multiple AtExitManagers on the same process. We don't protect\n// this for thread-safe access, since it will only be modified in testing.\nstatic AtExitManager* g_top_manager = nullptr;\n\nstatic bool g_disable_managers = false;\n\n", 32 | "range": [ 33 | { 34 | "range": { 35 | "start_line": 1, 36 | "end_line": 2, 37 | "start_column": 1, 38 | "end_column": 1 39 | }, 40 | "type": "SYNTAX_COMMENT" 41 | }, 42 | { 43 | "range": { 44 | "start_line": 2, 45 | "end_line": 3, 46 | "start_column": 1, 47 | "end_column": 1 48 | }, 49 | "type": "SYNTAX_COMMENT" 50 | }, 51 | { 52 | "range": { 53 | "start_line": 3, 54 | "end_line": 4, 55 | "start_column": 1, 56 | "end_column": 1 57 | }, 58 | "type": "SYNTAX_COMMENT" 59 | }, 60 | { 61 | "range": { 62 | "start_line": 4, 63 | "end_line": 4, 64 | "start_column": 1, 65 | "end_column": 7 66 | }, 67 | "type": "SYNTAX_KEYWORD" 68 | }, 69 | { 70 | "range": { 71 | "start_line": 4, 72 | "end_line": 4, 73 | "start_column": 23, 74 | "end_column": 36 75 | }, 76 | "type": "SNIPPET_QUERY_MATCH" 77 | }, 78 | { 79 | "range": { 80 | "start_line": 4, 81 | "end_line": 4, 82 | "start_column": 39, 83 | "end_column": 46 84 | }, 85 | "type": "SYNTAX_KEYWORD" 86 | }, 87 | { 88 | "range": { 89 | "start_line": 6, 90 | "end_line": 6, 91 | "start_column": 1, 92 | "end_column": 7 93 | }, 94 | "type": "SYNTAX_KEYWORD" 95 | }, 96 | { 97 | "range": { 98 | "start_line": 6, 99 | "end_line": 6, 100 | "start_column": 8, 101 | "end_column": 12 102 | }, 103 | "type": "SYNTAX_KEYWORD" 104 | }, 105 | { 106 | "range": { 107 | "start_line": 6, 108 | "end_line": 6, 109 | "start_column": 34, 110 | "end_column": 39 111 | }, 112 | "type": "SYNTAX_KEYWORD" 113 | } 114 | ] 115 | } 116 | }, 117 | { 118 | "scope": "base::AtExitManager::RegisterTask", 119 | "first_line_number": 62, 120 | "match_reason": { 121 | "blame": false, 122 | "content": true, 123 | "filename_lineno": false, 124 | "scoped_symbol": false, 125 | "filename": false 126 | }, 127 | "text": { 128 | "text": " AutoLock lock(g_top_manager->lock_);\n DCHECK(!g_top_manager->processing_callbacks_);\n g_top_manager->stack_.push(std::move(task));\n}\n\n// static\n", 129 | "range": [ 130 | { 131 | "range": { 132 | "start_line": 1, 133 | "end_line": 1, 134 | "start_column": 17, 135 | "end_column": 30 136 | }, 137 | "type": "SNIPPET_QUERY_MATCH" 138 | }, 139 | { 140 | "range": { 141 | "start_line": 2, 142 | "end_line": 2, 143 | "start_column": 11, 144 | "end_column": 24 145 | }, 146 | "type": "SNIPPET_QUERY_MATCH" 147 | }, 148 | { 149 | "range": { 150 | "start_line": 3, 151 | "end_line": 3, 152 | "start_column": 3, 153 | "end_column": 16 154 | }, 155 | "type": "SNIPPET_QUERY_MATCH" 156 | }, 157 | { 158 | "range": { 159 | "start_line": 6, 160 | "end_line": 7, 161 | "start_column": 1, 162 | "end_column": 1 163 | }, 164 | "type": "SYNTAX_COMMENT" 165 | } 166 | ] 167 | } 168 | }, 169 | { 170 | "scope": "base", 171 | "first_line_number": 95, 172 | "match_reason": { 173 | "blame": false, 174 | "content": true, 175 | "filename_lineno": false, 176 | "scoped_symbol": false, 177 | "filename": false 178 | }, 179 | "text": { 180 | "text": " DCHECK(g_top_manager->stack_.empty());\n}\n\nvoid AtExitManager::DisableAllAtExitManagers() {\n AutoLock lock(g_top_manager->lock_);\n g_disable_managers = true;\n}\n\nAtExitManager::AtExitManager(bool shadow)\n : processing_callbacks_(false), next_manager_(g_top_manager) {\n DCHECK(shadow || !g_top_manager);\n g_top_manager = this;\n", 181 | "range": [ 182 | { 183 | "range": { 184 | "start_line": 1, 185 | "end_line": 1, 186 | "start_column": 10, 187 | "end_column": 23 188 | }, 189 | "type": "SNIPPET_QUERY_MATCH" 190 | }, 191 | { 192 | "range": { 193 | "start_line": 4, 194 | "end_line": 4, 195 | "start_column": 1, 196 | "end_column": 5 197 | }, 198 | "type": "SYNTAX_KEYWORD" 199 | }, 200 | { 201 | "range": { 202 | "start_line": 5, 203 | "end_line": 5, 204 | "start_column": 17, 205 | "end_column": 30 206 | }, 207 | "type": "SNIPPET_QUERY_MATCH" 208 | }, 209 | { 210 | "range": { 211 | "start_line": 6, 212 | "end_line": 6, 213 | "start_column": 24, 214 | "end_column": 28 215 | }, 216 | "type": "SYNTAX_KEYWORD" 217 | }, 218 | { 219 | "range": { 220 | "start_line": 9, 221 | "end_line": 9, 222 | "start_column": 30, 223 | "end_column": 34 224 | }, 225 | "type": "SYNTAX_KEYWORD" 226 | }, 227 | { 228 | "range": { 229 | "start_line": 10, 230 | "end_line": 10, 231 | "start_column": 29, 232 | "end_column": 34 233 | }, 234 | "type": "SYNTAX_KEYWORD" 235 | }, 236 | { 237 | "range": { 238 | "start_line": 10, 239 | "end_line": 10, 240 | "start_column": 51, 241 | "end_column": 64 242 | }, 243 | "type": "SNIPPET_QUERY_MATCH" 244 | }, 245 | { 246 | "range": { 247 | "start_line": 11, 248 | "end_line": 11, 249 | "start_column": 21, 250 | "end_column": 34 251 | }, 252 | "type": "SNIPPET_QUERY_MATCH" 253 | }, 254 | { 255 | "range": { 256 | "start_line": 12, 257 | "end_line": 12, 258 | "start_column": 3, 259 | "end_column": 16 260 | }, 261 | "type": "SNIPPET_QUERY_MATCH" 262 | }, 263 | { 264 | "range": { 265 | "start_line": 12, 266 | "end_line": 12, 267 | "start_column": 19, 268 | "end_column": 23 269 | }, 270 | "type": "SYNTAX_KEYWORD" 271 | } 272 | ] 273 | } 274 | } 275 | ], 276 | "num_duplicates": 0, 277 | "top_file": { 278 | "display_name": {}, 279 | "file": { 280 | "changelist": "52c2151398e310524ee0ceca4caad5e8d3857267", 281 | "name": "src/base/at_exit.cc", 282 | "package_name": "chromium" 283 | }, 284 | "license": {}, 285 | "size": 0 286 | }, 287 | "has_unshown_matches": true, 288 | "num_matches": 20, 289 | "is_augmented": false, 290 | "hit_max_matches": false 291 | }, 292 | { 293 | "docid": "svems5DwV8Q", 294 | "match_reason": { 295 | "blame": false, 296 | "content": true, 297 | "filename_lineno": false, 298 | "scoped_symbol": false, 299 | "filename": false 300 | }, 301 | "language": "c++", 302 | "best_matching_line_number": 112, 303 | "snippet": [ 304 | { 305 | "scope": "kTSanDefaultSuppressions", 306 | "first_line_number": 109, 307 | "match_reason": { 308 | "blame": false, 309 | "content": true, 310 | "filename_lineno": false, 311 | "scoped_symbol": false, 312 | "filename": false 313 | }, 314 | "text": { 315 | "text": " \"race:base::Thread::StopSoon\\n\"\n\n // http://crbug.com/272095\n \"race:base::g_top_manager\\n\"\n\n // http://crbug.com/308590\n \"race:CustomThreadWatcher::~CustomThreadWatcher\\n\"\n", 316 | "range": [ 317 | { 318 | "range": { 319 | "start_line": 1, 320 | "end_line": 1, 321 | "start_column": 5, 322 | "end_column": 36 323 | }, 324 | "type": "SYNTAX_STRING" 325 | }, 326 | { 327 | "range": { 328 | "start_line": 3, 329 | "end_line": 4, 330 | "start_column": 5, 331 | "end_column": 1 332 | }, 333 | "type": "SYNTAX_COMMENT" 334 | }, 335 | { 336 | "range": { 337 | "start_line": 4, 338 | "end_line": 4, 339 | "start_column": 5, 340 | "end_column": 33 341 | }, 342 | "type": "SYNTAX_STRING" 343 | }, 344 | { 345 | "range": { 346 | "start_line": 4, 347 | "end_line": 4, 348 | "start_column": 17, 349 | "end_column": 30 350 | }, 351 | "type": "SNIPPET_QUERY_MATCH" 352 | }, 353 | { 354 | "range": { 355 | "start_line": 6, 356 | "end_line": 7, 357 | "start_column": 5, 358 | "end_column": 1 359 | }, 360 | "type": "SYNTAX_COMMENT" 361 | }, 362 | { 363 | "range": { 364 | "start_line": 7, 365 | "end_line": 7, 366 | "start_column": 5, 367 | "end_column": 55 368 | }, 369 | "type": "SYNTAX_STRING" 370 | } 371 | ] 372 | } 373 | } 374 | ], 375 | "num_duplicates": 0, 376 | "top_file": { 377 | "display_name": {}, 378 | "file": { 379 | "changelist": "9e475c6cd78c848504bef4b4939d1aca7619b24d", 380 | "name": "src/build/sanitizers/tsan_suppressions.cc", 381 | "package_name": "chromium" 382 | }, 383 | "license": {}, 384 | "size": 0 385 | }, 386 | "has_unshown_matches": false, 387 | "num_matches": 1, 388 | "is_augmented": false, 389 | "hit_max_matches": false 390 | } 391 | ], 392 | "results_offset": 0, 393 | "hit_max_matches_per_file": false, 394 | "maybe_skipped_documents": false, 395 | "hit_max_to_score": false 396 | } 397 | ] 398 | } 399 | -------------------------------------------------------------------------------- /render/testdata/search-response-02.json.actual: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|CodeSearch results for ^q{unspecified}q_ 9 | |{} 10 | 002| 11 | |{} 12 | 003|1. src/base/at_exit.cc^>{ 13 | |{'j': ('src/base/at_exit.cc', 0, 0)} 14 | 004| 20 ^c{// version of the constructor, and if we are building a dynamic library we may}c_ 15 | |{'j': ('src/base/at_exit.cc', 19, 7)} 16 | 005| 21 ^c{// end up with multiple AtExitManagers on the same process. We don't protect}c_ 17 | |{'j': ('src/base/at_exit.cc', 20, 7)} 18 | 006| 22 ^c{// this for thread-safe access, since it will only be modified in testing.}c_ 19 | |{'j': ('src/base/at_exit.cc', 21, 7)} 20 | 007| 23 ^k{static}k_ AtExitManager* ^${g_top_manager}$_ = ^k{nullptr}k_; 21 | |{'j': ('src/base/at_exit.cc', 22, 7)} 22 | 008| 24 23 | |{'j': ('src/base/at_exit.cc', 23, 7)} 24 | 009| 25 ^k{static}k_ ^k{bool}k_ g_disable_managers = ^k{false}k_; 25 | |{'j': ('src/base/at_exit.cc', 24, 7)} 26 | 010| 26 27 | |{'j': ('src/base/at_exit.cc', 25, 7)} 28 | 011| 27 }>_^>{ 29 | |{'j': ('src/base/at_exit.cc', 26, 7)} 30 | 012| [...] 31 | |{'j': ('src/base/at_exit.cc', 61, 9)} 32 | 013| 62 AutoLock lock(^${g_top_manager}$_->lock_); 33 | |{'j': ('src/base/at_exit.cc', 61, 7)} 34 | 014| 63 DCHECK(!^${g_top_manager}$_->processing_callbacks_); 35 | |{'j': ('src/base/at_exit.cc', 62, 7)} 36 | 015| 64 ^${g_top_manager}$_->stack_.push(std::move(task)); 37 | |{'j': ('src/base/at_exit.cc', 63, 7)} 38 | 016| 65 } 39 | |{'j': ('src/base/at_exit.cc', 64, 7)} 40 | 017| 66 41 | |{'j': ('src/base/at_exit.cc', 65, 7)} 42 | 018| 67 ^c{// static}c_ 43 | |{'j': ('src/base/at_exit.cc', 66, 7)} 44 | 019| 68 }>_^>{ 45 | |{'j': ('src/base/at_exit.cc', 67, 7)} 46 | 020| [...] 47 | |{'j': ('src/base/at_exit.cc', 94, 9)} 48 | 021| 95 DCHECK(^${g_top_manager}$_->stack_.empty()); 49 | |{'j': ('src/base/at_exit.cc', 94, 8)} 50 | 022| 96 } 51 | |{'j': ('src/base/at_exit.cc', 95, 8)} 52 | 023| 97 53 | |{'j': ('src/base/at_exit.cc', 96, 8)} 54 | 024| 98 ^k{void}k_ AtExitManager::DisableAllAtExitManagers() { 55 | |{'j': ('src/base/at_exit.cc', 97, 8)} 56 | 025| 99 AutoLock lock(^${g_top_manager}$_->lock_); 57 | |{'j': ('src/base/at_exit.cc', 98, 8)} 58 | 026| 100 g_disable_managers = ^k{true}k_; 59 | |{'j': ('src/base/at_exit.cc', 99, 8)} 60 | 027| 101 } 61 | |{'j': ('src/base/at_exit.cc', 100, 8)} 62 | 028| 102 63 | |{'j': ('src/base/at_exit.cc', 101, 8)} 64 | 029| 103 AtExitManager::AtExitManager(^k{bool}k_ shadow) 65 | |{'j': ('src/base/at_exit.cc', 102, 8)} 66 | 030| 104 : processing_callbacks_(^k{false}k_), next_manager_(^${g_top_manager}$_) { 67 | |{'j': ('src/base/at_exit.cc', 103, 8)} 68 | 031| 105 DCHECK(shadow || !^${g_top_manager}$_); 69 | |{'j': ('src/base/at_exit.cc', 104, 8)} 70 | 032| 106 ^${g_top_manager}$_ = ^k{this}k_; 71 | |{'j': ('src/base/at_exit.cc', 105, 8)} 72 | 033| 107 }>_ 73 | |{'j': ('src/base/at_exit.cc', 106, 8)} 74 | 034| 75 | |{} 76 | 035|2. src/build/sanitizers/tsan_suppressions.cc^>{ 77 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 0, 0)} 78 | 036| 109 ^s{"race:base::Thread::StopSoon\n"}s_ 79 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 108, 8)} 80 | 037| 110 81 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 109, 8)} 82 | 038| 111 ^c{// http://crbug.com/272095}c_ 83 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 110, 8)} 84 | 039| 112 ^s{"race:base::^${g_top_manager}$_\n"}s_ 85 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 111, 8)} 86 | 040| 113 87 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 112, 8)} 88 | 041| 114 ^c{// http://crbug.com/308590}c_ 89 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 113, 8)} 90 | 042| 115 ^s{"race:CustomThreadWatcher::~CustomThreadWatcher\n"}s_ 91 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 114, 8)} 92 | 043| 116 }>_ 93 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 115, 8)} 94 | 044| 95 | |{} 96 | 045| 97 | |{} 98 | -------------------------------------------------------------------------------- /render/testdata/search-response-02.json.expected: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|CodeSearch results for ^q{unspecified}q_ 9 | |{} 10 | 002| 11 | |{} 12 | 003|1. src/base/at_exit.cc^>{ 13 | |{'j': ('src/base/at_exit.cc', 0, 0)} 14 | 004| 20 ^c{// version of the constructor, and if we are building a dynamic library we may}c_ 15 | |{'j': ('src/base/at_exit.cc', 19, 7)} 16 | 005| 21 ^c{// end up with multiple AtExitManagers on the same process. We don't protect}c_ 17 | |{'j': ('src/base/at_exit.cc', 20, 7)} 18 | 006| 22 ^c{// this for thread-safe access, since it will only be modified in testing.}c_ 19 | |{'j': ('src/base/at_exit.cc', 21, 7)} 20 | 007| 23 ^k{static}k_ AtExitManager* ^${g_top_manager}$_ = ^k{nullptr}k_; 21 | |{'j': ('src/base/at_exit.cc', 22, 7)} 22 | 008| 24 23 | |{'j': ('src/base/at_exit.cc', 23, 7)} 24 | 009| 25 ^k{static}k_ ^k{bool}k_ g_disable_managers = ^k{false}k_; 25 | |{'j': ('src/base/at_exit.cc', 24, 7)} 26 | 010| 26 27 | |{'j': ('src/base/at_exit.cc', 25, 7)} 28 | 011| 27 }>_^>{ 29 | |{'j': ('src/base/at_exit.cc', 26, 7)} 30 | 012| [...] 31 | |{'j': ('src/base/at_exit.cc', 61, 9)} 32 | 013| 62 AutoLock lock(^${g_top_manager}$_->lock_); 33 | |{'j': ('src/base/at_exit.cc', 61, 7)} 34 | 014| 63 DCHECK(!^${g_top_manager}$_->processing_callbacks_); 35 | |{'j': ('src/base/at_exit.cc', 62, 7)} 36 | 015| 64 ^${g_top_manager}$_->stack_.push(std::move(task)); 37 | |{'j': ('src/base/at_exit.cc', 63, 7)} 38 | 016| 65 } 39 | |{'j': ('src/base/at_exit.cc', 64, 7)} 40 | 017| 66 41 | |{'j': ('src/base/at_exit.cc', 65, 7)} 42 | 018| 67 ^c{// static}c_ 43 | |{'j': ('src/base/at_exit.cc', 66, 7)} 44 | 019| 68 }>_^>{ 45 | |{'j': ('src/base/at_exit.cc', 67, 7)} 46 | 020| [...] 47 | |{'j': ('src/base/at_exit.cc', 94, 9)} 48 | 021| 95 DCHECK(^${g_top_manager}$_->stack_.empty()); 49 | |{'j': ('src/base/at_exit.cc', 94, 8)} 50 | 022| 96 } 51 | |{'j': ('src/base/at_exit.cc', 95, 8)} 52 | 023| 97 53 | |{'j': ('src/base/at_exit.cc', 96, 8)} 54 | 024| 98 ^k{void}k_ AtExitManager::DisableAllAtExitManagers() { 55 | |{'j': ('src/base/at_exit.cc', 97, 8)} 56 | 025| 99 AutoLock lock(^${g_top_manager}$_->lock_); 57 | |{'j': ('src/base/at_exit.cc', 98, 8)} 58 | 026| 100 g_disable_managers = ^k{true}k_; 59 | |{'j': ('src/base/at_exit.cc', 99, 8)} 60 | 027| 101 } 61 | |{'j': ('src/base/at_exit.cc', 100, 8)} 62 | 028| 102 63 | |{'j': ('src/base/at_exit.cc', 101, 8)} 64 | 029| 103 AtExitManager::AtExitManager(^k{bool}k_ shadow) 65 | |{'j': ('src/base/at_exit.cc', 102, 8)} 66 | 030| 104 : processing_callbacks_(^k{false}k_), next_manager_(^${g_top_manager}$_) { 67 | |{'j': ('src/base/at_exit.cc', 103, 8)} 68 | 031| 105 DCHECK(shadow || !^${g_top_manager}$_); 69 | |{'j': ('src/base/at_exit.cc', 104, 8)} 70 | 032| 106 ^${g_top_manager}$_ = ^k{this}k_; 71 | |{'j': ('src/base/at_exit.cc', 105, 8)} 72 | 033| 107 }>_ 73 | |{'j': ('src/base/at_exit.cc', 106, 8)} 74 | 034| 75 | |{} 76 | 035|2. src/build/sanitizers/tsan_suppressions.cc^>{ 77 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 0, 0)} 78 | 036| 109 ^s{"race:base::Thread::StopSoon\n"}s_ 79 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 108, 8)} 80 | 037| 110 81 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 109, 8)} 82 | 038| 111 ^c{// http://crbug.com/272095}c_ 83 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 110, 8)} 84 | 039| 112 ^s{"race:base::^${g_top_manager}$_\n"}s_ 85 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 111, 8)} 86 | 040| 113 87 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 112, 8)} 88 | 041| 114 ^c{// http://crbug.com/308590}c_ 89 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 113, 8)} 90 | 042| 115 ^s{"race:CustomThreadWatcher::~CustomThreadWatcher\n"}s_ 91 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 114, 8)} 92 | 043| 116 }>_ 93 | |{'j': ('src/build/sanitizers/tsan_suppressions.cc', 115, 8)} 94 | 044| 95 | |{} 96 | 045| 97 | |{} 98 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-01.json: -------------------------------------------------------------------------------- 1 | { 2 | "xref_search_response": [ 3 | { 4 | "status": 0, 5 | "estimated_total_type_count": [ 6 | { 7 | "count": 2, 8 | "type": "DEFINITION", 9 | "type_id": "DEFINITION" 10 | }, 11 | { 12 | "count": 1, 13 | "type": "DECLARATION", 14 | "type_id": "DECLARATION" 15 | }, 16 | { 17 | "count": 10, 18 | "type": "REFERENCE", 19 | "type_id": "REFERENCE" 20 | } 21 | ], 22 | "search_result": [ 23 | { 24 | "file": { 25 | "name": "src/net/http/http_basic_state.cc", 26 | "package_name": "chromium" 27 | }, 28 | "match": [ 29 | { 30 | "line_text": "HttpBasicState::HttpBasicState(std::unique_ptr connection,", 31 | "line_number": 20, 32 | "type_id": "DEFINITION", 33 | "type": "DEFINITION", 34 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state.cc#%40547%3A561%40UV8Xn%2F7Mig1SenttuQRLCFwGKvhudSAKChBQlhAbhxg%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_basic_state.cc" 35 | }, 36 | { 37 | "line_text": "HttpBasicState::HttpBasicState(std::unique_ptr connection,", 38 | "line_number": 20, 39 | "type_id": "DEFINITION", 40 | "type": "DEFINITION", 41 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state.cc#%40547%3A561%40UV8Xn%2F7Mig1SenttuQRLCFwGKvhudSAKChBQlhAbhxg%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_basic_state.cc" 42 | } 43 | ] 44 | }, 45 | { 46 | "file": { 47 | "name": "src/net/http/http_basic_state.h", 48 | "package_name": "chromium" 49 | }, 50 | "match": [ 51 | { 52 | "line_text": " HttpBasicState(std::unique_ptr connection,", 53 | "line_number": 31, 54 | "type_id": "DECLARATION", 55 | "type": "DECLARATION", 56 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state.h#%40796%3A810%40SrzFHJz9ps5vos5RaeTIOzu84UtYhBfMFCBdSAof%2F0E%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_basic_state.h" 57 | } 58 | ] 59 | }, 60 | { 61 | "file": { 62 | "name": "src/net/http/http_basic_state_unittest.cc", 63 | "package_name": "chromium" 64 | }, 65 | "match": [ 66 | { 67 | "line_text": " const HttpBasicState state(base::WrapUnique(handle), true /* using_proxy */,", 68 | "line_number": 21, 69 | "type_id": "REFERENCE", 70 | "type": "REFERENCE", 71 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%40737%3A742" 72 | }, 73 | { 74 | "line_text": " const HttpBasicState state(std::make_unique(),", 75 | "line_number": 29, 76 | "type_id": "REFERENCE", 77 | "type": "REFERENCE", 78 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%401105%3A1110" 79 | }, 80 | { 81 | "line_text": " HttpBasicState state(base::WrapUnique(handle), false, false);", 82 | "line_number": 39, 83 | "type_id": "REFERENCE", 84 | "type": "REFERENCE", 85 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%401563%3A1568" 86 | }, 87 | { 88 | "line_text": " HttpBasicState state(std::make_unique(), false, false);", 89 | "line_number": 47, 90 | "type_id": "REFERENCE", 91 | "type": "REFERENCE", 92 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%401860%3A1865" 93 | }, 94 | { 95 | "line_text": " HttpBasicState state(std::make_unique(), false, false);", 96 | "line_number": 54, 97 | "type_id": "REFERENCE", 98 | "type": "REFERENCE", 99 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%402129%3A2134" 100 | }, 101 | { 102 | "line_text": " HttpBasicState state(std::make_unique(), false, false);", 103 | "line_number": 64, 104 | "type_id": "REFERENCE", 105 | "type": "REFERENCE", 106 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%402570%3A2575" 107 | }, 108 | { 109 | "line_text": " HttpBasicState state(std::make_unique(), use_proxy,", 110 | "line_number": 74, 111 | "type_id": "REFERENCE", 112 | "type": "REFERENCE", 113 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%402933%3A2938" 114 | }, 115 | { 116 | "line_text": " HttpBasicState state(std::make_unique(), use_proxy,", 117 | "line_number": 85, 118 | "type_id": "REFERENCE", 119 | "type": "REFERENCE", 120 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_state_unittest.cc#%403406%3A3411" 121 | } 122 | ] 123 | }, 124 | { 125 | "file": { 126 | "name": "src/net/http/http_basic_stream.cc", 127 | "package_name": "chromium" 128 | }, 129 | "match": [ 130 | { 131 | "line_text": " : state_(std::move(connection),", 132 | "line_number": 20, 133 | "type_id": "REFERENCE", 134 | "type": "REFERENCE", 135 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_basic_stream.cc#%40685%3A691" 136 | } 137 | ] 138 | }, 139 | { 140 | "file": { 141 | "name": "src/net/websockets/websocket_basic_handshake_stream.cc", 142 | "package_name": "chromium" 143 | }, 144 | "match": [ 145 | { 146 | "line_text": " state_(std::move(connection),", 147 | "line_number": 175, 148 | "type_id": "REFERENCE", 149 | "type": "REFERENCE", 150 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/websockets/websocket_basic_handshake_stream.cc#%406051%3A6057" 151 | } 152 | ] 153 | } 154 | ], 155 | "from_kythe": true, 156 | "grok_total_number_of_results": 0 157 | } 158 | ] 159 | } 160 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-01.json.actual: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^Cat{Definition: 9 | |{} 10 | 002|}Cat_ ^F{src/net/http/http_basic_state.cc}F_ 11 | |{'j': ('src/net/http/http_basic_state.cc', 0, 7)} 12 | 003| 20: ^>{HttpBasicState::HttpBasicState(std::unique_ptr connection,}>_ 13 | |{'j': ('src/net/http/http_basic_state.cc', 19, 9)} 14 | 004| 20: ^>{HttpBasicState::HttpBasicState(std::unique_ptr connection,}>_ 15 | |{'j': ('src/net/http/http_basic_state.cc', 19, 9)} 16 | 005| 17 | |{} 18 | 006|^Cat{Declaration: 19 | |{} 20 | 007|}Cat_ ^F{src/net/http/http_basic_state.h}F_ 21 | |{'j': ('src/net/http/http_basic_state.h', 0, 7)} 22 | 008| 31: ^>{ HttpBasicState(std::unique_ptr connection,}>_ 23 | |{'j': ('src/net/http/http_basic_state.h', 30, 9)} 24 | 009| 25 | |{} 26 | 010|^Cat{References: 27 | |{} 28 | 011|}Cat_ ^F{src/net/http/http_basic_state_unittest.cc}F_ 29 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 0, 7)} 30 | 012| 21: ^>{ const HttpBasicState state(base::WrapUnique(handle), true /* using_proxy */,}>_ 31 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 20, 9)} 32 | 013| 29: ^>{ const HttpBasicState state(std::make_unique(),}>_ 33 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 28, 9)} 34 | 014| 39: ^>{ HttpBasicState state(base::WrapUnique(handle), false, false);}>_ 35 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 38, 9)} 36 | 015| 47: ^>{ HttpBasicState state(std::make_unique(), false, false);}>_ 37 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 46, 9)} 38 | 016| 54: ^>{ HttpBasicState state(std::make_unique(), false, false);}>_ 39 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 53, 9)} 40 | 017| 64: ^>{ HttpBasicState state(std::make_unique(), false, false);}>_ 41 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 63, 9)} 42 | 018| 74: ^>{ HttpBasicState state(std::make_unique(), use_proxy,}>_ 43 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 73, 9)} 44 | 019| 85: ^>{ HttpBasicState state(std::make_unique(), use_proxy,}>_ 45 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 84, 9)} 46 | 020| 47 | |{} 48 | 021| ^F{src/net/http/http_basic_stream.cc}F_ 49 | |{'j': ('src/net/http/http_basic_stream.cc', 0, 2)} 50 | 022| 20: ^>{ : state_(std::move(connection),}>_ 51 | |{'j': ('src/net/http/http_basic_stream.cc', 19, 9)} 52 | 023| 53 | |{} 54 | 024| ^F{src/net/websockets/websocket_basic_handshake_stream.cc}F_ 55 | |{'j': ('src/net/websockets/websocket_basic_handshake_stream.cc', 0, 2)} 56 | 025| 175: ^>{ state_(std::move(connection),}>_ 57 | |{'j': ('src/net/websockets/websocket_basic_handshake_stream.cc', 174, 10)} 58 | 026| 59 | |{} 60 | 027| 61 | |{} 62 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-01.json.expected: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^Cat{Definition: 9 | |{} 10 | 002|}Cat_ ^F{src/net/http/http_basic_state.cc}F_ 11 | |{'j': ('src/net/http/http_basic_state.cc', 0, 7)} 12 | 003| 20: ^>{HttpBasicState::HttpBasicState(std::unique_ptr connection,}>_ 13 | |{'j': ('src/net/http/http_basic_state.cc', 19, 9)} 14 | 004| 20: ^>{HttpBasicState::HttpBasicState(std::unique_ptr connection,}>_ 15 | |{'j': ('src/net/http/http_basic_state.cc', 19, 9)} 16 | 005| 17 | |{} 18 | 006|^Cat{Declaration: 19 | |{} 20 | 007|}Cat_ ^F{src/net/http/http_basic_state.h}F_ 21 | |{'j': ('src/net/http/http_basic_state.h', 0, 7)} 22 | 008| 31: ^>{ HttpBasicState(std::unique_ptr connection,}>_ 23 | |{'j': ('src/net/http/http_basic_state.h', 30, 9)} 24 | 009| 25 | |{} 26 | 010|^Cat{References: 27 | |{} 28 | 011|}Cat_ ^F{src/net/http/http_basic_state_unittest.cc}F_ 29 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 0, 7)} 30 | 012| 21: ^>{ const HttpBasicState state(base::WrapUnique(handle), true /* using_proxy */,}>_ 31 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 20, 9)} 32 | 013| 29: ^>{ const HttpBasicState state(std::make_unique(),}>_ 33 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 28, 9)} 34 | 014| 39: ^>{ HttpBasicState state(base::WrapUnique(handle), false, false);}>_ 35 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 38, 9)} 36 | 015| 47: ^>{ HttpBasicState state(std::make_unique(), false, false);}>_ 37 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 46, 9)} 38 | 016| 54: ^>{ HttpBasicState state(std::make_unique(), false, false);}>_ 39 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 53, 9)} 40 | 017| 64: ^>{ HttpBasicState state(std::make_unique(), false, false);}>_ 41 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 63, 9)} 42 | 018| 74: ^>{ HttpBasicState state(std::make_unique(), use_proxy,}>_ 43 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 73, 9)} 44 | 019| 85: ^>{ HttpBasicState state(std::make_unique(), use_proxy,}>_ 45 | |{'j': ('src/net/http/http_basic_state_unittest.cc', 84, 9)} 46 | 020| 47 | |{} 48 | 021| ^F{src/net/http/http_basic_stream.cc}F_ 49 | |{'j': ('src/net/http/http_basic_stream.cc', 0, 2)} 50 | 022| 20: ^>{ : state_(std::move(connection),}>_ 51 | |{'j': ('src/net/http/http_basic_stream.cc', 19, 9)} 52 | 023| 53 | |{} 54 | 024| ^F{src/net/websockets/websocket_basic_handshake_stream.cc}F_ 55 | |{'j': ('src/net/websockets/websocket_basic_handshake_stream.cc', 0, 2)} 56 | 025| 175: ^>{ state_(std::move(connection),}>_ 57 | |{'j': ('src/net/websockets/websocket_basic_handshake_stream.cc', 174, 10)} 58 | 026| 59 | |{} 60 | 027| 61 | |{} 62 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-02.json: -------------------------------------------------------------------------------- 1 | { 2 | "xref_search_response": [ 3 | { 4 | "status": 0, 5 | "estimated_total_type_count": [ 6 | { 7 | "count": 2, 8 | "type": "DEFINITION", 9 | "type_id": "DEFINITION" 10 | }, 11 | { 12 | "count": 1, 13 | "type": "DECLARATION", 14 | "type_id": "DECLARATION" 15 | }, 16 | { 17 | "count": 1, 18 | "type": "REFERENCE", 19 | "type_id": "REFERENCE" 20 | } 21 | ], 22 | "search_result": [ 23 | { 24 | "file": { 25 | "name": "src/net/http/http_server_properties_manager.cc", 26 | "package_name": "chromium" 27 | }, 28 | "match": [ 29 | { 30 | "line_text": " &HttpServerPropertiesManager::OnHttpServerPropertiesChanged,", 31 | "line_number": 121, 32 | "type_id": "REFERENCE", 33 | "type": "REFERENCE", 34 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_server_properties_manager.cc#%404398%3A4427" 35 | }, 36 | { 37 | "line_text": "void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {", 38 | "line_number": 1284, 39 | "type_id": "DEFINITION", 40 | "type": "DEFINITION", 41 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_server_properties_manager.cc#%4050051%3A50080%40pr86o0tlYJqeE7i0UHuKyF1nqalq5iJTBS2fnnY%2Fq80%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_server_properties_manager.cc" 42 | }, 43 | { 44 | "line_text": "void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {", 45 | "line_number": 1284, 46 | "type_id": "DEFINITION", 47 | "type": "DEFINITION", 48 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_server_properties_manager.cc#%4050051%3A50080%40pr86o0tlYJqeE7i0UHuKyF1nqalq5iJTBS2fnnY%2Fq80%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_server_properties_manager.cc" 49 | } 50 | ] 51 | }, 52 | { 53 | "file": { 54 | "name": "src/net/http/http_server_properties_manager.h", 55 | "package_name": "chromium" 56 | }, 57 | "match": [ 58 | { 59 | "line_text": " void OnHttpServerPropertiesChanged();", 60 | "line_number": 204, 61 | "type_id": "DECLARATION", 62 | "type": "DECLARATION", 63 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_server_properties_manager.h#%408771%3A8800%40LGmPjlk8Ba2AD%2FyGPSqmF8foVgHxZk188FAxPOuLcHY%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_server_properties_manager.h" 64 | } 65 | ] 66 | } 67 | ], 68 | "from_kythe": true, 69 | "grok_total_number_of_results": 0 70 | } 71 | ] 72 | } 73 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-02.json.actual: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^Cat{Definition: 9 | |{} 10 | 002|}Cat_ ^F{src/net/http/http_server_properties_manager.cc}F_ 11 | |{'j': ('src/net/http/http_server_properties_manager.cc', 0, 7)} 12 | 003| 1284: ^>{void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {}>_ 13 | |{'j': ('src/net/http/http_server_properties_manager.cc', 1283, 11)} 14 | 004| 1284: ^>{void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {}>_ 15 | |{'j': ('src/net/http/http_server_properties_manager.cc', 1283, 11)} 16 | 005| 17 | |{} 18 | 006|^Cat{Declaration: 19 | |{} 20 | 007|}Cat_ ^F{src/net/http/http_server_properties_manager.h}F_ 21 | |{'j': ('src/net/http/http_server_properties_manager.h', 0, 7)} 22 | 008| 204: ^>{ void OnHttpServerPropertiesChanged();}>_ 23 | |{'j': ('src/net/http/http_server_properties_manager.h', 203, 10)} 24 | 009| 25 | |{} 26 | 010|^Cat{References: 27 | |{} 28 | 011|}Cat_ ^F{src/net/http/http_server_properties_manager.cc}F_ 29 | |{'j': ('src/net/http/http_server_properties_manager.cc', 0, 7)} 30 | 012| 121: ^>{ &HttpServerPropertiesManager::OnHttpServerPropertiesChanged,}>_ 31 | |{'j': ('src/net/http/http_server_properties_manager.cc', 120, 10)} 32 | 013| 33 | |{} 34 | 014| 35 | |{} 36 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-02.json.expected: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^Cat{Definition: 9 | |{} 10 | 002|}Cat_ ^F{src/net/http/http_server_properties_manager.cc}F_ 11 | |{'j': ('src/net/http/http_server_properties_manager.cc', 0, 7)} 12 | 003| 1284: ^>{void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {}>_ 13 | |{'j': ('src/net/http/http_server_properties_manager.cc', 1283, 11)} 14 | 004| 1284: ^>{void HttpServerPropertiesManager::OnHttpServerPropertiesChanged() {}>_ 15 | |{'j': ('src/net/http/http_server_properties_manager.cc', 1283, 11)} 16 | 005| 17 | |{} 18 | 006|^Cat{Declaration: 19 | |{} 20 | 007|}Cat_ ^F{src/net/http/http_server_properties_manager.h}F_ 21 | |{'j': ('src/net/http/http_server_properties_manager.h', 0, 7)} 22 | 008| 204: ^>{ void OnHttpServerPropertiesChanged();}>_ 23 | |{'j': ('src/net/http/http_server_properties_manager.h', 203, 10)} 24 | 009| 25 | |{} 26 | 010|^Cat{References: 27 | |{} 28 | 011|}Cat_ ^F{src/net/http/http_server_properties_manager.cc}F_ 29 | |{'j': ('src/net/http/http_server_properties_manager.cc', 0, 7)} 30 | 012| 121: ^>{ &HttpServerPropertiesManager::OnHttpServerPropertiesChanged,}>_ 31 | |{'j': ('src/net/http/http_server_properties_manager.cc', 120, 10)} 32 | 013| 33 | |{} 34 | 014| 35 | |{} 36 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-03.json: -------------------------------------------------------------------------------- 1 | { 2 | "xref_search_response": [ 3 | { 4 | "status": 0, 5 | "estimated_total_type_count": [ 6 | { 7 | "count": 1, 8 | "type": "DECLARATION", 9 | "type_id": "DECLARATION" 10 | }, 11 | { 12 | "count": 3, 13 | "type": "REFERENCE", 14 | "type_id": "REFERENCE" 15 | }, 16 | { 17 | "count": 10, 18 | "type": "OVERRIDDEN_BY", 19 | "type_id": "OVERRIDDEN_BY" 20 | } 21 | ], 22 | "search_result": [ 23 | { 24 | "file": { 25 | "name": "src/net/http/http_proxy_client_socket.cc", 26 | "package_name": "chromium" 27 | }, 28 | "match": [ 29 | { 30 | "line_text": "int HttpProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 31 | "line_number": 65, 32 | "type_id": "OVERRIDDEN_BY", 33 | "type": "OVERRIDDEN_BY", 34 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_proxy_client_socket.cc#%402239%3A2254%40%2BSbmFrEHBHp4C3fTSb3DNQhlc1BTzxqEYt6X%2FRZlbkc%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_proxy_client_socket.cc" 35 | }, 36 | { 37 | "line_text": "int HttpProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 38 | "line_number": 65, 39 | "type_id": "OVERRIDDEN_BY", 40 | "type": "OVERRIDDEN_BY", 41 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_proxy_client_socket.cc#%402239%3A2254%40%2BSbmFrEHBHp4C3fTSb3DNQhlc1BTzxqEYt6X%2FRZlbkc%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_proxy_client_socket.cc" 42 | } 43 | ] 44 | }, 45 | { 46 | "file": { 47 | "name": "src/net/http/http_proxy_client_socket_wrapper.cc", 48 | "package_name": "chromium" 49 | }, 50 | "match": [ 51 | { 52 | "line_text": "int HttpProxyClientSocketWrapper::RestartWithAuth(", 53 | "line_number": 153, 54 | "type_id": "OVERRIDDEN_BY", 55 | "type": "OVERRIDDEN_BY", 56 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_proxy_client_socket_wrapper.cc#%405724%3A5739%403kBzA5JTOOylSej10hdlbjTYp2QG1wp6R0ce5%2BqQqkE%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_proxy_client_socket_wrapper.cc" 57 | }, 58 | { 59 | "line_text": "int HttpProxyClientSocketWrapper::RestartWithAuth(", 60 | "line_number": 153, 61 | "type_id": "OVERRIDDEN_BY", 62 | "type": "OVERRIDDEN_BY", 63 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_proxy_client_socket_wrapper.cc#%405724%3A5739%403kBzA5JTOOylSej10hdlbjTYp2QG1wp6R0ce5%2BqQqkE%3D%23chromium%23src%2Fnet%2Fhttp%2Fhttp_proxy_client_socket_wrapper.cc" 64 | }, 65 | { 66 | "line_text": " return transport_socket_->RestartWithAuth(base::BindOnce(", 67 | "line_number": 678, 68 | "type_id": "REFERENCE", 69 | "type": "REFERENCE", 70 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_proxy_client_socket_wrapper.cc#%4023885%3A23900" 71 | } 72 | ] 73 | }, 74 | { 75 | "file": { 76 | "name": "src/net/http/http_stream_factory_job.cc", 77 | "package_name": "chromium" 78 | }, 79 | "match": [ 80 | { 81 | "line_text": " return proxy_socket->RestartWithAuth(io_callback_);", 82 | "line_number": 1307, 83 | "type_id": "REFERENCE", 84 | "type": "REFERENCE", 85 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/http_stream_factory_job.cc#%4048162%3A48177" 86 | } 87 | ] 88 | }, 89 | { 90 | "file": { 91 | "name": "src/net/http/proxy_client_socket.h", 92 | "package_name": "chromium" 93 | }, 94 | "match": [ 95 | { 96 | "line_text": " virtual int RestartWithAuth(CompletionOnceCallback callback) = 0;", 97 | "line_number": 53, 98 | "type_id": "DECLARATION", 99 | "type": "DECLARATION", 100 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/http/proxy_client_socket.h#%401951%3A1966%40ajLN70WMTqxWFu%2FTQjv3j5Gfz6FGVtjMiuOfPg9dlKQ%3D%23chromium%23src%2Fnet%2Fhttp%2Fproxy_client_socket.h" 101 | } 102 | ] 103 | }, 104 | { 105 | "file": { 106 | "name": "src/net/quic/chromium/quic_proxy_client_socket.cc", 107 | "package_name": "chromium" 108 | }, 109 | "match": [ 110 | { 111 | "line_text": "int QuicProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 112 | "line_number": 73, 113 | "type_id": "OVERRIDDEN_BY", 114 | "type": "OVERRIDDEN_BY", 115 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/quic/chromium/quic_proxy_client_socket.cc#%402395%3A2410%40bDQ4LIHX%2FU0ZeFa1dPOBVBsZlFeOSs1H0AdGzQ6CHhE%3D%23chromium%23src%2Fnet%2Fquic%2Fchromium%2Fquic_proxy_client_socket.cc" 116 | }, 117 | { 118 | "line_text": "int QuicProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 119 | "line_number": 73, 120 | "type_id": "OVERRIDDEN_BY", 121 | "type": "OVERRIDDEN_BY", 122 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/quic/chromium/quic_proxy_client_socket.cc#%402395%3A2410%40bDQ4LIHX%2FU0ZeFa1dPOBVBsZlFeOSs1H0AdGzQ6CHhE%3D%23chromium%23src%2Fnet%2Fquic%2Fchromium%2Fquic_proxy_client_socket.cc" 123 | } 124 | ] 125 | }, 126 | { 127 | "file": { 128 | "name": "src/net/socket/socket_test_util.cc", 129 | "package_name": "chromium" 130 | }, 131 | "match": [ 132 | { 133 | "line_text": "int MockProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 134 | "line_number": 1228, 135 | "type_id": "OVERRIDDEN_BY", 136 | "type": "OVERRIDDEN_BY", 137 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/socket/socket_test_util.cc#%4039565%3A39580%40f%2FHmJMZAKs%2F9im4WqDeZlm7Lwf1kjwMUyQ1nYPJihoU%3D%23chromium%23src%2Fnet%2Fsocket%2Fsocket_test_util.cc" 138 | }, 139 | { 140 | "line_text": "int MockProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 141 | "line_number": 1228, 142 | "type_id": "OVERRIDDEN_BY", 143 | "type": "OVERRIDDEN_BY", 144 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/socket/socket_test_util.cc#%4039565%3A39580%40f%2FHmJMZAKs%2F9im4WqDeZlm7Lwf1kjwMUyQ1nYPJihoU%3D%23chromium%23src%2Fnet%2Fsocket%2Fsocket_test_util.cc" 145 | } 146 | ] 147 | }, 148 | { 149 | "file": { 150 | "name": "src/net/spdy/spdy_proxy_client_socket.cc", 151 | "package_name": "chromium" 152 | }, 153 | "match": [ 154 | { 155 | "line_text": "int SpdyProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 156 | "line_number": 80, 157 | "type_id": "OVERRIDDEN_BY", 158 | "type": "OVERRIDDEN_BY", 159 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/spdy/spdy_proxy_client_socket.cc#%402729%3A2744%40UHnnu8oBVdZuns3x9WLAEL9Az4f5UNoU5lCxpIHlsdc%3D%23chromium%23src%2Fnet%2Fspdy%2Fspdy_proxy_client_socket.cc" 160 | }, 161 | { 162 | "line_text": "int SpdyProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {", 163 | "line_number": 80, 164 | "type_id": "OVERRIDDEN_BY", 165 | "type": "OVERRIDDEN_BY", 166 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/net/spdy/spdy_proxy_client_socket.cc#%402729%3A2744%40UHnnu8oBVdZuns3x9WLAEL9Az4f5UNoU5lCxpIHlsdc%3D%23chromium%23src%2Fnet%2Fspdy%2Fspdy_proxy_client_socket.cc" 167 | } 168 | ] 169 | }, 170 | { 171 | "file": { 172 | "name": "src/services/network/proxy_resolving_client_socket.cc", 173 | "package_name": "chromium" 174 | }, 175 | "match": [ 176 | { 177 | "line_text": " return proxy_socket->RestartWithAuth(base::BindRepeating(", 178 | "line_number": 353, 179 | "type_id": "REFERENCE", 180 | "type": "REFERENCE", 181 | "signature": "kythe://chromium?lang=c%2B%2B?path=src/services/network/proxy_resolving_client_socket.cc#%4012214%3A12229" 182 | } 183 | ] 184 | } 185 | ], 186 | "from_kythe": true, 187 | "grok_total_number_of_results": 0 188 | } 189 | ] 190 | } 191 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-03.json.actual: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^Cat{Declaration: 9 | |{} 10 | 002|}Cat_ ^F{src/net/http/proxy_client_socket.h}F_ 11 | |{'j': ('src/net/http/proxy_client_socket.h', 0, 7)} 12 | 003| 53: ^>{ virtual int RestartWithAuth(CompletionOnceCallback callback) = 0;}>_ 13 | |{'j': ('src/net/http/proxy_client_socket.h', 52, 9)} 14 | 004| 15 | |{} 16 | 005|^Cat{Overridden by: 17 | |{} 18 | 006|}Cat_ ^F{src/net/http/http_proxy_client_socket.cc}F_ 19 | |{'j': ('src/net/http/http_proxy_client_socket.cc', 0, 7)} 20 | 007| 65: ^>{int HttpProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 21 | |{'j': ('src/net/http/http_proxy_client_socket.cc', 64, 9)} 22 | 008| 65: ^>{int HttpProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 23 | |{'j': ('src/net/http/http_proxy_client_socket.cc', 64, 9)} 24 | 009| 25 | |{} 26 | 010| ^F{src/net/http/http_proxy_client_socket_wrapper.cc}F_ 27 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 0, 2)} 28 | 011| 153: ^>{int HttpProxyClientSocketWrapper::RestartWithAuth(}>_ 29 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 152, 10)} 30 | 012| 153: ^>{int HttpProxyClientSocketWrapper::RestartWithAuth(}>_ 31 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 152, 10)} 32 | 013| 33 | |{} 34 | 014| ^F{src/net/quic/chromium/quic_proxy_client_socket.cc}F_ 35 | |{'j': ('src/net/quic/chromium/quic_proxy_client_socket.cc', 0, 2)} 36 | 015| 73: ^>{int QuicProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 37 | |{'j': ('src/net/quic/chromium/quic_proxy_client_socket.cc', 72, 9)} 38 | 016| 73: ^>{int QuicProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 39 | |{'j': ('src/net/quic/chromium/quic_proxy_client_socket.cc', 72, 9)} 40 | 017| 41 | |{} 42 | 018| ^F{src/net/socket/socket_test_util.cc}F_ 43 | |{'j': ('src/net/socket/socket_test_util.cc', 0, 2)} 44 | 019| 1228: ^>{int MockProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 45 | |{'j': ('src/net/socket/socket_test_util.cc', 1227, 11)} 46 | 020| 1228: ^>{int MockProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 47 | |{'j': ('src/net/socket/socket_test_util.cc', 1227, 11)} 48 | 021| 49 | |{} 50 | 022| ^F{src/net/spdy/spdy_proxy_client_socket.cc}F_ 51 | |{'j': ('src/net/spdy/spdy_proxy_client_socket.cc', 0, 2)} 52 | 023| 80: ^>{int SpdyProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 53 | |{'j': ('src/net/spdy/spdy_proxy_client_socket.cc', 79, 9)} 54 | 024| 80: ^>{int SpdyProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 55 | |{'j': ('src/net/spdy/spdy_proxy_client_socket.cc', 79, 9)} 56 | 025| 57 | |{} 58 | 026|^Cat{References: 59 | |{} 60 | 027|}Cat_ ^F{src/net/http/http_proxy_client_socket_wrapper.cc}F_ 61 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 0, 7)} 62 | 028| 678: ^>{ return transport_socket_->RestartWithAuth(base::BindOnce(}>_ 63 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 677, 10)} 64 | 029| 65 | |{} 66 | 030| ^F{src/net/http/http_stream_factory_job.cc}F_ 67 | |{'j': ('src/net/http/http_stream_factory_job.cc', 0, 2)} 68 | 031| 1307: ^>{ return proxy_socket->RestartWithAuth(io_callback_);}>_ 69 | |{'j': ('src/net/http/http_stream_factory_job.cc', 1306, 11)} 70 | 032| 71 | |{} 72 | 033| ^F{src/services/network/proxy_resolving_client_socket.cc}F_ 73 | |{'j': ('src/services/network/proxy_resolving_client_socket.cc', 0, 2)} 74 | 034| 353: ^>{ return proxy_socket->RestartWithAuth(base::BindRepeating(}>_ 75 | |{'j': ('src/services/network/proxy_resolving_client_socket.cc', 352, 10)} 76 | 035| 77 | |{} 78 | 036| 79 | |{} 80 | -------------------------------------------------------------------------------- /render/testdata/xrefs-response-03.json.expected: -------------------------------------------------------------------------------- 1 | This file contains the rendered output per line and its associated metadata. 2 | 3 | Lines that begin with a line number contains (after the '|') the contents that 4 | will be inserted into the vim buffer at that line. The immediately following 5 | line contains an object representing associated metadata. 6 | ------------------------------------------------------------------------------- 7 | 8 | 001|^Cat{Declaration: 9 | |{} 10 | 002|}Cat_ ^F{src/net/http/proxy_client_socket.h}F_ 11 | |{'j': ('src/net/http/proxy_client_socket.h', 0, 7)} 12 | 003| 53: ^>{ virtual int RestartWithAuth(CompletionOnceCallback callback) = 0;}>_ 13 | |{'j': ('src/net/http/proxy_client_socket.h', 52, 9)} 14 | 004| 15 | |{} 16 | 005|^Cat{Overridden by: 17 | |{} 18 | 006|}Cat_ ^F{src/net/http/http_proxy_client_socket.cc}F_ 19 | |{'j': ('src/net/http/http_proxy_client_socket.cc', 0, 7)} 20 | 007| 65: ^>{int HttpProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 21 | |{'j': ('src/net/http/http_proxy_client_socket.cc', 64, 9)} 22 | 008| 65: ^>{int HttpProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 23 | |{'j': ('src/net/http/http_proxy_client_socket.cc', 64, 9)} 24 | 009| 25 | |{} 26 | 010| ^F{src/net/http/http_proxy_client_socket_wrapper.cc}F_ 27 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 0, 2)} 28 | 011| 153: ^>{int HttpProxyClientSocketWrapper::RestartWithAuth(}>_ 29 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 152, 10)} 30 | 012| 153: ^>{int HttpProxyClientSocketWrapper::RestartWithAuth(}>_ 31 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 152, 10)} 32 | 013| 33 | |{} 34 | 014| ^F{src/net/quic/chromium/quic_proxy_client_socket.cc}F_ 35 | |{'j': ('src/net/quic/chromium/quic_proxy_client_socket.cc', 0, 2)} 36 | 015| 73: ^>{int QuicProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 37 | |{'j': ('src/net/quic/chromium/quic_proxy_client_socket.cc', 72, 9)} 38 | 016| 73: ^>{int QuicProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 39 | |{'j': ('src/net/quic/chromium/quic_proxy_client_socket.cc', 72, 9)} 40 | 017| 41 | |{} 42 | 018| ^F{src/net/socket/socket_test_util.cc}F_ 43 | |{'j': ('src/net/socket/socket_test_util.cc', 0, 2)} 44 | 019| 1228: ^>{int MockProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 45 | |{'j': ('src/net/socket/socket_test_util.cc', 1227, 11)} 46 | 020| 1228: ^>{int MockProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 47 | |{'j': ('src/net/socket/socket_test_util.cc', 1227, 11)} 48 | 021| 49 | |{} 50 | 022| ^F{src/net/spdy/spdy_proxy_client_socket.cc}F_ 51 | |{'j': ('src/net/spdy/spdy_proxy_client_socket.cc', 0, 2)} 52 | 023| 80: ^>{int SpdyProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 53 | |{'j': ('src/net/spdy/spdy_proxy_client_socket.cc', 79, 9)} 54 | 024| 80: ^>{int SpdyProxyClientSocket::RestartWithAuth(CompletionOnceCallback callback) {}>_ 55 | |{'j': ('src/net/spdy/spdy_proxy_client_socket.cc', 79, 9)} 56 | 025| 57 | |{} 58 | 026|^Cat{References: 59 | |{} 60 | 027|}Cat_ ^F{src/net/http/http_proxy_client_socket_wrapper.cc}F_ 61 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 0, 7)} 62 | 028| 678: ^>{ return transport_socket_->RestartWithAuth(base::BindOnce(}>_ 63 | |{'j': ('src/net/http/http_proxy_client_socket_wrapper.cc', 677, 10)} 64 | 029| 65 | |{} 66 | 030| ^F{src/net/http/http_stream_factory_job.cc}F_ 67 | |{'j': ('src/net/http/http_stream_factory_job.cc', 0, 2)} 68 | 031| 1307: ^>{ return proxy_socket->RestartWithAuth(io_callback_);}>_ 69 | |{'j': ('src/net/http/http_stream_factory_job.cc', 1306, 11)} 70 | 032| 71 | |{} 72 | 033| ^F{src/services/network/proxy_resolving_client_socket.cc}F_ 73 | |{'j': ('src/services/network/proxy_resolving_client_socket.cc', 0, 2)} 74 | 034| 353: ^>{ return proxy_socket->RestartWithAuth(base::BindRepeating(}>_ 75 | |{'j': ('src/services/network/proxy_resolving_client_socket.cc', 352, 10)} 76 | 035| 77 | |{} 78 | 036| 79 | |{} 80 | -------------------------------------------------------------------------------- /resources/calls.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromium/vim-codesearch/d050ab07740f398e23bf74cdf86be674cf929006/resources/calls.gif -------------------------------------------------------------------------------- /resources/searching.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromium/vim-codesearch/d050ab07740f398e23bf74cdf86be674cf929006/resources/searching.gif -------------------------------------------------------------------------------- /resources/tour-targets.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromium/vim-codesearch/d050ab07740f398e23bf74cdf86be674cf929006/resources/tour-targets.gif -------------------------------------------------------------------------------- /resources/xrefs.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromium/vim-codesearch/d050ab07740f398e23bf74cdf86be674cf929006/resources/xrefs.gif -------------------------------------------------------------------------------- /run_tests.sh: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -e 4 | 5 | python -m unittest discover 6 | 7 | if [ ${VIM_FLAVOR:-neovim} == neovim ]; then 8 | flags=--neovim 9 | else 10 | flags= 11 | fi 12 | 13 | { 14 | cd vroom/ 15 | vroom $flags --vimrc default.init.vim . 16 | } 17 | 18 | -------------------------------------------------------------------------------- /vimsupport.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 The Chromium Authors. 2 | # 3 | # Use of this source code is governed by a BSD-style 4 | # license that can be found in the LICENSE file or at 5 | # https://developers.google.com/open-source/licenses/bsd. 6 | 7 | from __future__ import absolute_import 8 | 9 | import os 10 | import sys 11 | import vim 12 | from ssl import SSLError 13 | 14 | if sys.version_info.major == 3: 15 | from urllib.error import URLError, HTTPError 16 | else: 17 | from urllib2 import URLError, HTTPError 18 | 19 | sys.path.append(os.path.join(CR_CS_PYTHON_ROOT, 'third_party', 'codesearch-py')) 20 | sys.path.append(CR_CS_PYTHON_ROOT) 21 | 22 | 23 | def EscapeVimString(s): 24 | assert isinstance(s, str) 25 | return '"{}"'.format( 26 | s.replace('\\', '\\\\').replace("'", "\\'").replace('\n', r'\n')) 27 | 28 | 29 | def EchoVimError(s): 30 | vim.command('echohl WarningMsg | echo {} | echohl None'.format( 31 | EscapeVimString(s))) 32 | 33 | 34 | try: 35 | from codesearch import \ 36 | AnnotationType,\ 37 | AnnotationTypeValue,\ 38 | CallGraphRequest,\ 39 | CodeSearch, \ 40 | CompoundRequest,\ 41 | InstallTestRequestHandler,\ 42 | KytheXrefKind,\ 43 | NoFileSpecError, \ 44 | NoSourceRootError, \ 45 | NotFoundError, \ 46 | SearchRequest, \ 47 | ServerError,\ 48 | XrefNode,\ 49 | XrefSearchRequest,\ 50 | XrefSearchResponse 51 | from render.render import \ 52 | RenderCompoundResponse, \ 53 | RenderNode, \ 54 | LocationMapper, \ 55 | DisableConcealableMarkup 56 | 57 | except ImportError: 58 | EchoVimError("""\ 59 | Can't import 'codesearch' module. 60 | 61 | Looks like the 'codesearch-py' module can't be located. This is pulled into the 62 | vim-codesearch plugin via Git Submodules. In case your package manager didn't 63 | pull in the submodule, could you try the following? 64 | 65 | cd {:s} 66 | git submodule update --init --recursive 67 | """.format(CR_CS_PYTHON_ROOT)) 68 | quit() 69 | 70 | g_codesearch = None 71 | 72 | g_buffer_map_ = {} 73 | 74 | 75 | def CalledFromVim(default=None): 76 | 77 | def wrapper(func): 78 | 79 | def inner_call_wrapper(*args, **kwargs): 80 | global g_codesearch 81 | try: 82 | return func(*args, **kwargs) 83 | 84 | except (URLError, HTTPError, SSLError): 85 | EchoVimError('couldn\'t contact codesearch server.') 86 | return default 87 | 88 | except ServerError as e: 89 | EchoVimError('server error: {}'.format(e.message)) 90 | return default 91 | 92 | except NoFileSpecError as e: 93 | EchoVimError('internal error: {}'.format(e.message)) 94 | return default 95 | 96 | except NotFoundError as e: 97 | EchoVimError(e.message) 98 | return default 99 | 100 | except NoSourceRootError: 101 | EchoVimError("""\ 102 | Couldn't determine Chromium source location. 103 | 104 | In order to show search results and link to corresponding files in the working 105 | directory, this plugin needs to know the location of your Chromium checkout. 106 | This can be accomplished via two ways: 107 | 108 | 1) Invoke :CrSearch or a similar command while editing a file inside the 109 | Chromium source directory. 110 | 111 | 2) Set g:codesearch_source_root to the directory above your 'src' directory. 112 | I.e. this should point to the directory containing your .gclient file. 113 | This can be done by adding something like the following to your .vimrc: 114 | 115 | " Change this to point to the directory above your Chromium checkout. 116 | " E.g.: If you checked out Chromium to ~/sources/chrome/src 117 | let g:codesearch_source_root = '~/sources/chrome/' 118 | """) 119 | g_codesearch = None 120 | return default 121 | 122 | return inner_call_wrapper 123 | 124 | return wrapper 125 | 126 | 127 | def _GetCodeSearch(base_filename=None): 128 | global g_codesearch 129 | if g_codesearch: 130 | return g_codesearch 131 | 132 | arguments = { 133 | 'user_agent_string': 134 | 'Vim-CodeSearch-Client (https://github.com/chromium/vim-codesearch)' 135 | } 136 | 137 | if 'codesearch_source_root' in vim.vars: 138 | arguments['source_root'] = vim.vars['codesearch_source_root'] 139 | else: 140 | if not base_filename: 141 | base_filename = vim.eval("expand('%:p')") 142 | 143 | if not base_filename: 144 | base_filename = vim.eval('getcwd()') 145 | 146 | arguments['a_path_inside_source_dir'] = base_filename 147 | 148 | if 'codesearch_cache_dir' in vim.vars: 149 | arguments['cache_dir'] = vim.vars['codesearch_cache_dir'] 150 | arguments['should_cache'] = True 151 | 152 | if 'codesearch_cache_timeout_in_seconds' in vim.vars: 153 | arguments['cache_timeout_in_seconds'] = int( 154 | vim.vars['codesearch_cache_timeout_in_seconds']) 155 | 156 | if 'codesearch_timeout_in_seconds' in vim.vars: 157 | arguments['request_timeout_in_seconds'] = int( 158 | vim.vars['codesearch_timeout_in_seconds']) 159 | 160 | g_codesearch = CodeSearch(**arguments) 161 | 162 | if 'codesearch_source_root' not in vim.vars: 163 | vim.vars['codesearch_source_root'] = g_codesearch.GetSourceRoot() 164 | 165 | return g_codesearch 166 | 167 | 168 | def _SetupVimBuffer(t, name): 169 | assert g_codesearch 170 | 171 | buffer_num = vim.eval( 172 | "crcs#SetupCodesearchBuffer({name}, {source_root}, {type})".format( 173 | name=EscapeVimString(name), 174 | source_root=EscapeVimString(_GetCodeSearch().GetSourceRoot()), 175 | type=EscapeVimString(t))) 176 | buffer_num = int(buffer_num) 177 | g_buffer_map_[buffer_num] = None 178 | return buffer_num 179 | 180 | 181 | def _GetLocationMapForCurrentBuffer(): 182 | buffer_num = vim.current.buffer.number 183 | if buffer_num not in g_buffer_map_: 184 | vim.command('echo "Buffer #{} not in map"'.format(buffer_num)) 185 | return None 186 | return g_buffer_map_[buffer_num] 187 | 188 | 189 | @CalledFromVim() 190 | def CleanupBuffer(buffer_num): 191 | del g_buffer_map_[buffer_num] 192 | 193 | 194 | def _GetJumpTargetAtPos(): 195 | location_map = _GetLocationMapForCurrentBuffer() 196 | 197 | _, line, column, _ = vim.eval("getpos('.')") 198 | line = int(line) 199 | column = int(column) 200 | 201 | return location_map.JumpTargetAt(line, column) 202 | 203 | 204 | @CalledFromVim() 205 | def JumpToContext(): 206 | root_path = vim.current.buffer.vars.get('cs_root_path', None) 207 | if root_path is None or root_path == '': 208 | return 209 | 210 | target = _GetJumpTargetAtPos() 211 | if target is None: 212 | return 213 | 214 | filename, line, col = target 215 | cs = _GetCodeSearch(root_path) 216 | local_filename = cs.GetLocalPath(filename) 217 | vim.command('e {}'.format(local_filename)) 218 | vim.eval("setpos('.', [%d, %d, %d, %d])" % (0, line, col, 0)) 219 | 220 | 221 | @CalledFromVim() 222 | def JumpToNextFile(): 223 | location_map = _GetLocationMapForCurrentBuffer() 224 | _, line, col, _ = vim.eval("getpos('.')") 225 | line = int(line) 226 | col = int(col) 227 | line = location_map.NextFileLocation(line) 228 | vim.eval("setpos('.', [%d, %d, %d, %d])" % (0, line, col, 0)) 229 | vim.command('norm zz') 230 | 231 | 232 | @CalledFromVim() 233 | def JumpToPrevFile(): 234 | location_map = _GetLocationMapForCurrentBuffer() 235 | _, line, col, _ = vim.eval("getpos('.')") 236 | line = int(line) 237 | col = int(col) 238 | line = location_map.PreviousFileLocation(line) 239 | vim.eval("setpos('.', [%d, %d, %d, %d])" % (0, line, col, 0)) 240 | vim.command('norm zz') 241 | 242 | 243 | def _GetSignatureAtSource(): 244 | buffer_num = vim.current.buffer.number 245 | if buffer_num in g_buffer_map_: 246 | location_map = g_buffer_map_[buffer_num] 247 | return location_map.SignatureAt(int(vim.eval("line('.')"))) 248 | 249 | _, line, column, _ = vim.eval("getpos('.')") 250 | line = int(line) 251 | column = int(column) 252 | 253 | filename = vim.eval("expand('%:p')") 254 | cs = _GetCodeSearch(filename) 255 | 256 | if cs.IsContentStale(filename, vim.current.buffer[:line], check_prefix=True): 257 | return cs.GetSignatureForSymbol(filename, vim.eval("expand('')")) 258 | 259 | return cs.GetSignatureForLocation(filename, line, column) 260 | 261 | 262 | @CalledFromVim() 263 | def RunCodeSearch(q): 264 | cs = _GetCodeSearch() 265 | buffer_num = _SetupVimBuffer('search', 'Codesearch: %s' % (q)) 266 | response = cs.SendRequestToServer( 267 | CompoundRequest(search_request=[ 268 | SearchRequest( 269 | query=q, 270 | return_all_snippets=False, 271 | return_snippets=True, 272 | max_num_results=100, 273 | lines_context=3, 274 | return_decorated_snippets=True) 275 | ])) 276 | 277 | location_map = RenderCompoundResponse(response, q) 278 | g_buffer_map_[buffer_num] = location_map 279 | vim.command('setlocal modifiable') 280 | vim.current.buffer[:] = location_map.Lines() 281 | vim.command('setlocal nomodifiable') 282 | 283 | 284 | @CalledFromVim() 285 | def RunXrefSearch(): 286 | signature = _GetSignatureAtSource() 287 | if not signature: 288 | return 289 | 290 | buffer_num = _SetupVimBuffer('xref', 'Crossreferences') 291 | cs = _GetCodeSearch() 292 | response = cs.SendRequestToServer( 293 | CompoundRequest(xref_search_request=[ 294 | XrefSearchRequest( 295 | query=signature, file_spec=cs.GetFileSpec(), max_num_results=100) 296 | ])) 297 | 298 | location_map = RenderCompoundResponse(response, signature) 299 | g_buffer_map_[buffer_num] = location_map 300 | vim.command('setlocal modifiable') 301 | vim.current.buffer[:] = location_map.Lines() 302 | vim.command('setlocal nomodifiable') 303 | 304 | 305 | def _FindNodeForSignature(node, signature): 306 | if node.signature == signature: 307 | return node 308 | for child in node.children: 309 | n = _FindNodeForSignature(child, signature) 310 | if n is not None: 311 | return n 312 | return None 313 | 314 | 315 | @CalledFromVim() 316 | def RunCallgraphSearch(): 317 | is_nested_query = (vim.current.buffer.vars.get('cs_buftype', '') == 'call') 318 | signature = None 319 | parent_node = None 320 | root_node = None 321 | if is_nested_query: 322 | if vim.current.buffer.number not in g_buffer_map_: 323 | return 324 | 325 | location_map = g_buffer_map_[vim.current.buffer.number] 326 | signature = location_map.SignatureAt(int(vim.eval("line('.')"))) 327 | root_node = location_map.root_node 328 | parent_node = _FindNodeForSignature(root_node, signature) 329 | assert parent_node is not None 330 | else: 331 | signature = _GetSignatureAtSource() 332 | 333 | if not signature: 334 | return 335 | 336 | # Children of parent node have already been resolved. 337 | if parent_node is not None and parent_node.children: 338 | return 339 | 340 | cs = _GetCodeSearch() 341 | response = cs.SendRequestToServer( 342 | CompoundRequest(call_graph_request=[ 343 | CallGraphRequest( 344 | signature=signature, 345 | file_spec=cs.GetFileSpec(), 346 | max_num_results=100) 347 | ])) 348 | 349 | if response is None: 350 | return 351 | 352 | if parent_node is not None: 353 | assert root_node is not None 354 | 355 | if not response.call_graph_response: 356 | # |parent_node| has no children known to the server. 357 | setattr(parent_node, 'children', []) 358 | else: 359 | # |new_node.children| are the new children that we are going to 360 | # attach to the parent node. 361 | new_node = response.call_graph_response[0].node 362 | 363 | assert parent_node.signature == new_node.signature 364 | if new_node.children: 365 | setattr(parent_node, 'children', new_node.children) 366 | else: 367 | setattr(parent_node, 'children', []) 368 | buffer_num = vim.current.buffer.number 369 | 370 | else: 371 | root_node = response.call_graph_response[0].node 372 | buffer_num = _SetupVimBuffer('call', 'Callgraph') 373 | 374 | RenderCallGraphInBuffer(root_node, buffer_num) 375 | 376 | 377 | def RenderCallGraphInBuffer(root_node, buffer_num): 378 | location_map = LocationMapper() 379 | RenderNode(location_map, root_node, 0) 380 | setattr(location_map, 'root_node', root_node) 381 | g_buffer_map_[buffer_num] = location_map 382 | 383 | vim.command('setlocal modifiable') 384 | vim.current.buffer[:] = location_map.Lines() 385 | vim.command('setlocal nomodifiable') 386 | 387 | 388 | @CalledFromVim() 389 | def CloseCallgraphFold(): 390 | if vim.current.buffer.number not in g_buffer_map_: 391 | return 392 | 393 | location_map = g_buffer_map_[vim.current.buffer.number] 394 | signature = location_map.SignatureAt(int(vim.eval("line('.')"))) 395 | if not signature: 396 | return 397 | root_node = location_map.root_node 398 | parent_node = _FindNodeForSignature(root_node, signature) 399 | assert parent_node is not None 400 | 401 | if not parent_node.children: 402 | # Nothing to do. 403 | return 404 | 405 | parent_node.children = [] 406 | 407 | RenderCallGraphInBuffer(root_node, vim.current.buffer.number) 408 | 409 | 410 | @CalledFromVim(default='') 411 | def GetCallers(): 412 | signature = _GetSignatureAtSource() 413 | if not signature: 414 | return '' 415 | 416 | cs = _GetCodeSearch() 417 | response = cs.GetCallGraph(signature) 418 | if response is None or not response.call_graph_response: 419 | return '' 420 | 421 | node = response.call_graph_response[0].node 422 | if not node.children: 423 | return '' 424 | 425 | lines = [] 426 | for c in node.children: 427 | if not c.file_path or c.call_site_range.Empty() or c.snippet.Empty(): 428 | continue 429 | lines.append('{}:{}:{}: {}'.format( 430 | os.path.join(cs.GetSourceRoot(), 431 | c.file_path), c.call_site_range.start_line, 432 | c.call_site_range.start_column, c.identifier)) 433 | return '\n'.join(lines) 434 | 435 | 436 | def _XrefSearchResultsToQuickFixList(cs, results): 437 | lines = [] 438 | assert isinstance(results, list) 439 | for r in results: 440 | assert isinstance(r, XrefNode) 441 | if not r.single_match.line_number or not r.single_match.line_text: 442 | continue 443 | filepath = os.path.join(cs.GetSourceRoot(), r.filespec.name) 444 | lines.append('{}:{}:1: {}'.format(filepath, r.single_match.line_number, 445 | r.single_match.line_text)) 446 | return lines 447 | 448 | 449 | def _GetLocationsForXrefType(t): 450 | signature = _GetSignatureAtSource() 451 | if not signature: 452 | return [] 453 | 454 | cs = _GetCodeSearch() 455 | node = XrefNode.FromSignature(cs, signature) 456 | results = node.Traverse(t) 457 | return _XrefSearchResultsToQuickFixList(cs, results) 458 | 459 | 460 | def _GetCallTargets(): 461 | signature = _GetSignatureAtSource() 462 | if not signature: 463 | return [] 464 | cs = _GetCodeSearch() 465 | node = XrefNode.FromSignature(cs, signature) 466 | dcl_list = node.Traverse( 467 | [KytheXrefKind.DECLARATION, KytheXrefKind.DEFINITION]) 468 | if len(dcl_list) == 0: 469 | return [] 470 | 471 | overrides = [] 472 | for dcl in dcl_list: 473 | overrides.extend(dcl.Traverse(KytheXrefKind.OVERRIDDEN_BY)) 474 | 475 | results = dcl_list + overrides 476 | return _XrefSearchResultsToQuickFixList(cs, results) 477 | 478 | 479 | REFERENCE_TYPES = { 480 | 'called at': KytheXrefKind.CALLED_BY, 481 | 'caller': KytheXrefKind.CALLED_BY, 482 | 'declaration': KytheXrefKind.DECLARATION, 483 | 'definition': KytheXrefKind.DEFINITION, 484 | 'extended by': KytheXrefKind.EXTENDED_BY, 485 | 'extends': KytheXrefKind.EXTENDS, 486 | 'instantiations': KytheXrefKind.INSTANTIATION, 487 | 'overridden by': KytheXrefKind.OVERRIDDEN_BY, 488 | 'overrides': KytheXrefKind.OVERRIDES, 489 | 'references': KytheXrefKind.REFERENCE, 490 | 'subclasses': KytheXrefKind.EXTENDED_BY, 491 | 'superclasses': KytheXrefKind.EXTENDS, 492 | 'call targets': _GetCallTargets, 493 | } 494 | 495 | 496 | @CalledFromVim(default=[]) 497 | def ReferenceTypeCompleter(arglead, cmdline, cursorpos): 498 | if arglead == '': 499 | return REFERENCE_TYPES.keys() 500 | 501 | candidates = [] 502 | arglead = arglead.lower() 503 | for k in REFERENCE_TYPES.iterkeys(): 504 | if k.startswith(arglead): 505 | candidates.append(k) 506 | return candidates 507 | 508 | 509 | @CalledFromVim(default=[]) 510 | def GetReferences(type_string): 511 | type_string = type_string.lower() 512 | if type_string not in REFERENCE_TYPES: 513 | for s in REFERENCE_TYPES.keys(): 514 | if s.startswith(type_string): 515 | type_string = s 516 | break 517 | 518 | if type_string not in REFERENCE_TYPES: 519 | return [] 520 | 521 | resolved_type = REFERENCE_TYPES[type_string] 522 | if callable(resolved_type): 523 | return resolved_type() 524 | 525 | return _GetLocationsForXrefType(resolved_type) 526 | 527 | 528 | @CalledFromVim() 529 | def ShowAnnotationsHere(): 530 | filename = vim.eval("expand('%:p')") 531 | cs = _GetCodeSearch(filename) 532 | result = cs.GetAnnotationsForFile( 533 | filename, [AnnotationType(id=AnnotationTypeValue.XREF_SIGNATURE)]) 534 | result = result.annotation_response[0] 535 | _, line, column, _ = vim.eval("getpos('.')") 536 | line = int(line) 537 | column = int(column) 538 | for annotation in result.annotation: 539 | if annotation.range.Contains(line, column): 540 | vim.command('echo \'{}\''.format('&'.join( 541 | '{}={}'.format(k, v) for k, v in annotation.AsQueryString()))) 542 | 543 | 544 | @CalledFromVim() 545 | def ShowSignature(): 546 | signature = _GetSignatureAtSource() 547 | if signature is None: 548 | return 549 | 550 | vim.command('echo {}'.format( 551 | EscapeVimString('Signature: {}'.format(signature)))) 552 | 553 | 554 | @CalledFromVim() 555 | def PrepareForTesting(): 556 | InstallTestRequestHandler( 557 | test_data_dir=vim.eval('g:codesearch_test_data_dir')) 558 | -------------------------------------------------------------------------------- /vroom/basic.vroom: -------------------------------------------------------------------------------- 1 | First lets open up a file that's inside a fake directory that looks like a 2 | Chromium checkout. 3 | 4 | :e testdata/src/base/base64.cc 5 | 6 | In the beginning, we search for 'hello world'. Fortunately there are lots of 7 | instances of this in the Chromium tree. 8 | 9 | :CrSearch hello world 10 | CodeSearch results for ^q{hello world}q_ 11 | & 12 | *hello-world.cc* (glob) 13 | 14 | That should be it for a basic test case. 15 | 16 | -------------------------------------------------------------------------------- /vroom/default.init.vim: -------------------------------------------------------------------------------- 1 | " Copyright 2017 The Chromium Authors. 2 | " 3 | " Use of this source code is governed by a BSD-style 4 | " license that can be found in the LICENSE file or at 5 | " https://developers.google.com/open-source/licenses/bsd. 6 | 7 | exec 'set rtp+=' . fnameescape(fnamemodify(getcwd(), ':p:h:h')) 8 | set hidden 9 | 10 | let g:codesearch_test_data_dir = fnamemodify(getcwd(), ':p') 11 | 12 | call crcs#PrepareForTesting() 13 | 14 | -------------------------------------------------------------------------------- /vroom/responses/37874fbcd5b2b3e0b7528a20d4fc273d8ee135b7.json: -------------------------------------------------------------------------------- 1 | { 2 | "elapsed_ms": 133, 3 | "file_info_response": [ 4 | { 5 | "file_info": { 6 | "gob_info": { 7 | "repo": "chromium/chromium/src", 8 | "commit": "72f6a9c759b4a4063c228ba10b615fb4379aa772", 9 | "path": "base/base64.cc" 10 | }, 11 | "name": "src/base/base64.cc", 12 | "language": "c++", 13 | "changelist_num": "72f6a9c759b4a4063c228ba10b615fb4379aa772", 14 | "package_name": "chromium", 15 | "lines": "39", 16 | "content": { 17 | "text": "// Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#include \"base/base64.h\"\n\n#include \n\n#include \"third_party/modp_b64/modp_b64.h\"\n\nnamespace base {\n\nvoid Base64Encode(const StringPiece& input, std::string* output) {\n std::string temp;\n temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte\n\n // modp_b64_encode_len() returns at least 1, so temp[0] is safe to use.\n size_t output_size = modp_b64_encode(&(temp[0]), input.data(), input.size());\n\n temp.resize(output_size); // strips off null byte\n output->swap(temp);\n}\n\nbool Base64Decode(const StringPiece& input, std::string* output) {\n std::string temp;\n temp.resize(modp_b64_decode_len(input.size()));\n\n // does not null terminate result since result is binary data!\n size_t input_size = input.size();\n size_t output_size = modp_b64_decode(&(temp[0]), input.data(), input_size);\n if (output_size == MODP_B64_ERROR)\n return false;\n\n temp.resize(output_size);\n output->swap(temp);\n return true;\n}\n\n} // namespace base\n" 18 | }, 19 | "generated": false, 20 | "mime_type": "text/plain", 21 | "size": "1141", 22 | "type": 1, 23 | "md5": "68109517d58d4617a193d705643f7ec9", 24 | "codeblock": [ 25 | { 26 | "child": [ 27 | { 28 | "name_prefix": "", 29 | "type": 8, 30 | "name": "Base64Encode", 31 | "text_range": { 32 | "start_line": 13, 33 | "end_line": 22, 34 | "start_column": 1, 35 | "end_column": 2 36 | }, 37 | "signature": "(const StringPiece& input, std::string* output)" 38 | }, 39 | { 40 | "name_prefix": "", 41 | "type": 8, 42 | "name": "Base64Decode", 43 | "text_range": { 44 | "start_line": 24, 45 | "end_line": 37, 46 | "start_column": 1, 47 | "end_column": 2 48 | }, 49 | "signature": "(const StringPiece& input, std::string* output)" 50 | } 51 | ], 52 | "type": 11, 53 | "name": "base", 54 | "text_range": { 55 | "start_line": 11, 56 | "end_line": 39, 57 | "start_column": 1, 58 | "end_column": 2 59 | }, 60 | "signature": "" 61 | } 62 | ] 63 | }, 64 | "return_code": 1 65 | } 66 | ] 67 | } -------------------------------------------------------------------------------- /vroom/search.vroom: -------------------------------------------------------------------------------- 1 | Test basic CodeSearch searches via :CrSearch 2 | -------------------------------------------- 3 | 4 | Run this via ./run_tests.sh in the root of the source tree. Requires Vroom and 5 | Python3. See https://github.com/google/vroom. 6 | 7 | First lets open up a file that's inside a fake directory that looks like a 8 | Chromium checkout. 9 | 10 | :e testdata/src/base/path_service.cc 11 | 12 | Try a simple search. This should result in a search results page: 13 | 14 | :CrSearch hello world 15 | CodeSearch results for ^q{hello world}q_ 16 | & 17 | 1. src/v8/samples/hello-world.cc^>{ 18 | 31 ^c{// Create a new context.}c_ 19 | 32 v8::Local context = v8::Context::New(isolate); 20 | 33 21 | 34 ^c{// Enter the context for compiling and running the ^${hello}$_ ^${world}$_ script.}c_ 22 | 35 v8::Context::Scope context_scope(context); 23 | 36 24 | 37 { 25 | 38 ^c{// Create a string containing the JavaScript source code.}c_ 26 | 39 v8::Local source = 27 | 40 v8::String::NewFromUtf8(isolate, ^s{"'^${Hello}$_' + ', ^${World}$_!'"}s_, 28 | 41 }>_ 29 | & 30 | 2. src/gin/shell/hello_world.js^>{ 31 | 2 ^c{//^c{}c_ Use of this source code is governed by a BSD-style license that can be}c_ 32 | 3 ^c{//^c{}c_ found in the LICENSE file.}c_ 33 | 4 34 | 5 log(^s{"^${Hello}$_ ^${World}$_"}s_); 35 | 6 }>_ 36 | 37 | Now let's try moving to a line containing code and then hitting .: 38 | 39 | > 5Gw 40 | :echomsg expand('%:t') 41 | ~ hello-world.cc 42 | 43 | And try to go back: 44 | 45 | > 46 | :echomsg bufname("%") 47 | ~ Codesearch: hello world (verbatim) 48 | 49 | Jump to the top of the page: 50 | 51 | > gg 52 | 53 | And try to navigate to the results from the second file: 54 | 55 | > [[ 56 | :echomsg line(".") 57 | ~ 3 58 | 59 | And the next file: 60 | 61 | > [[ 62 | :echomsg line(".") 63 | ~ 16 64 | 65 | Try to navigate back: 66 | 67 | > 58G 68 | :echomsg line(".") 69 | ~ 58 70 | > ]] 71 | :echomsg line(".") 72 | ~ 40 73 | 74 | Navigation should work at the top and the bottom of the buffer. 75 | 76 | > gg]] 77 | :echomsg line(".") 78 | ~ 1 79 | > G[[ 80 | :echomsg line(".") 81 | ~ 1025 82 | 83 | -------------------------------------------------------------------------------- /vroom/testdata/src/.gn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chromium/vim-codesearch/d050ab07740f398e23bf74cdf86be674cf929006/vroom/testdata/src/.gn -------------------------------------------------------------------------------- /vroom/testdata/src/base/base64.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "base/base64.h" 6 | 7 | #include 8 | 9 | #include "third_party/modp_b64/modp_b64.h" 10 | 11 | namespace base { 12 | 13 | void Base64Encode(const StringPiece& input, std::string* output) { 14 | std::string temp; 15 | temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte 16 | 17 | // modp_b64_encode_len() returns at least 1, so temp[0] is safe to use. 18 | size_t output_size = modp_b64_encode(&(temp[0]), input.data(), input.size()); 19 | 20 | temp.resize(output_size); // strips off null byte 21 | output->swap(temp); 22 | } 23 | 24 | bool Base64Decode(const StringPiece& input, std::string* output) { 25 | std::string temp; 26 | temp.resize(modp_b64_decode_len(input.size())); 27 | 28 | // does not null terminate result since result is binary data! 29 | size_t input_size = input.size(); 30 | size_t output_size = modp_b64_decode(&(temp[0]), input.data(), input_size); 31 | if (output_size == MODP_B64_ERROR) 32 | return false; 33 | 34 | temp.resize(output_size); 35 | output->swap(temp); 36 | return true; 37 | } 38 | 39 | } // namespace base 40 | -------------------------------------------------------------------------------- /vroom/testdata/src/base/base64.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef BASE_BASE64_H_ 6 | #define BASE_BASE64_H_ 7 | 8 | #include 9 | 10 | #include "base/base_export.h" 11 | #include "base/strings/string_piece.h" 12 | 13 | namespace base { 14 | 15 | // Encodes the input string in base64. The encoding can be done in-place. 16 | BASE_EXPORT void Base64Encode(const StringPiece& input, std::string* output); 17 | 18 | // Decodes the base64 input string. Returns true if successful and false 19 | // otherwise. The output string is only modified if successful. The decoding can 20 | // be done in-place. 21 | BASE_EXPORT bool Base64Decode(const StringPiece& input, std::string* output); 22 | 23 | } // namespace base 24 | 25 | #endif // BASE_BASE64_H_ 26 | -------------------------------------------------------------------------------- /vroom/testdata/src/base/path_service.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "base/path_service.h" 6 | 7 | #include 8 | 9 | #if defined(OS_WIN) 10 | #include 11 | #include 12 | #include 13 | #endif 14 | 15 | #include "base/files/file_path.h" 16 | #include "base/files/file_util.h" 17 | #include "base/logging.h" 18 | #include "base/synchronization/lock.h" 19 | #include "build/build_config.h" 20 | 21 | namespace base { 22 | 23 | bool PathProvider(int key, FilePath* result); 24 | 25 | #if defined(OS_WIN) 26 | bool PathProviderWin(int key, FilePath* result); 27 | #elif defined(OS_MACOSX) 28 | bool PathProviderMac(int key, FilePath* result); 29 | #elif defined(OS_ANDROID) 30 | bool PathProviderAndroid(int key, FilePath* result); 31 | #elif defined(OS_FUCHSIA) 32 | bool PathProviderFuchsia(int key, FilePath* result); 33 | #elif defined(OS_POSIX) 34 | // PathProviderPosix is the default path provider on POSIX OSes other than 35 | // Mac and Android. 36 | bool PathProviderPosix(int key, FilePath* result); 37 | #endif 38 | 39 | namespace { 40 | 41 | typedef std::unordered_map PathMap; 42 | 43 | // We keep a linked list of providers. In a debug build we ensure that no two 44 | // providers claim overlapping keys. 45 | struct Provider { 46 | PathService::ProviderFunc func; 47 | struct Provider* next; 48 | #ifndef NDEBUG 49 | int key_start; 50 | int key_end; 51 | #endif 52 | bool is_static; 53 | }; 54 | 55 | Provider base_provider = {PathProvider, nullptr, 56 | #ifndef NDEBUG 57 | PATH_START, PATH_END, 58 | #endif 59 | true}; 60 | 61 | #if defined(OS_WIN) 62 | Provider base_provider_win = { 63 | PathProviderWin, 64 | &base_provider, 65 | #ifndef NDEBUG 66 | PATH_WIN_START, 67 | PATH_WIN_END, 68 | #endif 69 | true 70 | }; 71 | #endif 72 | 73 | #if defined(OS_MACOSX) 74 | Provider base_provider_mac = { 75 | PathProviderMac, 76 | &base_provider, 77 | #ifndef NDEBUG 78 | PATH_MAC_START, 79 | PATH_MAC_END, 80 | #endif 81 | true 82 | }; 83 | #endif 84 | 85 | #if defined(OS_ANDROID) 86 | Provider base_provider_android = { 87 | PathProviderAndroid, 88 | &base_provider, 89 | #ifndef NDEBUG 90 | PATH_ANDROID_START, 91 | PATH_ANDROID_END, 92 | #endif 93 | true 94 | }; 95 | #endif 96 | 97 | #if defined(OS_FUCHSIA) 98 | Provider base_provider_fuchsia = {PathProviderFuchsia, &base_provider, 99 | #ifndef NDEBUG 100 | 0, 0, 101 | #endif 102 | true}; 103 | #endif 104 | 105 | #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) && \ 106 | !defined(OS_FUCHSIA) 107 | Provider base_provider_posix = { 108 | PathProviderPosix, 109 | &base_provider, 110 | #ifndef NDEBUG 111 | PATH_POSIX_START, 112 | PATH_POSIX_END, 113 | #endif 114 | true 115 | }; 116 | #endif 117 | 118 | 119 | struct PathData { 120 | Lock lock; 121 | PathMap cache; // Cache mappings from path key to path value. 122 | PathMap overrides; // Track path overrides. 123 | Provider* providers; // Linked list of path service providers. 124 | bool cache_disabled; // Don't use cache if true; 125 | 126 | PathData() : cache_disabled(false) { 127 | #if defined(OS_WIN) 128 | providers = &base_provider_win; 129 | #elif defined(OS_MACOSX) 130 | providers = &base_provider_mac; 131 | #elif defined(OS_ANDROID) 132 | providers = &base_provider_android; 133 | #elif defined(OS_FUCHSIA) 134 | providers = &base_provider_fuchsia; 135 | #elif defined(OS_POSIX) 136 | providers = &base_provider_posix; 137 | #endif 138 | } 139 | }; 140 | 141 | static PathData* GetPathData() { 142 | static auto* path_data = new PathData(); 143 | return path_data; 144 | } 145 | 146 | // Tries to find |key| in the cache. |path_data| should be locked by the caller! 147 | bool LockedGetFromCache(int key, const PathData* path_data, FilePath* result) { 148 | if (path_data->cache_disabled) 149 | return false; 150 | // check for a cached version 151 | PathMap::const_iterator it = path_data->cache.find(key); 152 | if (it != path_data->cache.end()) { 153 | *result = it->second; 154 | return true; 155 | } 156 | return false; 157 | } 158 | 159 | // Tries to find |key| in the overrides map. |path_data| should be locked by the 160 | // caller! 161 | bool LockedGetFromOverrides(int key, PathData* path_data, FilePath* result) { 162 | // check for an overridden version. 163 | PathMap::const_iterator it = path_data->overrides.find(key); 164 | if (it != path_data->overrides.end()) { 165 | if (!path_data->cache_disabled) 166 | path_data->cache[key] = it->second; 167 | *result = it->second; 168 | return true; 169 | } 170 | return false; 171 | } 172 | 173 | } // namespace 174 | 175 | // TODO(brettw): this function does not handle long paths (filename > MAX_PATH) 176 | // characters). This isn't supported very well by Windows right now, so it is 177 | // moot, but we should keep this in mind for the future. 178 | // static 179 | bool PathService::Get(int key, FilePath* result) { 180 | PathData* path_data = GetPathData(); 181 | DCHECK(path_data); 182 | DCHECK(result); 183 | DCHECK_GE(key, DIR_CURRENT); 184 | 185 | // special case the current directory because it can never be cached 186 | if (key == DIR_CURRENT) 187 | return GetCurrentDirectory(result); 188 | 189 | Provider* provider = nullptr; 190 | { 191 | AutoLock scoped_lock(path_data->lock); 192 | if (LockedGetFromCache(key, path_data, result)) 193 | return true; 194 | 195 | if (LockedGetFromOverrides(key, path_data, result)) 196 | return true; 197 | 198 | // Get the beginning of the list while it is still locked. 199 | provider = path_data->providers; 200 | } 201 | 202 | FilePath path; 203 | 204 | // Iterating does not need the lock because only the list head might be 205 | // modified on another thread. 206 | while (provider) { 207 | if (provider->func(key, &path)) 208 | break; 209 | DCHECK(path.empty()) << "provider should not have modified path"; 210 | provider = provider->next; 211 | } 212 | 213 | if (path.empty()) 214 | return false; 215 | 216 | if (path.ReferencesParent()) { 217 | // Make sure path service never returns a path with ".." in it. 218 | path = MakeAbsoluteFilePath(path); 219 | if (path.empty()) 220 | return false; 221 | } 222 | *result = path; 223 | 224 | AutoLock scoped_lock(path_data->lock); 225 | if (!path_data->cache_disabled) 226 | path_data->cache[key] = path; 227 | 228 | return true; 229 | } 230 | 231 | // static 232 | bool PathService::Override(int key, const FilePath& path) { 233 | // Just call the full function with true for the value of |create|, and 234 | // assume that |path| may not be absolute yet. 235 | return OverrideAndCreateIfNeeded(key, path, false, true); 236 | } 237 | 238 | // static 239 | bool PathService::OverrideAndCreateIfNeeded(int key, 240 | const FilePath& path, 241 | bool is_absolute, 242 | bool create) { 243 | PathData* path_data = GetPathData(); 244 | DCHECK(path_data); 245 | DCHECK_GT(key, DIR_CURRENT) << "invalid path key"; 246 | 247 | FilePath file_path = path; 248 | 249 | // For some locations this will fail if called from inside the sandbox there- 250 | // fore we protect this call with a flag. 251 | if (create) { 252 | // Make sure the directory exists. We need to do this before we translate 253 | // this to the absolute path because on POSIX, MakeAbsoluteFilePath fails 254 | // if called on a non-existent path. 255 | if (!PathExists(file_path) && !CreateDirectory(file_path)) 256 | return false; 257 | } 258 | 259 | // We need to have an absolute path. 260 | if (!is_absolute) { 261 | file_path = MakeAbsoluteFilePath(file_path); 262 | if (file_path.empty()) 263 | return false; 264 | } 265 | DCHECK(file_path.IsAbsolute()); 266 | 267 | AutoLock scoped_lock(path_data->lock); 268 | 269 | // Clear the cache now. Some of its entries could have depended 270 | // on the value we are overriding, and are now out of sync with reality. 271 | path_data->cache.clear(); 272 | 273 | path_data->overrides[key] = file_path; 274 | 275 | return true; 276 | } 277 | 278 | // static 279 | bool PathService::RemoveOverride(int key) { 280 | PathData* path_data = GetPathData(); 281 | DCHECK(path_data); 282 | 283 | AutoLock scoped_lock(path_data->lock); 284 | 285 | if (path_data->overrides.find(key) == path_data->overrides.end()) 286 | return false; 287 | 288 | // Clear the cache now. Some of its entries could have depended on the value 289 | // we are going to remove, and are now out of sync. 290 | path_data->cache.clear(); 291 | 292 | path_data->overrides.erase(key); 293 | 294 | return true; 295 | } 296 | 297 | // static 298 | void PathService::RegisterProvider(ProviderFunc func, int key_start, 299 | int key_end) { 300 | PathData* path_data = GetPathData(); 301 | DCHECK(path_data); 302 | DCHECK_GT(key_end, key_start); 303 | 304 | Provider* p; 305 | 306 | p = new Provider; 307 | p->is_static = false; 308 | p->func = func; 309 | #ifndef NDEBUG 310 | p->key_start = key_start; 311 | p->key_end = key_end; 312 | #endif 313 | 314 | AutoLock scoped_lock(path_data->lock); 315 | 316 | #ifndef NDEBUG 317 | Provider *iter = path_data->providers; 318 | while (iter) { 319 | DCHECK(key_start >= iter->key_end || key_end <= iter->key_start) << 320 | "path provider collision"; 321 | iter = iter->next; 322 | } 323 | #endif 324 | 325 | p->next = path_data->providers; 326 | path_data->providers = p; 327 | } 328 | 329 | // static 330 | void PathService::DisableCache() { 331 | PathData* path_data = GetPathData(); 332 | DCHECK(path_data); 333 | 334 | AutoLock scoped_lock(path_data->lock); 335 | path_data->cache.clear(); 336 | path_data->cache_disabled = true; 337 | } 338 | 339 | } // namespace base 340 | -------------------------------------------------------------------------------- /vroom/xrefs.vroom: -------------------------------------------------------------------------------- 1 | Cross References 2 | ---------------- 3 | 4 | Cross references are what people see when they hit :CrXrefSearch. Let's see how 5 | that works. 6 | 7 | First lets open up a file that's inside a fake directory that looks like a 8 | Chromium checkout. 9 | 10 | :e testdata/src/base/base64.cc 11 | 12 | The file above is supposed to convince the CodeSearch plugin that it is inside a 13 | Chromium checkout. Let's see if the file got loaded correctly. 14 | 15 | & // Copyright (c) 2012 The Chromium Authors. All rights reserved. 16 | & // Use of this source code is governed by a BSD-style license that can be 17 | & // found in the LICENSE file. 18 | & 19 | & #include "base/base64.h" 20 | & 21 | & #include 22 | 23 | Good. Now let's navigate down to the Base64Encode function. The cursor is going 24 | to be on the first B: 25 | 26 | > /Base64Encode 27 | 28 | And invoke cross reference search: 29 | 30 | :CrXrefSearch 31 | 32 | & ^Cat{Definition: 33 | & }Cat_ ^F{src/base/base64.cc}F_ 34 | & 13: ^>{void Base64Encode(const StringPiece& input, std::string* output) {}>_ 35 | 36 | Let's go to the declaration: 37 | 38 | > /Declarationj 39 | 40 | And jump to the file under the cursor 41 | 42 | > 43 | 44 | & // Copyright (c) 2011 The Chromium Authors. All rights reserved. 45 | & // Use of this source code is governed by a BSD-style license that can be 46 | & // found in the LICENSE file. 47 | & 48 | & #ifndef BASE_BASE64_H_ 49 | & #define BASE_BASE64_H_ 50 | 51 | See we are in the header file. Let's go back to the search results page. 52 | 53 | > 54 | : echomsg bufname("%") 55 | ~ Crossreferences* (glob) 56 | 57 | Jump to the definition: 58 | 59 | > gg/Definitionjj 60 | 61 | And move the cursor over to the B in Base64Encode: 62 | 63 | > 0fB 64 | 65 | And jump to the file: 66 | 67 | > 68 | 69 | This time we should be on the line containing the definition: 70 | 71 | : echomsg bufname("%") 72 | ~ *base64.cc (glob) 73 | 74 | Not only that, the cursor should be on the first B: 75 | 76 | > "aye 77 | : echomsg getreg("a") 78 | ~ Base64Encode 79 | 80 | --------------------------------------------------------------------------------