summaryrefslogtreecommitdiff
path: root/test/completion/test_completion_events.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-09-08 21:40:10 +0100
committerw0rp <devw0rp@gmail.com>2020-09-08 21:40:10 +0100
commit7d90ff56d96d601478f00895e009ae63a7d8b4bb (patch)
tree8e20d801244d0571cc3680d2b6c42be3a342dadf /test/completion/test_completion_events.vader
parentb4b75126f9eae30da8f5e0cb9ec100feb38c1cb6 (diff)
downloadale-7d90ff56d96d601478f00895e009ae63a7d8b4bb.zip
Close #3333 - Add an ALECompletePost event
Add an `ALECompletePost` event along with everything needed to make it useful for its primary purpose: fixing code after inserting completions. * `ALEFix` can now be called with a bang (`!`) to suppress errors. * A new `ALELintStop` command lets you stop linting, and start it later.
Diffstat (limited to 'test/completion/test_completion_events.vader')
-rw-r--r--test/completion/test_completion_events.vader48
1 files changed, 41 insertions, 7 deletions
diff --git a/test/completion/test_completion_events.vader b/test/completion/test_completion_events.vader
index 87bd10ad..f678e773 100644
--- a/test/completion/test_completion_events.vader
+++ b/test/completion/test_completion_events.vader
@@ -407,41 +407,75 @@ Execute(HandleUserData should call ale#code_action#HandleCodeAction):
AssertEqual g:handle_code_action_called, 0
call ale#completion#HandleUserData({
- \ 'user_data': ''
+ \ 'user_data': ''
\})
AssertEqual g:handle_code_action_called, 0
call ale#completion#HandleUserData({
- \ 'user_data': '{}'
+ \ 'user_data': json_encode({}),
\})
AssertEqual g:handle_code_action_called, 0
call ale#completion#HandleUserData({
- \ 'user_data': '{"codeActions": []}'
+ \ 'user_data': json_encode({
+ \ '_ale_completion_item': 1,
+ \ 'code_actions': [],
+ \ }),
\})
AssertEqual g:handle_code_action_called, 0
call ale#completion#HandleUserData({
- \ 'user_data': '{"codeActions": [{"description":"", "changes": []}]}'
+ \ 'user_data': json_encode({
+ \ '_ale_completion_item': 1,
+ \ 'code_actions': [
+ \ {'description': '', 'changes': []},
+ \ ],
+ \ }),
\})
AssertEqual g:handle_code_action_called, 1
let b:ale_completion_info = {'source': 'ale-automatic'}
call ale#completion#HandleUserData({
- \ 'user_data': '{"codeActions": [{"description":"", "changes": []}]}'
+ \ 'user_data': json_encode({
+ \ '_ale_completion_item': 1,
+ \ 'code_actions': [
+ \ {'description': '', 'changes': []},
+ \ ],
+ \ }),
\})
AssertEqual g:handle_code_action_called, 2
let b:ale_completion_info = {'source': 'ale-callback'}
call ale#completion#HandleUserData({
- \ 'user_data': '{"codeActions": [{"description":"", "changes": []}]}'
+ \ 'user_data': json_encode({
+ \ '_ale_completion_item': 1,
+ \ 'code_actions': [
+ \ {'description': '', 'changes': []},
+ \ ],
+ \ }),
\})
AssertEqual g:handle_code_action_called, 3
+ let b:ale_completion_info = {'source': 'ale-omnifunc'}
+ call ale#completion#HandleUserData({
+ \ 'user_data': json_encode({
+ \ '_ale_completion_item': 1,
+ \ 'code_actions': [
+ \ {'description': '', 'changes': []},
+ \ ],
+ \ }),
+ \})
+ AssertEqual g:handle_code_action_called, 4
+
Execute(ale#code_action#HandleCodeAction should not be called when when source is not ALE):
call MockHandleCodeAction()
let b:ale_completion_info = {'source': 'syntastic'}
call ale#completion#HandleUserData({
- \ 'user_data': '{"codeActions": [{"description":"", "changes": []}]}'
+ \ 'user_data': json_encode({
+ \ '_ale_completion_item': 1,
+ \ 'code_actions': [
+ \ {'description': '', 'changes': []},
+ \ ],
+ \ }),
\})
AssertEqual g:handle_code_action_called, 0