changeset 244:d3f9a92399d1

Separate the default project marker finder into a function. This lets people who write custom marker finders fallback to the default behaviour if needed.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 13 Mar 2019 21:56:19 -0700
parents 050d0549ecf3
children 89b41690f374
files autoload/gutentags.vim doc/gutentags.txt
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Tue Mar 12 21:43:50 2019 -0700
+++ b/autoload/gutentags.vim	Wed Mar 13 21:56:19 2019 -0700
@@ -184,7 +184,13 @@
     if g:gutentags_project_root_finder != ''
         return call(g:gutentags_project_root_finder, [a:path])
     endif
+    return gutentags#default_get_project_root(a:path)
+endfunction
 
+" Default implementation for finding project markers... useful when a custom
+" finder (`g:gutentags_project_root_finder`) wants to fallback to the default
+" behaviour.
+function! gutentags#default_get_project_root(path) abort
     let l:path = gutentags#stripslash(a:path)
     let l:previous_path = ""
     let l:markers = g:gutentags_project_root[:]
--- a/doc/gutentags.txt	Tue Mar 12 21:43:50 2019 -0700
+++ b/doc/gutentags.txt	Wed Mar 13 21:56:19 2019 -0700
@@ -384,8 +384,11 @@
                         argument (the path to the current buffer's file) and
                         returns a string value (the project's root directory).
                         Defaults to `''`.
-                        Note: when set, the called implementation will most 
-                        likely ignore |g:gutentags_project_root|.
+                        Note: when set, the called implementation will
+                        possibly ignore |g:gutentags_project_root|.
+                        Note: an implementation can fallback to the default
+                        behaviour by calling
+                        `gutentags#default_get_project_root`.
 
                                                 *gutentags_generate_on_missing*
 g:gutentags_generate_on_missing