This commit is contained in:
Adam Stankiewicz
2022-02-17 04:31:35 +01:00
parent 2c5af8f89d
commit b77c5f1107
42 changed files with 1855 additions and 1187 deletions

View File

@@ -238,11 +238,7 @@ function! fsharp#loadConfig()
endif
if !exists('g:fsharp#fsautocomplete_command')
let s:fsac = fnamemodify(s:script_root_dir . "fsac/fsautocomplete.dll", ":p")
let g:fsharp#fsautocomplete_command =
\ ['dotnet', s:fsac,
\ '--background-service-enabled'
\ ]
let g:fsharp#fsautocomplete_command = ['fsautocomplete', '--background-service-enabled']
endif
if !exists('g:fsharp#use_recommended_server_config')
let g:fsharp#use_recommended_server_config = 1
@@ -283,6 +279,7 @@ function! fsharp#loadConfig()
" backend configuration
if g:fsharp#backend == 'languageclient-neovim'
let $DOTNET_ROLL_FORWARD='LatestMajor'
if !exists('g:LanguageClient_serverCommands')
let g:LanguageClient_serverCommands = {}
endif
@@ -478,8 +475,17 @@ function! fsharp#OnCursorMove()
endfunction
function! fsharp#showF1Help()
let result = s:f1Help(expand('%:p'), line('.') - 1, col('.') - 1)
echo result
function! s:callback_showF1Help(result)
let result = a:result
if exists('result.result.content')
let content = json_decode(result.result.content)
if exists('content.Data')
let url = 'https://docs.microsoft.com/en-us/dotnet/api/' . substitute(content.Data, '#ctor', '-ctor', 'g')
echo url
endif
endif
endfunction
call s:f1Help(expand('%:p'), line('.') - 1, col('.') - 1, function("s:callback_showF1Help"))
endfunction
function! s:hover()
@@ -505,39 +511,6 @@ function! fsharp#showTooltip()
endfunction
" FSAC update utils
function! s:update_win()
echom "[FSAC] Downloading FSAC. This may take a while..."
let script = s:script_root_dir . "install.ps1"
call system('powershell -ExecutionPolicy Unrestricted ' . script . " update")
endfunction
function! s:update_unix()
echom "[FSAC] Downloading FSAC. This may take a while..."
let zip = s:script_root_dir . "fsac.zip"
call system(
\ 'curl -fLo ' . zip . ' --create-dirs ' .
\ '"https://github.com/fsharp/FsAutoComplete/releases/latest/download/fsautocomplete.netcore.zip"'
\ )
if v:shell_error == 0
call system('unzip -o -d ' . s:script_root_dir . "/fsac " . zip)
call system('find ' . s:script_root_dir . '/fsac' . ' -type f -exec chmod 777 \{\} \;')
echom "[FSAC] Updated FsAutoComplete"
else
echom "[FSAC] Failed to update FsAutoComplete"
endif
endfunction
function! fsharp#updateFSAC(...)
if has('win32') && !has('win32unix')
call s:update_win()
else
call s:update_unix()
endif
endfunction
" FSI integration
let s:fsi_buffer = -1