mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-19 17:42:57 +08:00
Add ReScript support (#5072)
This adds support for both rescript format and rescript-language-server. Closes https://github.com/dense-analysis/ale/issues/3335
This commit is contained in:
46
test/fixers/test_rescript_fixer_callback.vader
Normal file
46
test/fixers/test_rescript_fixer_callback.vader
Normal file
@@ -0,0 +1,46 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('rescript', 'rescript_format')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The rescript callback should return the correct default values):
|
||||
call ale#test#SetFilename('../test-files/rescript/testfile-noextension')
|
||||
|
||||
set filetype=rescript
|
||||
GivenCommandOutput ['12.0.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command':
|
||||
\ ale#Escape(g:ale_rescript_format_executable) . ' format --stdin .res'
|
||||
\ }
|
||||
|
||||
Execute(The rescript callback should correctly detect res files):
|
||||
call ale#test#SetFilename('../test-files/rescript/testfile.res')
|
||||
|
||||
GivenCommandOutput ['12.0.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command':
|
||||
\ ale#Escape(g:ale_rescript_format_executable) . ' format --stdin .res'
|
||||
\ }
|
||||
|
||||
Execute(The rescript callback should correctly detect resi files):
|
||||
call ale#test#SetFilename('../test-files/rescript/testfile.resi')
|
||||
|
||||
GivenCommandOutput ['12.0.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command':
|
||||
\ ale#Escape(g:ale_rescript_format_executable) . ' format --stdin .resi'
|
||||
\ }
|
||||
|
||||
Execute(The version check should be correct):
|
||||
call ale#test#SetFilename('../test-files/rescript/testfile.res')
|
||||
|
||||
GivenCommandOutput ['11.0.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command':
|
||||
\ ale#Escape(g:ale_rescript_format_executable) . ' format -stdin .res'
|
||||
\ }
|
||||
25
test/linter/test_rescript_language_server.vader
Normal file
25
test/linter/test_rescript_language_server.vader
Normal file
@@ -0,0 +1,25 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('rescript', 'rescript_language_server')
|
||||
|
||||
Save &filetype
|
||||
let &filetype = 'rescript'
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The language string should be correct):
|
||||
AssertLSPLanguage 'rescript'
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/rescript/testfile.res')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rescript')
|
||||
|
||||
Execute(The command should be correct):
|
||||
call ale#test#SetFilename('../test-files/rescript/testfile.res')
|
||||
|
||||
AssertLinter
|
||||
\ 'rescript-language-server',
|
||||
\ ale#Escape('rescript-language-server') . ' --stdio'
|
||||
0
test/test-files/rescript/rescript.json
Normal file
0
test/test-files/rescript/rescript.json
Normal file
0
test/test-files/rescript/testfile-noextension
Normal file
0
test/test-files/rescript/testfile-noextension
Normal file
0
test/test-files/rescript/testfile.res
Normal file
0
test/test-files/rescript/testfile.res
Normal file
0
test/test-files/rescript/testfile.resi
Normal file
0
test/test-files/rescript/testfile.resi
Normal file
Reference in New Issue
Block a user