Comments (7)
Added a wiki page on how to use flow language server at https://github.com/prabirshrestha/vim-lsp/wiki/Servers-Flow
from vim-lsp.
It should be similar to typescript. https://github.com/prabirshrestha/vim-lsp/wiki/Servers-TypeScript
from vim-lsp.
You're the best @prabirshrestha ! 💯
from vim-lsp.
@prabirshrestha There's also native lsp support in latest versions via flow lsp
. Could you provide an example with using it with nearest node_modules/.bin/flow
?
from vim-lsp.
I have updated the docs to use flow lsp
.
@TrySound As for the local flow bin, you can write a custom function to return cmd.
function! s:get_flowbin(server_info)
let l:nodemodules_dir = lsp#utils#find_nearest_parent_directory(lsp#utils#get_buffer_path(), 'node_modules')
if !empty(nodemodules_dir)
" you might also want to verify if flow binary actually exists
return [&shell, &shellcmdflag, l:nodemodules_dir . '/.bin/flow lsp']
endif
" instead of returning empty you could also return ['flow', 'lsp] to tell it to use global flow.
return []
endfunction
Then update the cmd to point to the function you created above.
'cmd': function('s:get_flowbin')
I personally use typescript every day and prefer to use global which I keep up to date so that when I'm cleaning the git repro or switching branches I always have the binary there.
from vim-lsp.
@prabirshrestha This is not the case with flow because a few different projects may use different flow versions and produce different errors. I'm sure this is also true for typescript.
from vim-lsp.
For some reason asyncomplete just doesn't work with vim-lsp. This is my config
let g:lsp_preview_keep_focus = 0
let g:asyncomplete_smart_completion = 1
let g:asyncomplete_force_refresh_on_context_changed = 1
let g:asyncomplete_auto_popup = 0
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ asyncomplete#force_refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:get_flowbin(server_info)
let l:nodemodules_dir = lsp#utils#find_nearest_parent_directory(lsp#utils#get_buffer_path(), 'node_modules')
if !empty(nodemodules_dir)
" you might also want to verify if flow binary actually exists
return [&shell, &shellcmdflag, l:nodemodules_dir . '/.bin/flow lsp']
endif
" instead of returning empty you could also return ['flow', 'lsp] to tell it to use global flow.
return []
endfunction
au User lsp_setup call lsp#register_server({
\ 'name': 'flow',
\ 'cmd': function('s:get_flowbin'),
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), '.flowconfig'))},
\ 'whitelist': ['javascript', 'javascript.jsx'],
\ })
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#file#get_source_options({
\ 'name': 'file',
\ 'whitelist': ['*'],
\ 'priority': 10,
\ 'completor': function('asyncomplete#sources#file#completor')
\ }))
from vim-lsp.
Related Issues (20)
- Regression: g:lsp_async_completion not effective, lsp#omni#complete is always async
- Issue with Typescript language server and ESLint HOT 2
- Vim <Ctrl-D> and <Ctrl-F> stopped working HOT 3
- Remap file paths between LSP server and Vim
- are there any plans to support 3.18 features: textDocument/inlineCompletion
- how can we config mlir-lsp-server HOT 1
- No semantic highlight with pylsp HOT 6
- LspRename sometimes hangs
- No command for `textDocument/pullDiagnostics` feature ? HOT 3
- Get LSP to work with complicated Scala project with git submodules. HOT 1
- Undo in neovim HOT 1
- LSP Workspace Diagnostics
- LSP servers not connecting, Windows 11 HOT 1
- File ownership state is out of sync when doing multiple LspRename on unsaved buffers on multiple files HOT 1
- Restart the lsp server can not work.
- Bug: Updating buffer (open, reload) creates duplicated server-side content when multiple LSP servers are enabled
- [Feature request] Install `python-lsp-ruff` plugin with `:LspInstallServer`
- LspStopServer only works for a few seconds, server auto-starts
- hope vimlsp recognize progress info
- Diagnostics display as line until hovered? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-lsp.