]> git.wincent.com - docvim.git/commitdiff
Be more liberal in parsing option defaults
authorGreg Hurrell <greg@hurrell.net>
Tue, 25 Dec 2018 17:55:20 +0000 (18:55 +0100)
committerGreg Hurrell <greg@hurrell.net>
Tue, 25 Dec 2018 17:55:20 +0000 (18:55 +0100)
Instead of just words (no whitespace), take everything up to the end of
the line (might want to trim whitespace here). This means we can have a
default like "foo bar" (previously we could only have "foo").

lib/Text/Docvim/Parse.hs
tests/fixtures/integration/ferret/golden/ast.golden
tests/fixtures/integration/ferret/golden/markdown.golden
tests/fixtures/integration/ferret/golden/plaintext.golden
tests/fixtures/integration/ferret/input/autoload/ferret/private/shared.vim
tests/fixtures/integration/ferret/input/plugin/ferret.vim

index 12fc980305f9bba7c9b5b84a266a1cf1ca14fed8..63517f63b333ae2d0c3da0cc121d5cc599ac9c1a 100644 (file)
@@ -461,7 +461,7 @@ annotation = char '@' *> annotationName
     option'           = string "option" >> ws >> OptionAnnotation <$> optionName <*> optionType <*> optionDefault
     optionName        = many1 (alphaNum <|> char ':') <* ws <?> "option name"
     optionType        = many1 alphaNum <* optional ws <?> "option type"
-    optionDefault     = optionMaybe word <?> "option default value"
+    optionDefault     = optionMaybe $ many1 (noneOf "\n")
 
     plugin            = string "plugin" >> ws >> PluginAnnotation <$> pluginName <*> plugInDescription
     pluginName        = many1 (alphaNum <|> char '-') <* ws
index 73551eb23a7bd53e32db12b0ef9d43e3af031b9c..ed7843a92806f3164c6a50586bb028756e96c751 100644 (file)
@@ -2214,6 +2214,7 @@ Project
                       { letLexpr = "l:prefix"
                       , letValue = "'c' \" Will use cexpr, cgetexpr."
                       }
+                  , Empty
                   , LetStatement
                       { letLexpr = "l:handler"
                       , letValue = "get(g:, 'FerretQFHandler', 'botright copen')"
@@ -2224,6 +2225,7 @@ Project
                       { letLexpr = "l:prefix"
                       , letValue = "'l' \" Will use lexpr, lgetexpr."
                       }
+                  , Empty
                   , LetStatement
                       { letLexpr = "l:handler"
                       , letValue = "get(g:, 'FerretLLHandler', 'lopen')"
@@ -3465,6 +3467,85 @@ Project
       , Plaintext "\"bar\":"
       ]
   , Fenced [ ":Acks /\\v(foo\\d+)(bar)/\\2\\1/" ]
+  , CommandAnnotation "FerretCancelAsync" Nothing
+  , Paragraph
+      [ Plaintext "Cancels"
+      , Whitespace
+      , Plaintext "any"
+      , Whitespace
+      , Plaintext "asynchronous"
+      , Whitespace
+      , Plaintext "search"
+      , Whitespace
+      , Plaintext "that"
+      , Whitespace
+      , Plaintext "may"
+      , Whitespace
+      , Plaintext "be"
+      , Whitespace
+      , Plaintext "in"
+      , Whitespace
+      , Plaintext "progress"
+      , Whitespace
+      , Plaintext "in"
+      , Whitespace
+      , Plaintext "the"
+      , Whitespace
+      , Plaintext "background."
+      ]
+  , CommandAnnotation "FerretPullAsync" Nothing
+  , Paragraph
+      [ Plaintext "Eagerly"
+      , Whitespace
+      , Plaintext "populates"
+      , Whitespace
+      , Plaintext "the"
+      , Whitespace
+      , Link "quickfix"
+      , Whitespace
+      , Plaintext "(or"
+      , Whitespace
+      , Link "location-list"
+      , Plaintext ")"
+      , Whitespace
+      , Plaintext "window"
+      , Whitespace
+      , Plaintext "with"
+      , Whitespace
+      , Plaintext "any"
+      , Whitespace
+      , Plaintext "results"
+      , Whitespace
+      , Plaintext "that"
+      , Whitespace
+      , Plaintext "may"
+      , Whitespace
+      , Plaintext "have"
+      , Whitespace
+      , Plaintext "been"
+      , Whitespace
+      , Plaintext "produced"
+      , Whitespace
+      , Plaintext "by"
+      , Whitespace
+      , Plaintext "a"
+      , Whitespace
+      , Plaintext "long-running"
+      , Whitespace
+      , Plaintext "asynchronoous"
+      , Whitespace
+      , Plaintext "search"
+      , Whitespace
+      , Plaintext "in"
+      , Whitespace
+      , Plaintext "progress"
+      , Whitespace
+      , Plaintext "in"
+      , Whitespace
+      , Plaintext "the"
+      , Whitespace
+      , Plaintext "background."
+      ]
   , CommandAnnotation "Qargs" Nothing
   , Paragraph
       [ Plaintext "This"
@@ -4944,6 +5025,71 @@ Project
   , Paragraph
       [ Plaintext "Example" , Whitespace , Plaintext "override:" ]
   , Fenced [ "let g:FerretAutojump=2" ]
+  , OptionAnnotation
+      "g:FerretQFHandler" "string" (Just "\"botright copen\"")
+  , Paragraph
+      [ Plaintext "Allows"
+      , Whitespace
+      , Plaintext "you"
+      , Whitespace
+      , Plaintext "to"
+      , Whitespace
+      , Plaintext "override"
+      , Whitespace
+      , Plaintext "the"
+      , Whitespace
+      , Plaintext "mechanism"
+      , Whitespace
+      , Plaintext "that"
+      , Whitespace
+      , Plaintext "opens"
+      , Whitespace
+      , Plaintext "the"
+      , Whitespace
+      , Link "quickfix"
+      , Whitespace
+      , Plaintext "window"
+      , Whitespace
+      , Plaintext "to"
+      , Whitespace
+      , Plaintext "display"
+      , Whitespace
+      , Plaintext "search"
+      , Whitespace
+      , Plaintext "results."
+      ]
+  , OptionAnnotation "g:FerretLLHandler" "string" (Just "\"lopen\"")
+  , Paragraph
+      [ Plaintext "Allows"
+      , Whitespace
+      , Plaintext "you"
+      , Whitespace
+      , Plaintext "to"
+      , Whitespace
+      , Plaintext "override"
+      , Whitespace
+      , Plaintext "the"
+      , Whitespace
+      , Plaintext "mechanism"
+      , Whitespace
+      , Plaintext "that"
+      , Whitespace
+      , Plaintext "opens"
+      , Whitespace
+      , Plaintext "the"
+      , Whitespace
+      , Link "location-list"
+      , Whitespace
+      , Plaintext "window"
+      , Whitespace
+      , Plaintext "to"
+      , Whitespace
+      , Plaintext "display"
+      , Whitespace
+      , Plaintext "search"
+      , Whitespace
+      , Plaintext "results."
+      ]
   , OptionAnnotation "g:FerretQFOptions" "boolean" (Just "1")
   , Paragraph
       [ Plaintext "Controls"
index 11d0cb4ebdef9963999dd3bf33932a989f9c16b5..a761769bb4d7268d2e21e1fbd610a05844688d46 100644 (file)
@@ -153,6 +153,18 @@ The pattern and replacement are passed through literally to Vim's <strong>`:subs
 :Acks /\v(foo\d+)(bar)/\2\1/
 ```
 
+<p align="right"><a name="ferretcancelasync" href="#user-content-ferretcancelasync"><code>:FerretCancelAsync</code></a></p>
+
+### `:FerretCancelAsync`<a name="ferret-ferretcancelasync" href="#user-content-ferret-ferretcancelasync"></a>
+
+Cancels any asynchronous search that may be in progress in the background.
+
+<p align="right"><a name="ferretpullasync" href="#user-content-ferretpullasync"><code>:FerretPullAsync</code></a></p>
+
+### `:FerretPullAsync`<a name="ferret-ferretpullasync" href="#user-content-ferret-ferretpullasync"></a>
+
+Eagerly populates the <strong>`quickfix`</strong> (or <strong>`location-list`</strong>) window with any results that may have been produced by a long-running asynchronoous search in progress in the background.
+
 <p align="right"><a name="qargs" href="#user-content-qargs"><code>:Qargs</code></a></p>
 
 ### `:Qargs`<a name="ferret-qargs" href="#user-content-ferret-qargs"></a>
@@ -308,6 +320,18 @@ Example override:
 let g:FerretAutojump=2
 ```
 
+<p align="right"><a name="gferretqfhandler" href="#user-content-gferretqfhandler"><code>g:FerretQFHandler</code></a></p>
+
+### `g:FerretQFHandler` (string, default: "botright copen")<a name="ferret-gferretqfhandler-string-default-botright-copen" href="#user-content-ferret-gferretqfhandler-string-default-botright-copen"></a>
+
+Allows you to override the mechanism that opens the <strong>`quickfix`</strong> window to display search results.
+
+<p align="right"><a name="gferretllhandler" href="#user-content-gferretllhandler"><code>g:FerretLLHandler</code></a></p>
+
+### `g:FerretLLHandler` (string, default: "lopen")<a name="ferret-gferretllhandler-string-default-lopen" href="#user-content-ferret-gferretllhandler-string-default-lopen"></a>
+
+Allows you to override the mechanism that opens the <strong>`location-list`</strong> window to display search results.
+
 <p align="right"><a name="gferretqfoptions" href="#user-content-gferretqfoptions"><code>g:FerretQFOptions</code></a></p>
 
 ### `g:FerretQFOptions` (boolean, default: 1)<a name="ferret-gferretqfoptions-boolean-default-1" href="#user-content-ferret-gferretqfoptions-boolean-default-1"></a>
@@ -669,7 +693,7 @@ Other contributors that have submitted patches include (in alphabetical order):
 
 ### 1.2a (16 May 2016)<a name="ferret-12a-16-may-2016" href="#user-content-ferret-12a-16-may-2016"></a>
 
-- Add optional support for running searches asynchronously using Vim's <strong>`+job`</strong> feature (enabled by default in sufficiently recent versions of Vim); see <strong>[`g:FerretJob`](#user-content-gferretjob)</strong>, <strong>`:FerretCancelAsync`</strong> and <strong>`:FerretPullAsync`</strong>.
+- Add optional support for running searches asynchronously using Vim's <strong>`+job`</strong> feature (enabled by default in sufficiently recent versions of Vim); see <strong>[`g:FerretJob`](#user-content-gferretjob)</strong>, <strong>[`:FerretCancelAsync`](#user-content-ferretcancelasync)</strong> and <strong>[`:FerretPullAsync`](#user-content-ferretpullasync)</strong>.
 
 
 ### 1.1.1 (7 March 2016)<a name="ferret-111-7-march-2016" href="#user-content-ferret-111-7-march-2016"></a>
@@ -688,7 +712,7 @@ Other contributors that have submitted patches include (in alphabetical order):
 ### 1.0 (28 December 2015)<a name="ferret-10-28-december-2015" href="#user-content-ferret-10-28-december-2015"></a>
 
 - Fix broken <strong>[`:Qargs`](#user-content-qargs)</strong> command (patch from Daniel Silva).
-- Add <strong>`g:FerretQFHandler`</strong> and <strong>`g:FerretLLHandler`</strong> options (patch from Daniel Silva).
+- Add <strong>[`g:FerretQFHandler`](#user-content-gferretqfhandler)</strong> and <strong>[`g:FerretLLHandler`](#user-content-gferretllhandler)</strong> options (patch from Daniel Silva).
 - Make <strong>`<Plug>`</strong> mappings accessible even <strong>[`g:FerretMap`](#user-content-gferretmap)</strong> is set to 0.
 - Fix failure to report filename when using `ack` and explicitly scoping search to a single file (patch from Daniel Silva).
 - When using `ag`, report multiple matches per line instead of just the first (patch from Daniel Silva).
index 21a824516384e5aac9610b65eb86dfc94ea3639e..7230abc8ff48e56f81a3f76fd5cdbacd7531187e 100644 (file)
@@ -206,6 +206,18 @@ used to swap the order of "foo123" and "bar":
 >
     :Acks /\v(foo\d+)(bar)/\2\1/
 <
+                                                            *:FerretCancelAsync*
+:FerretCancelAsync  ~
+
+Cancels any asynchronous search that may be in progress in the background.
+
+                                                              *:FerretPullAsync*
+:FerretPullAsync  ~
+
+Eagerly populates the |quickfix| (or |location-list|) window with any results
+that may have been produced by a long-running asynchronoous search in
+progress in the background.
+
                                                                         *:Qargs*
 :Qargs  ~
 
@@ -376,6 +388,20 @@ Example override:
     let g:FerretAutojump=2
 <
 
+                                                             *g:FerretQFHandler*
+|g:FerretQFHandler|                           string (default: "botright copen")
+
+Allows you to override the mechanism that opens the |quickfix| window to
+display search results.
+
+
+                                                             *g:FerretLLHandler*
+|g:FerretLLHandler|                                    string (default: "lopen")
+
+Allows you to override the mechanism that opens the |location-list| window to
+display search results.
+
+
                                                              *g:FerretQFOptions*
 |g:FerretQFOptions|                                         boolean (default: 1)
 
index 90fbbb2fa8e81c6ea70a5490d8aa9b95217e4fde..c9873fbe7d2c5a47e75ead3ab6be5f1db566a94b 100644 (file)
@@ -44,10 +44,22 @@ function! ferret#private#shared#finalize_search(output, ack)
   let l:autojump=s:autojump()
   if a:ack
     let l:prefix='c' " Will use cexpr, cgetexpr.
+    ""
+    " @option g:FerretQFHandler string "botright copen"
+    "
+    " Allows you to override the mechanism that opens the |quickfix| window to
+    " display search results.
+    "
     let l:handler=get(g:, 'FerretQFHandler', 'botright copen')
     let l:post='qf'
   else
     let l:prefix='l' " Will use lexpr, lgetexpr.
+    ""
+    " @option g:FerretLLHandler string "lopen"
+    "
+    " Allows you to override the mechanism that opens the |location-list|
+    " window to display search results.
+    "
     let l:handler=get(g:, 'FerretLLHandler', 'lopen')
     let l:post='location'
   endif
index 4c62ae2bceacd363144cf2d05be5b567d55ca71b..817bf173dc4736c787ceace78b0175c908ad67c4 100644 (file)
@@ -620,7 +620,21 @@ command! -bang -nargs=1 -complete=customlist,ferret#private#blackcomplete Black
 " :Acks /\v(foo\d+)(bar)/\2\1/
 " ```
 command! -nargs=1 Acks call ferret#private#acks(<q-args>)
+
+""
+" @command :FerretCancelAsync
+"
+" Cancels any asynchronous search that may be in progress in the background.
+"
 command! FerretCancelAsync call ferret#private#async#cancel()
+
+""
+" @command :FerretPullAsync
+"
+" Eagerly populates the |quickfix| (or |location-list|) window with any results
+" that may have been produced by a long-running asynchronoous search in progress
+" in the background.
+"
 command! FerretPullAsync call ferret#private#async#pull()
 
 nnoremap <Plug>(FerretAck) :Ack<space>