Add --find-ipkg flag

This means the Idris instance will look for an ipkg file in parent
directories and use that as the root, processing any options.
This commit is contained in:
Edwin Brady 2020-02-23 12:56:29 +00:00
parent 0db674ff18
commit 7a0b10df22
2 changed files with 11 additions and 7 deletions

View File

@ -4,7 +4,13 @@ Idris 2 mode for vim
This is an [Idris2][] mode for vim which features interactive editing, This is an [Idris2][] mode for vim which features interactive editing,
syntax highlighting, indentation and optional syntax checking via syntax highlighting, indentation and optional syntax checking via
[Syntastic][]. If you need a REPL I recommend using [Vimshell][]. [Syntastic][]. If you need a REPL I recommend using [Vimshell][].
It is mostly cloned from the original [idris-mode][]. It is mostly cloned from the original [idris-mode][]. Unlike the Idris 1
mode, there is no need to have an Idris REPL running - it invokes Idris 2
directly.
If there is a `.ipkg` file in any of the parent directories, the mode will
use that as the root of the source tree, and process any options declared
in it (for example, to load packages).
Not all of the commands work yet. Note that the keyboard shortcuts have Not all of the commands work yet. Note that the keyboard shortcuts have
been updated since Idris 1 to be consistent with the Atom mode (e.g. been updated since Idris 1 to be consistent with the Atom mode (e.g.
@ -50,8 +56,6 @@ commands are supported.
`<LocalLeader>a` Create an initial clause for a type declaration. `<LocalLeader>a` Create an initial clause for a type declaration.
`<LocalLeader>b` Same as \d but for an initial typeclass method impl.
`<LocalLeader>c` case split `<LocalLeader>c` case split
`<LocalLeader>mc` make case `<LocalLeader>mc` make case

View File

@ -34,7 +34,7 @@ endfunction
function! s:IdrisCommand(...) function! s:IdrisCommand(...)
let idriscmd = shellescape(join(a:000)) let idriscmd = shellescape(join(a:000))
" echo("idris2 " . expand ('%:t') . " --client " . idriscmd) " echo("idris2 " . expand ('%:t') . " --client " . idriscmd)
return system("idris2 " . expand ('%:t') . " --client " . idriscmd) return system("idris2 --find-ipkg " . expand ('%:t') . " --client " . idriscmd)
endfunction endfunction
function! IdrisDocFold(lineNum) function! IdrisDocFold(lineNum)
@ -95,7 +95,7 @@ endfunction
function! IdrisReload(q) function! IdrisReload(q)
w w
let file = expand("%:p") let file = expand("%:p")
let tc = system("idris2 " . expand ('%:t') . " --client ''") let tc = system("idris2 --find-ipkg " . expand ('%:t') . " --client ''")
if (! (tc is "")) if (! (tc is ""))
call IWrite(tc) call IWrite(tc)
else else
@ -318,12 +318,12 @@ menu Idris.Reload <LocalLeader>r
menu Idris.Show\ Type <LocalLeader>t menu Idris.Show\ Type <LocalLeader>t
menu Idris.Evaluate <LocalLeader>e menu Idris.Evaluate <LocalLeader>e
menu Idris.-SEP0- : menu Idris.-SEP0- :
menu Idris.Add\ Clause <LocalLeader>d menu Idris.Add\ Clause <LocalLeader>a
menu Idris.Generate\ Definition <LocalLeader>g menu Idris.Generate\ Definition <LocalLeader>g
menu Idris.Add\ with <LocalLeader>w menu Idris.Add\ with <LocalLeader>w
menu Idris.Case\ Split <LocalLeader>c menu Idris.Case\ Split <LocalLeader>c
menu Idris.Add\ missing\ cases <LocalLeader>m menu Idris.Add\ missing\ cases <LocalLeader>m
menu Idris.Proof\ Search <LocalLeader>o menu Idris.Proof\ Search <LocalLeader>s
menu Idris.Proof\ Search\ with\ hints <LocalLeader>p menu Idris.Proof\ Search\ with\ hints <LocalLeader>p
au BufHidden idris-response call IdrisHideResponseWin() au BufHidden idris-response call IdrisHideResponseWin()