Mercurial > vim-gutentags
comparison autoload/gutentags.vim @ 83:e7e392be4141
Only show message about an existing update job for user-initiated actions.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 26 Aug 2015 21:20:37 -0700 |
parents | a837021a2388 |
children | 96bfe5c37f37 |
comparison
equal
deleted
inserted
replaced
82:a837021a2388 | 83:e7e392be4141 |
---|---|
146 call add(s:known_files, l:tagfile) | 146 call add(s:known_files, l:tagfile) |
147 | 147 |
148 " Generate this new file depending on settings and stuff. | 148 " Generate this new file depending on settings and stuff. |
149 if g:gutentags_generate_on_missing && !filereadable(l:tagfile) | 149 if g:gutentags_generate_on_missing && !filereadable(l:tagfile) |
150 call gutentags#trace("Generating missing tags file: " . l:tagfile) | 150 call gutentags#trace("Generating missing tags file: " . l:tagfile) |
151 call s:update_tags(module, 1, 0) | 151 call s:update_tags(module, 1, 1) |
152 elseif g:gutentags_generate_on_new | 152 elseif g:gutentags_generate_on_new |
153 call gutentags#trace("Generating tags file: " . l:tagfile) | 153 call gutentags#trace("Generating tags file: " . l:tagfile) |
154 call s:update_tags(module, 1, 0) | 154 call s:update_tags(module, 1, 1) |
155 endif | 155 endif |
156 endif | 156 endif |
157 endfor | 157 endfor |
158 endfunction | 158 endfunction |
159 | 159 |
205 | 205 |
206 " (Re)Generate the tags file for a buffer that just go saved. | 206 " (Re)Generate the tags file for a buffer that just go saved. |
207 function! s:write_triggered_update_tags() abort | 207 function! s:write_triggered_update_tags() abort |
208 if g:gutentags_enabled && g:gutentags_generate_on_write | 208 if g:gutentags_enabled && g:gutentags_generate_on_write |
209 for module in g:gutentags_modules | 209 for module in g:gutentags_modules |
210 call s:update_tags(module, 0, 1) | 210 call s:update_tags(module, 0, 2) |
211 endfor | 211 endfor |
212 endif | 212 endif |
213 endfunction | 213 endfunction |
214 | 214 |
215 " Update the tags file for the current buffer's file. | 215 " Update the tags file for the current buffer's file. |
217 " 0: update the tags file if it exists, generate it otherwise. | 217 " 0: update the tags file if it exists, generate it otherwise. |
218 " 1: always generate (overwrite) the tags file. | 218 " 1: always generate (overwrite) the tags file. |
219 " | 219 " |
220 " queue_mode: | 220 " queue_mode: |
221 " 0: if an update is already in progress, report it and abort. | 221 " 0: if an update is already in progress, report it and abort. |
222 " 1: if an update is already in progress, queue another one. | 222 " 1: if an update is already in progress, abort silently. |
223 " 2: if an update is already in progress, queue another one. | |
223 function! s:update_tags(module, write_mode, queue_mode) abort | 224 function! s:update_tags(module, write_mode, queue_mode) abort |
224 " Figure out where to save. | 225 " Figure out where to save. |
225 let l:tags_file = b:gutentags_files[a:module] | 226 let l:tags_file = b:gutentags_files[a:module] |
226 let l:proj_dir = b:gutentags_root | 227 let l:proj_dir = b:gutentags_root |
227 | 228 |
228 " Check that there's not already an update in progress. | 229 " Check that there's not already an update in progress. |
229 let l:lock_file = l:tags_file . '.lock' | 230 let l:lock_file = l:tags_file . '.lock' |
230 if filereadable(l:lock_file) | 231 if filereadable(l:lock_file) |
231 if a:queue_mode == 1 | 232 if a:queue_mode == 2 |
232 let l:idx = index(s:update_queue[a:module], l:tags_file) | 233 let l:idx = index(s:update_queue[a:module], l:tags_file) |
233 if l:idx < 0 | 234 if l:idx < 0 |
234 call add(s:update_queue[a:module], l:tags_file) | 235 call add(s:update_queue[a:module], l:tags_file) |
235 endif | 236 endif |
236 call gutentags#trace("Tag file '" . l:tags_file . | 237 call gutentags#trace("Tag file '" . l:tags_file . |
237 \"' is already being updated. Queuing it up...") | 238 \"' is already being updated. Queuing it up...") |
238 call gutentags#trace("") | 239 elseif a:queue_mode == 1 |
239 else | 240 call gutentags#trace("Tag file '" . l:tags_file . |
241 \"' is already being updated. Skipping...") | |
242 elseif a:queue_mode == 0 | |
240 echom "gutentags: The tags file is already being updated, " . | 243 echom "gutentags: The tags file is already being updated, " . |
241 \"please try again later." | 244 \"please try again later." |
242 echom "" | 245 else |
246 call gutentags#throw("Unknown queue mode: " . a:queue_mode) | |
243 endif | 247 endif |
244 return | 248 return |
245 endif | 249 endif |
246 | 250 |
247 " Switch to the project root to make the command line smaller, and make | 251 " Switch to the project root to make the command line smaller, and make |