Skip to content

Commit dd47d24

Browse files
committed
Support fsiExtraParameters
1 parent e0e01bd commit dd47d24

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

README.mkd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ let g:fsharp#fsi_command = "fsharpi"
223223
let g:fsharp#use_sdk_scripts = 0 " for net462 FSI
224224
~~~
225225

226+
##### Set additional runtime arguments passed to FSI (default: `[]` (empty))
227+
228+
Sets additional arguments of the FSI instance Ionide-vim spawns and changes the behavior of FSAC accordingly when editing fsx files.
229+
230+
~~~.vim
231+
let g:fsharp#fsi_extra_parameters = ['--langversion:preview']
232+
~~~
233+
226234
##### Customize how FSI window is opened (default: `botright 10new`)
227235

228236
It must create a new empty window and then focus to it.

autoload/fsharp.vim

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ let s:config_keys_camel =
131131
\ {'key': 'AutomaticWorkspaceInit', 'default': 1},
132132
\ {'key': 'WorkspaceModePeekDeepLevel', 'default': 2},
133133
\ {'key': 'ExcludeProjectDirectories', 'default': []},
134-
\ {'key': 'KeywordsAutocomplete', 'default': 1},
134+
\ {'key': 'keywordsAutocomplete', 'default': 1},
135135
\ {'key': 'ExternalAutocomplete', 'default': 0},
136136
\ {'key': 'Linter', 'default': 1},
137137
\ {'key': 'UnionCaseStubGeneration', 'default': 1},
@@ -151,6 +151,8 @@ let s:config_keys_camel =
151151
\ {'key': 'DisableInMemoryProjectReferences', 'default': 0},
152152
\ {'key': 'LineLens', 'default': {'enabled': 'replaceCodeLens', 'prefix': '//'}},
153153
\ {'key': 'UseSdkScripts', 'default': 1},
154+
\ {'key': 'dotNetRoot'},
155+
\ {'key': 'fsiExtraParameters', 'default': []},
154156
\ ]
155157
let s:config_keys = []
156158

@@ -362,8 +364,17 @@ function! s:win_gotoid_safe(winid)
362364
endif
363365
endfunction
364366

367+
function! s:get_fsi_command()
368+
let cmd = g:fsharp#fsi_command
369+
for prm in g:fsharp#fsi_extra_parameters
370+
let cmd = cmd . " " . prm
371+
endfor
372+
return cmd
373+
endfunction
374+
365375
function! fsharp#openFsi(returnFocus)
366376
if bufwinid(s:fsi_buffer) <= 0
377+
let fsi_command = s:get_fsi_command()
367378
" Neovim
368379
if exists('*termopen') || exists('*term_start')
369380
let current_win = win_getid()
@@ -378,7 +389,7 @@ function! fsharp#openFsi(returnFocus)
378389
if a:returnFocus | call s:win_gotoid_safe(current_win) | endif
379390
" open FSI: Neovim
380391
elseif has('nvim')
381-
let s:fsi_job = termopen(g:fsharp#fsi_command)
392+
let s:fsi_job = termopen(fsi_command)
382393
if s:fsi_job > 0
383394
let s:fsi_buffer = bufnr("%")
384395
else
@@ -393,7 +404,7 @@ function! fsharp#openFsi(returnFocus)
393404
\ "curwin": 1,
394405
\ "term_finish": "close"
395406
\ }
396-
let s:fsi_buffer = term_start(g:fsharp#fsi_command, options)
407+
let s:fsi_buffer = term_start(fsi_command, options)
397408
if s:fsi_buffer != 0
398409
if exists('*term_setkill') | call term_setkill(s:fsi_buffer, "term") | endif
399410
let s:fsi_job = term_getjob(s:fsi_buffer)

0 commit comments

Comments
 (0)