Skip to content

Commit 5fb4e32

Browse files
authored
Merge pull request #145 from danieljharvey/master
Add spago.dhall support
2 parents 6d4a3cc + cd287b6 commit 5fb4e32

3 files changed

Lines changed: 18 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ shows the types.
6464
* Vim version 8 or higher or NeoVim version 0.2.0 or higher.
6565
* purs installed and available on your path
6666
* [purescript-vim](https://github.com/raichoo/purescript-vim)
67-
* `bower.json` or `package.json` file in the root path of your project
67+
* `bower.json`, `psc-package.json` or `spago.dhall` file in the root path of your project
6868

6969
## Debugging
7070
Add the following to have psc-ide-vim spit out all logs:

autoload/purescript/ide/utils.vim

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ function! purescript#ide#utils#findRoot()
88
if !empty(bower)
99
return fnamemodify(bower, ":p:h")
1010
else
11-
return ""
11+
let spago = findfile("spago.dhall", fnameescape(expand("%:p:h")).";")
12+
if !empty(spago)
13+
return fnamemodify(spago, ":p:h")
14+
else
15+
return ""
16+
endif
1217
endif
1318
endfor
1419
endfunction

ftplugin/purescript_pscide.vim

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ function! PSCIDEstart(silent)
215215

216216
let dir = purescript#ide#utils#findRoot()
217217
if empty(dir)
218-
echom "No psc-package.json or bower.json found, couldn't start `purs ide server`"
218+
echom "No psc-package.json, bower.json or spago.dhall found, couldn't start `purs ide server`"
219219
return
220220
endif
221-
221+
222222
let command = [
223223
\ "purs", "ide", "server",
224224
\ "-p", g:psc_ide_server_port,
@@ -227,10 +227,16 @@ function! PSCIDEstart(silent)
227227
\ "bower_components/**/*.purs",
228228
\ ]
229229

230+
if executable("spago")
231+
let fullCommand = command + systemlist("spago sources")
232+
else
233+
let fullCommand = command
234+
endif
235+
230236
exe "lcd" dir
231-
call purescript#ide#utils#debug("PSCIDEstart: " . json_encode(command), 3)
237+
call purescript#ide#utils#debug("PSCIDEstart: " . json_encode(fullCommand), 3)
232238
let jobid = purescript#job#start(
233-
\ command,
239+
\ fullCommand,
234240
\ { "on_stderr": { ch, msg -> purescript#ide#utils#warn(purescript#ide#utils#toString(msg), v:true) }
235241
\ , "on_stdout": { ch, msg -> type(msg) == v:t_string ? purescript#ide#utils#log(msg) : v:null }
236242
\ , "on_exit": function("s:onServerExit")
@@ -286,7 +292,7 @@ function! s:projectProblems()
286292
let problems = []
287293

288294
if empty(rootdir)
289-
call add(problems, "Your project is missing a bower.json or psc-package.json file")
295+
call add(problems, "Your project is missing a bower.json, psc-package.json or spago.dhall file")
290296
elseif g:psc_ide_check_output_dir == 1
291297
let outputcontent = s:globpath(rootdir, "output/*")
292298
if len(outputcontent) == 0

0 commit comments

Comments
 (0)