All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 Save g:ale_fix_on_save_ignore
6 let g:ale_fix_on_save = 1
7 let g:ale_fixers = {'abc': ['a', 'b'], 'xyz': ['c', 'd']}
9 unlet! b:ale_fix_on_save_ignore
11 function FixerA(buffer, lines) abort
12 return a:lines + ['a']
15 function FixerB(buffer, lines) abort
16 return a:lines + ['b']
19 function FixerC(buffer, lines) abort
20 return a:lines + ['c']
23 function FixerD(buffer, lines) abort
24 return a:lines + ['d']
28 let g:test_filename = tempname()
29 execute 'noautocmd silent file ' . fnameescape(g:test_filename)
31 call ale#fix#registry#Add('a', 'FixerA', ['abc'], '')
32 call ale#fix#registry#Add('b', 'FixerB', ['abc'], '')
33 call ale#fix#registry#Add('c', 'FixerC', ['xyz'], '')
34 call ale#fix#registry#Add('d', 'FixerD', ['xyz'], '')
39 if exists('g:test_filename') && filereadable(g:test_filename)
40 call delete(g:test_filename)
44 unlet! b:ale_fix_on_save_ignore
45 unlet! g:test_filename
52 call ale#fix#registry#ResetToDefaults()
54 Given abc.xyz (An empty file):
55 Execute(Ignoring with a filetype in a global Dictionary should work):
56 let g:ale_fix_on_save_ignore = {'abc': ['b'], 'xyz': ['c']}
58 call ale#events#SaveEvent(bufnr(''))
60 AssertEqual ['', 'a', 'd'], getline(1, '$')
62 Execute(Ignoring with a filetype in a global List should work):
63 let g:ale_fix_on_save_ignore = ['b', 'c']
65 call ale#events#SaveEvent(bufnr(''))
67 AssertEqual ['', 'a', 'd'], getline(1, '$')
69 Execute(Ignoring with a filetype in a local Dictionary should work):
70 let g:ale_fix_on_save_ignore = {'abc': ['b'], 'xyz': ['c']}
71 " The local Dictionary should entirely replace the global one.
72 let b:ale_fix_on_save_ignore = {'abc': ['b']}
74 call ale#events#SaveEvent(bufnr(''))
76 AssertEqual ['', 'a', 'c', 'd'], getline(1, '$')
78 Execute(Ignoring with a filetype in a local List should work):
79 let g:ale_fix_on_save_ignore = {'abc': ['b'], 'xyz': ['c']}
80 " The local List should entirely replace the global Dictionary.
81 let b:ale_fix_on_save_ignore = ['b']
83 call ale#events#SaveEvent(bufnr(''))
85 AssertEqual ['', 'a', 'c', 'd'], getline(1, '$')
87 Execute(Ignoring functions by reference with a Dictionary should work):
89 \ 'abc': [function('FixerA'), function('FixerB')],
90 \ 'xyz': [function('FixerC'), function('FixerD')],
92 let b:ale_fix_on_save_ignore = {
93 \ 'abc': [function('FixerB')],
94 \ 'xyz': [function('FixerC')],
97 call ale#events#SaveEvent(bufnr(''))
99 AssertEqual ['', 'a', 'd'], getline(1, '$')
101 Execute(Ignoring functions by reference with a List should work):
103 \ 'abc': [function('FixerA'), function('FixerB')],
104 \ 'xyz': [function('FixerC'), function('FixerD')],
106 let b:ale_fix_on_save_ignore = [function('FixerB'), function('FixerC')]
108 call ale#events#SaveEvent(bufnr(''))
110 AssertEqual ['', 'a', 'd'], getline(1, '$')