How to Configure lsp for the dart Environment in vim

Asked 2 years ago, Updated 2 years ago, 67 views

I'm trying to build a Dart development environment in Vim, but it doesn't work.
Installing vim-lsp and vim-lsp-settings.(Dart-vim-plugin is not installed.)
I modified vimrc to suit my environment by referring to the example on README.md in vim-lsp-settings.(below)

However, even if you set this setting and open the dart file, :LspStatus displays analysis-server-dart-snapshot:exited.
What should I do?

letg:lsp_settings={
    \ 'analysis-server-dart-snapshot': {
    \     US>'cmd': [
    \         '/home/username/.flutter/bin/dart',
    \         '/home/username/.flutter/bin/dart-sdk/cache/bin/snapshots/analysis_server.dart.snapshot',
    \         '--lsp'
    \     ],
    \ },
\ }

vim dart

2022-09-30 19:10

1 Answers

Using README.md in Dart's lsp, lsp_settings worked as follows, and it was self-resolved, so I will write it down as an answer.
https://github.com/dart-lang/sdk/blob/master/pkg/analysis_server/tool/lsp_spec/README.md#running-the-server

letg:lsp_settings={
    \ 'analysis-server-dart-snapshot': {
    \    US>'cmd': [
    \       '/home/username/.flutter/bin/dart',
    \       'language-server',
    \    ],
    \   'initialization_options': {
    \       'onlyAnalyzeProjectsWithOpenFiles':v:true,
    \   },
    \ },
\ }


2022-09-30 19:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.