Open certik opened 3 months ago
I think I figured out how to make it work without lazyvim.
git clone https://github.com/neovim/nvim-lspconfig ~/.config/nvim/pack/nvim/start/nvim-lspconfig
Add this into init.vim
:
lua << EOF
require'lspconfig'.fortls.setup{}
EOF
(or just the middle line into init.lua
)
Only K
and gd
works for me, here is K
:
Yes, colors are not the best, but I am sure that can be fixed.
gd
only finds the symbol in the current file, it doesn't seem to go to another file for some reason.
Tab completion does not work (maybe I don't know how to use it).
Just saw this @certik (sorry...). I use the native LSP implementation of neovim, to configure fortls
and don't pass it through lazyvim since the language server will not activate unless a Fortran file is opened.
I add only a little stub to my init.lua
require'lspconfig'.fortls.setup{
cmd = {
'fortls',
'--lowercase_intrisics',
'--hover_signature',
'--hover_language=fortran',
'--use_signature_help'
}
}
I added it to the docs when I switched from vim to neovim.
I will try and setup it up on my new mac and update the instructions if they are out of date.
I don't understand why I can't get fortls attached with my f90 files when editing with neovim, the LspInfo shows that there's no clients attached to the buffer, can you help me figure it out? thanks.
@brucechan1123 you are on Windows directly. Here is one way how to find the problem:
I haven't tried this in Windows directly yet.
@brucechan1123 you are on Windows directly. Here is one way how to find the problem:
- Try it in WSL first, using my instructions above. Verify that it works.
- Then do it using your setup, but in WSL, ensure things still work
- Then redo it in Windows directly
I haven't tried this in Windows directly yet.
Thanks a lot for offering advice!
I'm not so good at Operation systems, that I'm not sure the 'WSL' denotes windows subsystem linux or something.
However, accidently I tried to call Mason to uninstall forlts and re-install it, and the problem was just solved.
And Thank you anyway for offering advice!
I tried several times and always failed to get (any) LSP working with
neovim
, and I just figured it out specifically for fortls. I am documenting here the exact steps before I forget. We can later move this into fortls documentation.The setup below does not destroy your current
neovim
setup. It makes it completely optional. You can use theNVIM_APPNAME
environment variable to choose between setups.First install lazyvim:
The first time you start
neovim
with this setup, it will load all plugins and install itself. The subsequent time will be quite fast (although not as fast as vanillaneovim
unfortunately and there are other issues, such as flicker at startup, sometimes the cursor movement is lagging; so I do not have lazyvim on by default due to these issues).Install
conda
: Use https://github.com/conda-forge/miniforge and follow the instructions there.Install
fortls
:Check that
fortls
is loaded using:checkhealth lsp
. Now you can use the commands listed at https://dev.to/vonheikemen/getting-started-with-neovims-native-lsp-client-in-the-year-of-2022-the-easy-way-bp3. I found that the following three commands work:K
,gd
,gr
. Here is an example ofK
:Also TAB completion works in insert mode: