#1888 Support names with minuses in Clojure and Lisp

This commit is contained in:
w0rp 2018-09-07 19:27:42 +01:00
parent e0fe97e0a8
commit 0ae4ea23c8
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
2 changed files with 24 additions and 0 deletions

View File

@ -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]*$|\.$|::$',
\}

View File

@ -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)