diff options
author | w0rp <devw0rp@gmail.com> | 2018-09-07 19:27:42 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-09-07 19:27:42 +0100 |
commit | 0ae4ea23c8573f9c693fcd5cd5ff9a3acc795b58 (patch) | |
tree | d76944974e4ed34400966d640f9fc88caaee5b0b | |
parent | e0fe97e0a8e929bef9bd4d677c066968be70e914 (diff) | |
download | ale-0ae4ea23c8573f9c693fcd5cd5ff9a3acc795b58.zip |
#1888 Support names with minuses in Clojure and Lisp
-rw-r--r-- | autoload/ale/completion.vim | 4 | ||||
-rw-r--r-- | test/completion/test_completion_prefixes.vader | 20 |
2 files changed, 24 insertions, 0 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim index c1736678..bded12b1 100644 --- a/autoload/ale/completion.vim +++ b/autoload/ale/completion.vim @@ -39,10 +39,14 @@ let s:LSP_COMPLETION_COLOR_KIND = 16 let s:LSP_COMPLETION_FILE_KIND = 17 let s:LSP_COMPLETION_REFERENCE_KIND = 18 +let s:lisp_regex = '\v[a-zA-Z_\-][a-zA-Z_\-0-9]*$' + " Regular expressions for checking the characters in the line before where " the insert cursor is. If one of these matches, we'll check for completions. let s:should_complete_map = { \ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$', +\ 'clojure': s:lisp_regex, +\ 'lisp': s:lisp_regex, \ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$', \ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$', \} diff --git a/test/completion/test_completion_prefixes.vader b/test/completion/test_completion_prefixes.vader index 0b2cfeaf..3f2cab15 100644 --- a/test/completion/test_completion_prefixes.vader +++ b/test/completion/test_completion_prefixes.vader @@ -43,3 +43,23 @@ Execute(Completion should be done after words in parens in Rust): Execute(Completion should not be done after parens in Rust): AssertEqual '', ale#completion#GetPrefix(&filetype, 3, 15) + +Given lisp(): + (minus-name + (full-name) + +Execute(Completion should be done for function names with minuses in Lisp): + AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12) + +Execute(Completion should not be done after parens in Lisp): + AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12) + +Given clojure(): + (minus-name + (full-name) + +Execute(Completion should be done for function names with minuses in Clojure): + AssertEqual 'minus-name', ale#completion#GetPrefix(&filetype, 1, 12) + +Execute(Completion should not be done after parens in Clojure): + AssertEqual '', ale#completion#GetPrefix(&filetype, 2, 12) |