Skip to content

Commit

Permalink
Split the ocaml filetype into several filetypes
Browse files Browse the repository at this point in the history
Now ocamlinterface ocamllex and menhir types must be taken into account
as well.

The filetypes are introduced by
ocaml/vim-ocaml#61
  • Loading branch information
undu committed Jun 19, 2021
1 parent 444f6e0 commit 3d3fe95
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 0 deletions.
11 changes: 11 additions & 0 deletions vim/merlin/autoload/neomake/makers/ft/menhir.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function! neomake#makers#ft#menhir#EnabledMakers() abort
return ['merlin']
endfunction

function! neomake#makers#ft#menhir#merlin() abort
let maker = {}
function! maker.get_list_entries(jobinfo)
return merlin#ErrorLocList()
endfunction
return maker
endfunction
11 changes: 11 additions & 0 deletions vim/merlin/autoload/neomake/makers/ft/ocamlinterface.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function! neomake#makers#ft#ocamlinterface#EnabledMakers() abort
return ['merlin']
endfunction

function! neomake#makers#ft#ocamlinterface#merlin() abort
let maker = {}
function! maker.get_list_entries(jobinfo)
return merlin#ErrorLocList()
endfunction
return maker
endfunction
11 changes: 11 additions & 0 deletions vim/merlin/autoload/neomake/makers/ft/ocamllex.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function! neomake#makers#ft#ocamllex#EnabledMakers() abort
return ['merlin']
endfunction

function! neomake#makers#ft#ocamllex#merlin() abort
let maker = {}
function! maker.get_list_entries(jobinfo)
return merlin#ErrorLocList()
endfunction
return maker
endfunction
6 changes: 6 additions & 0 deletions vim/merlin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
(autoload/merlin_visual.vim as vim/autoload/merlin_visual.vim)
(doc/merlin.txt as vim/doc/merlin.txt)
(ftdetect/merlin.vim as vim/ftdetect/merlin.vim)
(ftplugin/menhir.vim as vim/ftplugin/menhir.vim)
(ftplugin/merlin.vim as vim/ftplugin/merlin.vim)
(ftplugin/ocaml.vim as vim/ftplugin/ocaml.vim)
(ftplugin/ocamlinterface.vim as vim/ftplugin/ocamlinterface.vim)
(ftplugin/ocamllex.vim as vim/ftplugin/ocamllex.vim)
(ftplugin/omlet.vim as vim/ftplugin/omlet.vim)
(ftplugin/reason.vim as vim/ftplugin/reason.vim)
(plugin/merlin.vim as vim/plugin/merlin.vim)
(syntax_checkers/menhir/merlin.vim as vim/syntax_checkers/menhir/merlin.vim)
(syntax_checkers/ocaml/merlin.vim as vim/syntax_checkers/ocaml/merlin.vim)
(syntax_checkers/ocamlinterface/merlin.vim as vim/syntax_checkers/ocamlinterface/merlin.vim)
(syntax_checkers/ocamllex/merlin.vim as vim/syntax_checkers/ocamllex/merlin.vim)
(syntax_checkers/omlet/merlin.vim as vim/syntax_checkers/omlet/merlin.vim)
(syntax/merlin.vim as vim/syntax/merlin.vim)))
2 changes: 2 additions & 0 deletions vim/merlin/ftplugin/menhir.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
" Activate merlin on current buffer
call merlin#Register()
2 changes: 2 additions & 0 deletions vim/merlin/ftplugin/ocamlinterface.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
" Activate merlin on current buffer
call merlin#Register()
2 changes: 2 additions & 0 deletions vim/merlin/ftplugin/ocamllex.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
" Activate merlin on current buffer
call merlin#Register()
23 changes: 23 additions & 0 deletions vim/merlin/syntax_checkers/menhir/merlin.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
" Enable Syntastic support
" Make sure syntax_checkers directory is on runtime path, then set
" :let g:syntastic_menhir_checkers=['merlin']

function! SyntaxCheckers_menhir_merlin_IsAvailable()
if !exists("*merlin#SelectBinary")
return 0
endif
try
let l:path = merlin#SelectBinary()
return executable(l:path)
catch
return 0
endtry
endfunction

function! SyntaxCheckers_menhir_merlin_GetLocList()
return merlin#ErrorLocList()
endfunction

call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'menhir',
\ 'name': 'merlin'})
23 changes: 23 additions & 0 deletions vim/merlin/syntax_checkers/ocamlinterface/merlin.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
" Enable Syntastic support
" Make sure syntax_checkers directory is on runtime path, then set
" :let g:syntastic_ocamlinterface_checkers=['merlin']

function! SyntaxCheckers_ocamlinterface_merlin_IsAvailable()
if !exists("*merlin#SelectBinary")
return 0
endif
try
let l:path = merlin#SelectBinary()
return executable(l:path)
catch
return 0
endtry
endfunction

function! SyntaxCheckers_ocamlinterface_merlin_GetLocList()
return merlin#ErrorLocList()
endfunction

call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ocamlinterface',
\ 'name': 'merlin'})
23 changes: 23 additions & 0 deletions vim/merlin/syntax_checkers/ocamllex/merlin.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
" Enable Syntastic support
" Make sure syntax_checkers directory is on runtime path, then set
" :let g:syntastic_ocamllex_checkers=['merlin']

function! SyntaxCheckers_ocamllex_merlin_IsAvailable()
if !exists("*merlin#SelectBinary")
return 0
endif
try
let l:path = merlin#SelectBinary()
return executable(l:path)
catch
return 0
endtry
endfunction

function! SyntaxCheckers_ocamllex_merlin_GetLocList()
return merlin#ErrorLocList()
endfunction

call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'ocamllex',
\ 'name': 'merlin'})

0 comments on commit 3d3fe95

Please sign in to comment.