Giter VIP home page Giter VIP logo

vim-lsp-settings's Introduction

vim-lsp-settings

Actions Status Actions Status

Auto configurations for Language Servers for vim-lsp.

Introduction

Language Servers are not easy to install. Visual Studio Code provides easy ways to install and update Language Servers and Language Server Client. This plugin provides the same feature for Vim.

Installation

Using the vim-plug plugin manager:

Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'

You need to install both vim-lsp and vim-lsp-settings.

Usage

While editing a file with a supported filetype:

:LspInstallServer

To uninstall server:

:LspUninstallServer server-name

Because there is no way to update a server, please run :LspInstallServer again, the newer version will be installed.

Auto-complete

If you want to use auto-completion, you can use one of the following.

asyncomplete.vim

Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'

ddc.vim

Plug 'Shougo/ddc.vim'
Plug 'shun/ddc-vim-lsp'

LSP server download directory

This is where LSP servers are placed on your system after you download them with :LspInstallServer

Windows

%LOCALAPPDATA%\vim-lsp-settings\servers

MacOS/Linux

$HOME/.local/share/vim-lsp-settings/servers

If you define $XDG_DATA_HOME:

$XDG_DATA_HOME/vim-lsp-settings/servers

You can change the directory to install servers by set g:lsp_settings_servers_dir option in full path.

Supported Languages

Language Language Server Installer Local Install
Apex/VisualForce apex-jorje-lsp Yes Yes
Astro astro-ls Yes Yes
Astro biome Yes Yes
Bash bash-language-server Yes Yes
C# omnisharp Yes Yes
C/C++ clangd Yes Yes
COBOL cobol-language-support Yes Yes
CSS css-languageserver Yes Yes
CSS tailwindcss-intellisense Yes Yes
Clojure clojure-lsp Yes Yes
Clojure clj-kondo-lsp Yes Yes
Cmake cmake-language-server Yes Yes
D dls Yes No
D serve-d Yes No
Dart analysis-server-dart-snapshot Yes Yes
Dockerfile dockerfile-language-server-nodejs Yes Yes
Dot dot-language-server Yes Yes
Elixir elixir-ls Yes Yes
Elm elm-language-server Yes Yes
Erlang erlang-ls Yes Yes
F# fsautocomplete Yes Yes
F# fsharp-language-server Yes Yes
Fortran fortls Yes Yes
Go gopls Yes Yes
Go golangci-lint-langserver Yes Yes
GraphQL graphql-language-service-cli Yes Yes
GraphQL gql-language-server Yes Yes
Groovy groovy-language-server Yes Yes
Haskell haskell-ide-engine No No
Haskell haskell-language-server No No
HTML html-languageserver Yes Yes
HTML angular-language-server Yes Yes
HTML tailwindcss-intellisense Yes Yes
Hy hyuga Yes No
JSON json-languageserver Yes Yes
JSON rome Yes Yes
JSON biome Yes Yes
Jsonnet jsonnet-language-server Yes Yes
Java eclipse-jdt-ls Yes Yes
Java java-language-server No Yes
JavaScript typescript-language-server Yes Yes
JavaScript javascript-typescript-stdio Yes Yes
JavaScript rome Yes Yes
JavaScript flow Yes Yes
JavaScript eslint-language-server Yes Yes
JavaScript biome Yes Yes
Julia LanguageServer.jl Yes No
Kotlin kotlin-language-server Yes Yes
Lisp cl-lsp Yes No
Lua emmylua-ls Yes Yes
Lua sumneko-lua-language-server Yes Yes
Markdown (remark) remark-language-server Yes Yes
Markdown Marksman Yes Yes
Nim nimls No No
Nix nixd Yes Yes
Nix rnix-lsp Yes Yes
PHP intelephense Yes Yes
PHP psalm-language-server Yes Yes
OCaml ocaml-lsp UNIX Only Yes
Protobuf bufls Yes Yes
Puppet puppet-languageserver Yes Yes
PureScript purescript-language-server Yes Yes
Python pyls-all (pyls with dependencies) Yes Yes
Python pyls (pyls without dependencies) Yes Yes
Python pyls-ms (Microsoft Version) Yes Yes
Python jedi-language-server Yes Yes
Python pyright-langserver Yes Yes
Python pylsp-all (pylsp with dependencies) Yes Yes
Python pylsp (pylsp without dependencies) Yes Yes
Python ruff-lsp Yes Yes
Prisma prisma-language-server Yes Yes
R languageserver Yes No
Racket racket-lsp Yes No
Reason reason-language-server Yes Yes
Ruby ruby-lsp UNIX Only Yes
Ruby solargraph Yes Yes
Ruby steep Yes Yes
Ruby typeprof Yes Yes
Ruby rubocop (lsp mode) Yes No
Ruby sorbet Yes No
Rust rls Yes No
Rust rust-analyzer Yes Yes
Sphinx esbonio Yes Yes
SQL sql-language-server Yes Yes
SQL sqls Yes Yes
SQL plpgsql-server UNIX Only Yes
Scala Metals Yes Yes
Svelte svelte-language-server Yes Yes
Svelte tailwindcss-intellisense Yes Yes
Svelte biome Yes Yes
Swift sourcekit-lsp Yes No
SystemVerilog verible-verilog-ls UNIX Only Yes
SystemVerilog svls Yes Yes
TeX texlab Yes Yes
TeX digestif Yes No
Terraform terraform-lsp Yes Yes
Terraform terraform-ls Yes Yes
TOML taplo-lsp No Yes
TTCN-3 ntt Yes Yes
TypeScript typescript-language-server Yes Yes
TypeScript deno Yes Yes
TypeScript rome Yes Yes
TypeScript eslint-language-server Yes Yes
TypeScript biome Yes Yes
Typst typst-lsp Yes Yes
Vim vim-language-server Yes Yes
Vala vala-language-server No No
Verilog verible-verilog-ls UNIX Only Yes
Veryl veryl-ls Yes Yes
Vue volar-server (Vue Language Tools) Yes Yes
Vue vls Yes Yes
Vue biome Yes Yes
V v-analyzer Yes Yes
V vlang-vls Yes Yes
XML lemminx Yes Yes
YAML yaml-language-server Yes Yes
ZIG zls Yes Yes
* efm-langserver Yes Yes

Notes

clangd (C/C++)

There is a Linux OS/version that does not run the locally installed clangd due to zlib version mismatch. If you want to use clangd, please install clangd on your system.

rls (Rust)

If you installed rls already, you can use rls without configurations. But if you have not installed rls yet, you can install it by following these instructions.

deno (TypeScript)

To use deno, deno.json(c) should located on the project directory or traversing the filesystem upwards.

If deno.json does not located, node_modules should not located on the project directory or traversing the filesystem upwards.

When editing Node projects, the following warning message is shown.

server "deno" is disabled since "node_modules" is found

If you want to disable warning message, you may put .vim-lsp-settings/settings.json in your project root directory.

{
  "deno": {
    "disabled": true
  }
}

To use importMap, default file name is import_map.json.

If you don't want to use import_map.json, you may put .vim-lsp-settings/settings.json in your project root directory and set importMap whatever you want.

{
  "deno": {
    "initialization_options": {
      "enable": true,
      "lint": true,
      "unstable": true,
      "importMap": "your_own_import_map.json"
    }
  }
}

Recommend to add let g:markdown_fenced_languages = ['ts=typescript'] to your vimrc for hover(preview) Deno's library.

Note that deno language server is specified.

let g:lsp_settings_filetype_typescript = ['typescript-language-server', 'eslint-language-server', 'deno']

flow (JavaScript)

To use flow, the .flowconfig has to be located on the top of project directory.

graphql-language-service-cli(GraphQL)

To use graphql-language-service-cli, the GraphQL Config has to be located on the top of project directory. The schema must be pointed to the schema file correctly.

{
  "schema": "./schema.graphql"
}

gql-language-server (GraphQL)

To use gql-language-server, the .gqlconfig has to be located on the top of project directory. The schema must be pointed to the schema file correctly.

{
  schema: {
    files: 'path/to/schema.graphql'
  }
}

Finally, you have to install @playlyfe/gql into your project.

$ npm install @playlyfe/gql --save-dev

If you have a separate existing installation of the dart analysis server and want it to be used, it must either exist in your path, or you must specify its location. See 'Configurations' below.

If you installed hie with stack, you can use hie without configurations. But if you have not installed hie yet, you can install it by following these steps.

To use older version golangci-lint, please run :LspSettingsGlobalEdit and put bellow configuration.

"golangci-lint-langserver": {
    "initialization_options": {
        "command": [
            "golangci-lint", "run", "--enable-all", "--disable", "lll", "--out-format", "json"
        ]
    }
}

To use rubocop-lsp-mode, you need to install rubocop in your Ruby project using bundler.

To use sorbet, you need to install rubocop in your Ruby project using bundler. Also, Watchman is required to watch file changes. For more details, please see Sorbet and Watchman documentations.

To enable full Vue support, both typescript-language-server and volar-server should be installed and enabled in vue filetype.

let g:lsp_settings_filetype_vue = ['typescript-language-server', 'volar-server']

Extra Configurations

Most of the configurations are not required.

If you installed clangd already, you can use clangd for C/C++ without any configuration. But if you installed clang with the name clangd-6.0, you can replace executable with the following config:

let g:lsp_settings = {
\  'clangd': {'cmd': ['clangd-6.0']},
\  'efm-langserver': {'disabled': v:false}
\}

Or put .vim-lsp-settings/settings.json in your project root directory.

{
  "clangd": {
    "cmd": ["clangd-6.0"]
  },
  "efm-langserver": {
    "disabled": false
  }
}

If you already have the dart analysis server installed but it is not in your path, you can still configure the settings to use it. Use the vimscript below to change the command to start the server. Note the command has two parts: the path to your 'dart' executable, and a subcommand 'language-server.

let g:lsp_settings = {
    \ 'analysis-server-dart-snapshot': {
    \     'cmd': [
    \         '/path/to/your/dart-sdk/bin/dart',
    \         'language-server'
    \     ],
    \ },
\ }

To edit the project local settings.json, do :LspSettingsLocalEdit.

Overridable keys are:

  • cmd (List ex: ['clangd-6.0', '-enable-snippets'])
  • initialization_options (Dictionary)
  • allowlist (List)
  • blocklist (List)
  • config (Dictionary)
  • workspace_config (Dictionary)
  • disabled (Boolean)
  • root_uri (String)
  • root_uri_patterns (List)
  • semantic_highlight (Dictionary)

If you have some Language Servers and want to use specified the server:

let g:lsp_settings_filetype_perl = 'slp'
let g:lsp_settings_filetype_html = ['html-languageserver', 'angular-language-server']
let g:lsp_settings_filetype_typescript = ['typescript-language-server', 'eslint-language-server']

When the servers are specified in a list, these will all be started.

If you want to configure Language Server to use flake8 rather than pycodestyle, the following can be added to your ~/.vimrc file. Note that pylsp-all was the automatically registered server name. Check with :LspStatus.

let g:lsp_settings = {
\   'pylsp-all': {
\     'workspace_config': {
\       'pylsp': {
\         'configurationSources': ['flake8']
\       }
\     }
\   },
\}

If you want to disable a Language Server:

let g:lsp_settings = {
\  'perl-languageserver': {
\    'disabled': 1,
\   }
\}

When resolving the root directory for a language server, this plugin will look for directories containing special root markers defined in g:lsp_settings_root_markers.

By default, this is set to:

let g:lsp_settings_root_markers = [
\   '.git',
\   '.git/',
\   '.svn',
\   '.hg',
\   '.bzr'
\ ]

If you need to specify alternative root markers:

let g:lsp_settings_root_markers = ['.projections.json', '.git', '.git/']

This would look for a custom .projections.json, a git submodule .git or a git root .git/ starting from the current directory upwards.

License

MIT

Author

Yasuhiro Matsumoto (a.k.a. mattn)

vim-lsp-settings's People

Contributors

4513echo avatar aiotter avatar brentyi avatar dalance avatar heavenshell avatar idbrii avatar itchyny avatar johejo avatar kiyugadgeter avatar kjuq avatar kkiyama117 avatar klarkc avatar mattn avatar milly avatar pojiro avatar prabirshrestha avatar sakuraiyuta avatar sgur avatar thinca avatar thomasfaingnaert avatar tksgi avatar tminamiii avatar tsukkee avatar tsuyoshicho avatar tyru avatar wingyplus avatar wordijp avatar xuanduc987 avatar yaegassy avatar yuilib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vim-lsp-settings's Issues

pyls_ms errors

I have successfully installed pyls_ms on win 10 (at least there were no errors).

But when I open python file I get following error:

image

and LspStatus shows:
image

after :e I get:

image

PS, thx for adding pyls_ms!

I can get this to work

When I run :LspInstallServer typescript-language-server, it responds with server not found (I tried different ones: rls, vim, etc).
If I run :LspInstallServer without arguments, then it goes and fetches efm-langserver and installs it.
Am I doing something wrong?
Thanks.

clangd installer leaves unnecessary files under repository

After :LspInstallServer of clangd.
I run git status on this plugin repository, it shows

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        installer/bin/
        installer/clangd
        installer/include/
        installer/lib/
        installer/libexec/
        installer/share/

Error when running :LspInstallServer

I got the following error when I tried LspInstallServer in a fresh environment with d7353a2

/home/hnakamur/.vim/plugged/vim-lsp-settings/settings/gopls.vim
Error detected while processing /home/hnakamur/.vim/plugged/vim-lsp-settings/settings/gopls.vim:
line     12:
E492: Not an editor command:   LspRegisterServer { ...(snip)...

image

~/.vimrc

call plug#begin('~/.vim/plugged')
Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp'
Plug 'mattn/vim-lsp-settings'
call plug#end()

clangd install failed on debian 10 (./clangd: error while loading shared libraries: libz3.so.4.8: cannot open shared object file: No such file or directory)

I test install libz3-dev, but it can't work also.

:LspInstallServer
mkdir: cannot create directory ‘../servers/clangd’: No such file or directory
  2 Downloading clangd and LLVM...
  3   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  4                                  Dload  Upload   Total   Spent    Left  Speed
  5 100  383M  100  383M    0     0  1222k      0  0:05:21  0:05:21 --:--:-- 1330k
  6 Extracting archive...
  7 ./clangd: error while loading shared libraries: libz3.so.4.8: cannot open shared object file: No such file or directory

Work with dein, need merged = 0

Please below mean text append to README.

If you use plugin manager that is plugin merging work(ex dein),
Please setting merging work stop (ex dein / merged = 0).

reason:
Server installed in ../servers directory at cache area.
But when rebuild cache timing, any merging plugin manager erase before installed files(include ../servers).

unzip unrecognized on windows

Windows doesn't ship with unzip but it ships with tar.exe - https://docs.microsoft.com/en-us/virtualization/community/team-blog/2017/20171219-tar-and-curl-come-to-windows

Unfortunately omnisharp doesn't seem to have tar.

Might be good to have check for unzip and if it doesn't exist using powershell to extract.

https://github.com/prabirshrestha/vim-lsp/blob/e4422f660b492aa8263eb46a38ed95e456f78112/.github/workflows/windows_vim.yml#L42

Powershell might requires signed scripts so it should still perfer unzip.exe over powershell unzip.

[RFC] Change location of default servers directory

Currently, vim-lsp-settings install servers into servers sub-directory. This is useful for me to check behavior of installers. But some users want to change the location. As you know, lsp_settings_servers_dir can use to change the location of servers directory.
Now I'm going to change the default location to other. So I hope to hear anyone's opinion. My suggestion is:

On UNIX, the location is $HOME/.config/lsp-servers, On Windows, %APPDATA%\lsp-servers. What do you think?

Installer scripts are not working if bash does not exists on /bin/bash

Hi,

Some Language server installer scripts for unix-like environemt are using hard-coded /bin/bash in shebang, but it's not working if bash does not exists /bin/bash.

For examples, I'm using NixOS Linux and NixOS does not have executable binary on /bin or /usr/bin, that has executable binary on /run/current-system/sw/bin.

I also think that another case, if vim-lsp-settings users does not installed bash, that case is also not working by /bin/bash does not exists.

So I think that installer scripts should not use hard-coded /bin/bash, I suggest shebang of installer scripts are changes to /usr/bin/env sh or /bin/sh.

Or another suggestion, it's configurable by vimrc about execute shell for installer scripts.

Dart: run_unzip command is not recognized

Win10, gvim8.2.147

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  201M  100  201M    0     0  5587k      0  0:00:37  0:00:37 --:--:-- 5371k
'run_unzip.cmd' is not recognized as an internal or external command,
operable program or batch file.

image

error: invalid command 'bdist_wheel' when install pyls

but after install , pyls can work, Does this error have any effect ?

  Running setup.py bdist_wheel for future ... error
  Complete output from command /home/fcying/.vim/.cache/lsp_settings/pyls/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-laf3r_xx/future/setup.py';f=getattr(tokenize, 'open', op
en)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-3vshusay --python-tag cp37:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for future
  Running setup.py clean for future
Failed to build future
Installing collected packages: ujson, parso, jedi, more-itertools, zipp, importlib-metadata, pluggy, future, python-jsonrpc-server, python-language-server
  Running setup.py install for future ... done
Successfully installed future-0.18.2 importlib-metadata-1.3.0 jedi-0.15.2 more-itertools-8.0.2 parso-0.5.2 pluggy-0.13.1 python-jsonrpc-server-0.3.2 python-language-server-0.31.4 ujson-1.35 zipp-0.6.0

lsp4xml format options not working

Using the below settings with the lsp4xml server does not seem to be working correctly. Looking at the logs it looks like the true/false values are wrapped in quotes (which is necessary in the vim setting) but the quotes should be removed when passed to the server. That is my guess at least.

    let g:lsp_settings = {
    \  'lsp4xml':{
    \    'initialization_options':{
    \       'settings':{
    \         'format': {
    \           'splitAttributes': 'true',
    \           'spaceBeforeEmptyCloseTag':'false',
    \         }
    \       }
    \    }
    \  },
    \}

:LspInstallServer fail for filetype : 'Dockerfile'

Error:

Dockerfile open, then type :LspInstallServer and error occured.

function <SNR>61_vimlsp_install_server の処理中にエラーが検出されました:
行    2:
E684: リストのインデックスが範囲外です: 1

Reason:

Currently, filetype check using settings.json's filetype key name.

  • Setting : dockerfile
  • Vim detect and set type : Dockerfile
vimlsp_suggest_dockerfile  FileType
    dockerfile
              call s:vimlsp_load_or_suggest( 'dockerfile' )

set filetype?
  filetype=Dockerfile

Vim autocmd run and suggest, but :LspInstallServer do not work above reason.

Solution:

  1. json key tune up vim filetype leagal case and capital.
  2. filetype ignore case search(usual normalize lowercase? settings and code)

function! s:vimlsp_installer() abort
let l:ft = split(&filetype, '\.')[0]

(do not keysetting use, use current filetype directly.)

Win10: pyls-ms doesn't work

Today I have updated plugin and suddenly pyls-ms doesn't start for the same file it worked yesterday #117 (comment).

Now LspStatus doesn't show anything, and none of the commands work.

Override root_uri with lambda

Outside of modifying g:lsp_settings_root_markers which changes the root_uri for all LSPs. It would be nice to be able to provide a lambda function or a list of root markers to dynamically find the root_uri. Similar to what you can do with vanilla vim-lsp.

lambda

let g:lsp_settings = {
      \ 'pyls-ms': {
      \   'root_uri': {server_info->lsp#utils#path_to_uri(
      \       lsp#utils#find_nearest_parent_file_directory(
      \           lsp#utils#get_buffer_path(), [
      \             'setup.py',
      \             'setup.cfg',
      \             'pyproject.toml',
      \             'requirements.txt',
      \             '.git/'
      \          ]))},
      \ },
      \}

array

In order, try to find the nearest parent file directory.

let g:lsp_settings = {
      \ 'pyls-ms': {
      \   'root_uri': [
      \     'setup.py',
      \     'setup.cfg',
      \     'pyproject.toml',
      \     'requirements.txt',
      \     '.git/'
      \   ],
      \ },
      \}

Or maybe I'm just missing something?

clangd installer tries to mkdir ../servers/clangd when `g:lsp_settings_servers_dir` is not default

I write this config in my vimrc.

let g:lsp_settings_servers_dir = expand('~/.cache/vim-lsp-settings/servers')

Despite of that, clangd installer tries to create directory under <this repository>/servers/clangd/

mkdir: cannot create directory ‘../servers/clangd’: No such file or directory

But installation succeeded.
The problem is that unnecessary mkdir and caused error above.

g:lsp_settings_servers_dir was created but it was empty 😢

What is expected gopls setup?

Struggle to make go language server work in my environment (Win10, latest vim/neovim).

  1. I have installed gopls with LspInstallServer
  2. Open random test.go file with hello world:
package main

import "fmt"

func main() {
	fmt.Println("Hello World!)
}
  1. LspStatus shows nothing, No autocompletion, looks like server is not running.
  2. Log:
08.02.2020 18:51:45:["vim-lsp signs enabled"]
08.02.2020 18:51:45:["vim-lsp highlighting enabled (textprop)"]
08.02.2020 18:51:45:["s:on_text_document_did_open()",1,"txt","C:\\Users\\maksim.kim\\scoop\\apps\\vim-nightly\\current",""]
08.02.2020 18:51:49:["s:on_text_document_did_close()",3]
08.02.2020 18:51:49:["s:on_text_document_did_open()",1,"go","C:\\Users\\maksim.kim\\scoop\\apps\\vim-nightly\\current","file:///C:/Users/maksim.kim/projects/test.go"]
08.02.2020 18:51:53:["s:on_text_document_did_change()",3]
08.02.2020 18:51:53:["s:send_didchange_queue() will be triggered"]
08.02.2020 18:51:57:["s:send_event_queue()"]
08.02.2020 18:52:02:["s:on_text_document_did_close()",3]

Probably I miss something crucial?

PS,

After that I have also created root marker (.git folder) and go.mod file -- still nothing works.

enable autoformat and auto import for gopls

Seems like gopls should support autoimport. Need to wait for this PR to land in vim-lsp. prabirshrestha/vim-lsp#637 (comment). It should also support auto format on save.

Related issues:
microsoft/vscode-go#2476 (comment)
golang/go#31977
golang/go#34115

gopls help
The Go Language source tools.

Usage: gopls [flags] <command> [command-flags] [command-args]

gopls is a Go language server. It is typically used with an editor to provide
language features. When no command is specified, gopls will default to the 'serve'
command. The language features can also be accessed via the gopls command-line interface.

Available commands are:

main:
  serve : run a server for Go code using the Language Server Protocol
  version : print the gopls version information
  bug : report a bug in gopls

features:
  check : show diagnostic results for the specified file
  folding_ranges : display selected file's folding ranges
  format : format the code according to the go standard
  highlight : display selected identifier's highlights
  implementation : display selected identifier's implementation
  imports : updates import statements
  links : list links in a file
  query : answer queries about go source code
  references : display selected identifier's references
  rename : rename selected identifier
  signature : display selected identifier's signature
  fix : apply suggested fixes
  symbols : display selected file's symbols

gopls flags are:
  -debug string
        serve debug information on the supplied address
  -listen string
        address on which to listen for remote connections
  -logfile string
        filename to log to. if value is "auto", then logging to a default output file is enabled
  -mode string
        no effect
  -ocagent string
        the address of the ocagent, or off (default "off")
  -port int
        port on which to run gopls for debugging purposes
  -profile.cpu string
        write CPU profile to this file
  -profile.mem string
        write memory profile to this file
  -profile.trace string
        write trace log to this file
  -remote string
        *EXPERIMENTAL* - forward all commands to a remote lsp
  -rpc.trace
        print the full rpc trace in lsp inspector format
  -v    verbose output

Hook to set lsp settings for current buffer

Is there a way to set buffer local options only for buffers which have an lsp server running for them?
This is useful to set omnifunc, keywordprg, map keys, ... for lsp buffers, but fall back to default if the server is not installed.

At the moment, I'm using if executable(...) ..., but of course, that won't work with LSP servers installed with vim-lsp-settings.

Maybe we can add an autocmd that is run whenever a language server is registered for the current buffer?

s:vimlsp_installer() will return null list, occur error in s:vimlsp_install_server()

function! s:vimlsp_installer() abort

It will return [].

Then

If you want to enable Language Server, please do :LspInstallServer
function <SNR>61_vimlsp_install_server の処理中にエラーが検出されました:
行    2:
E684: リストのインデックスが範囲外です: 1

Reason:

Open GitHub action YAML file, suggest install server.
But plugin https://github.com/yasuhiroki/github-actions-yaml.vim is activating.
Filetype change to yaml.gha

Key search in s:vimlsp_installer

function! s:vimlsp_installer() abort
  if !has_key(s:settings, &filetype)
    return []
  endif

This will return [].

Error occurred.

Suggest at resolve:

  1. Fix subtype check
  2. s:vimlsp_installer return null list check process add.

feature: auto run LspInstallServer

Can it add a option, if there have not lsp server, run LspInstallServer.
Or echo a message, not jump error.

Current version, When pyls is not installed, vim test.py, will jump a error.

Error detected while processing function lsp#enable[19]..<SNR>78_register_events[17]..<SNR>78_on_text_document_did_open[5]..<SNR>78_ensure_flush[1]..lsp#utils#step#start[1]..<SNR>99_next[9]..<lambda>5[1]..<SNR
>78_ensure_start[47]..<SNR>99_callback[1]..<SNR>99_next[9]..<lambda>6[1]..<SNR>78_ensure_init[57]..<SNR>78_send_request[7]..lsp#client#send_request[1]..<SNR>100_lsp_send[36]..async#job#send[1]..<SNR>101_job_se
nd:
line    6:
E631: ch_sendraw(): write failed

Suggestion improve: "npm install" do no install optional, but error do not resolve

Try latest settings in windows.

Happen

bash-language-server depends fsevents.
But fsevents only depend mac, also windows/linux OPTIONAL DEPENDENCY)

now windows occur error

Failed to initialize bash-language-server with error -32603: Request initialize failed with message: EPERM: operation not permitted, scandir 'C:\Users\MyName\Application Data'

Suggestion

Change to below:

npm install --no-optional

see rel info

It do not install optional package

Pros and Cons

Pros:

  • do no occur error in Windows/Linux
  • minimize server install

Cons:

  • nothing?

Result

I try it, but not resolved... 😢

pyls intstallation fails on win10

I get "The system cannot find the path specified"

image

PS, vim language server and ruby solargraph were successfully installed.

Thank you for this really convenient plugin!

Clangd diagnostics can't include stl headers on Mac

I have installed clangd with :LspInstallServer but the diagnostic throws errors when I include any standard library files.
#include <string> results in:

main.cpp|1 col 10| clang:Error:pp_file_not_found:In included file: 'string.h' file not found /Users/maciej/.vim/bundle/vim-lsp-settings/servers/clangd/bin/../include/c++/v1/string.h:60:15: note: error     occurred here 

I took a look at the string in the .vim/bundle/vim-lsp-settings/servers/clangd/bin/../include/c++/v1/ and it fails at:

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <string.h>

with the diagnostics:

string.h|57 col 13| clang:Warning:-Wpragma-system-header-outside-header:#pragma system_header ignored in main file
string.h|57 col 13| clang:Warning:-Wpragma-system-header-outside-header:#pragma system_header ignored in main file
string.h|60 col 15| clang:Error:pp_including_mainfile_in_preamble:Main file cannot be included recursively when building a preamble

I am not sure whether it is my fault, something wrong with the vim-lip-settings or with the llvm code that is downloaded with the :LspInstallServer, but the c++ diagnostics doesn't work out of the box.

Also it results in very superficial autocompletion of stl, because the clangd can't parse the library and does not complete methods/members of classes.

eclipse.jdt.ls on mac not working

eclipse.jdt.ls on mac is not working correctly. this is because the command in the the installer file is not correct.

the command in the installer file is (notice the linux config):

java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -noverify -Xmx1G -javaagent:$DIR/lombok.jar -Xbootclasspath/a:$DIR/lombok.jar -jar $LAUNCHER -configuration $DIR/config_linux -data $DIR/data

in mac, the command should be

java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -noverify -Xmx1G -javaagent:$DIR/lombok.jar -Xbootclasspath/a:$DIR/lombok.jar -jar $LAUNCHER -configuration $DIR/config_mac -data $DIR/data

My suggestion would be that this can be fixed by doing something like:

set -e

curl -o jdt-language-server-latest.tar.gz 'http://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz'
curl -o lombok.jar 'https://projectlombok.org/downloads/lombok.jar'
tar xvf jdt-language-server-latest.tar.gz
rm jdt-language-server-latest.tar.gz

cat <<EOF > eclipse-jdt-ls
#!/bin/sh

osType="\$(uname -s)"
case "\${osType}" in
    Darwin*)    configDir=config_mac;;
    Linux*)     configDir=config_linux;;
    *)          configDir=config_linux
esac

DIR=\$(cd \$(dirname \$0); pwd)
LAUNCHER=\$(ls \$DIR/plugins/org.eclipse.equinox.launcher_*.jar)
java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -noverify -Xmx1G -javaagent:\$DIR/lombok.jar -Xbootclasspath/a:\$DIR/lombok.jar -jar \$LAUNCHER -configuration \$DIR/\$configDir -data \$DIR/data
EOF

chmod +x eclipse-jdt-ls

typescriptreact file is not recognized on typescript-language-server

works (only vim-lsp)

if executable('typescript-language-server')
  au User lsp_setup call lsp#register_server({
        \ 'name': 'typescript-language-server',
        \ 'cmd': {server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']},
        \ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'tsconfig.json'))},
        \ 'whitelist': ['typescript', 'typescriptreact'],
        \ })
endif

not works(LSP is installed by vim-lsp-settings)

let g:lsp_settings = {'typescript-language-server':{'whitelist': ['typescript', 'typescriptreact']}}

but after typescript file opened, LSP run successfully on typescriptreact file.

Link to prabirshrestha/vim-lsp may be helpful in README.md

Hi.
I read the article in Qiita: https://qiita.com/mattn/items/e62b9f16bc487a271a7f and just started to use this plugin.

Thank you for the plugin! It's completely useful to me.

When I installed vim-lsp-settings without installing vim-lsp, of course, running LspInstallServer failed.

User Autocommands for "lsp_setup" の処理中にエラーが検出されました:
E117: 未知の関数です: lsp#register_server
E117: 未知の関数です: lsp#register_server

I think some instructions for installing vim-lsp in README.md may be helpful.

Failed to LspInstallServer

Calling :LspInstallServer, I got error messages.

flag provided but not defined: -upgolang.org/x/tools/gopls@latest
usage: go get [-d] [-m] [-u] [-v] [-insecure] [build flags] [packages]
Run 'go help get' for details.
$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 12 2019 16:52:17)
macOS 版
Compiled by Homebrew
Huge 版 without GUI.  機能の一覧 有効(+)/無効(-)
+acl               -farsi             -mouse_sysmouse    -tag_old_static
+arabic            +file_in_path      +mouse_urxvt       -tag_any_white
+autocmd           +find_in_path      +mouse_xterm       -tcl
+autochdir         +float             +multi_byte        +termguicolors
-autoservername    +folding           +multi_lang        +terminal
-balloon_eval      -footer            -mzscheme          +terminfo
+balloon_eval_term +fork()            +netbeans_intg     +termresponse
-browse            +gettext           +num64             +textobjects
++builtin_terms    -hangul_input      +packages          +textprop
+byte_offset       +iconv             +path_extra        +timers
+channel           +insert_expand     +perl              +title
+cindent           +job               +persistent_undo   -toolbar
-clientserver      +jumplist          +popupwin          +user_commands
+clipboard         +keymap            +postscript        +vartabs
+cmdline_compl     +lambda            +printer           +vertsplit
+cmdline_hist      +langmap           +profile           +virtualedit
+cmdline_info      +libcall           -python            +visual
+comments          +linebreak         +python3           +visualextra
+conceal           +lispindent        +quickfix          +viminfo
+cryptv            +listcmds          +reltime           +vreplace
+cscope            +localmap          +rightleft         +wildignore
+cursorbind        +lua               +ruby              +wildmenu
+cursorshape       +menu              +scrollbind        +windows
+dialog_con        +mksession         +signs             +writebackup
+diff              +modify_fname      +smartindent       -X11
+digraphs          +mouse             -sound             -xfontset
-dnd               -mouseshape        +spell             -xim
-ebcdic            +mouse_dec         +startuptime       -xpm
+emacs_tags        -mouse_gpm         +statusline        -xsmp
+eval              -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+ex_extra          +mouse_netterm     +syntax            -xterm_save
+extra_search      +mouse_sgr         +tag_binary        
      システム vimrc: "$VIM/vimrc"
      ユーザー vimrc: "$HOME/.vimrc"
   第2ユーザー vimrc: "~/.vim/vimrc"
       ユーザー exrc: "$HOME/.exrc"
  デフォルトファイル: "$VIMRUNTIME/defaults.vim"
       省略時の $VIM: "/usr/local/share/vim"
コンパイル: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X -DMACOS_X_DARWIN  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1       
リンク: clang   -L. -fstack-protector-strong -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/[email protected]/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -lintl -framework AppKit  -L/usr/local/opt/lua/lib -llua5.3 -mmacosx-version-min=10.15 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.30.0/lib/perl5/5.30.0/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc  -L/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/config-3.7m-darwin -lpython3.7m -framework CoreFoundation  -lruby.2.6
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kyoh86/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/kyoh86/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/y8/4b8kv6r967jdyxxf8q797njr0000gn/T/go-build263071742=/tmp/go-build -gno-record-gcc-switches -fno-common"
$ go version
go version go1.12.14 darwin/amd64

feature: support project tsserver

The tsserver version used by the project often differs each.
The version of typescript used in create-react-app, angular-cli, etc. is different from the version installed by install-typescript-language-server.sh.

Need to be improved to find root_uri/node_modules/.bin/tsserver.

\ 'cmd': {server_info->lsp_settings#get('typescript-language-server', 'cmd', [lsp_settings#exec_path('typescript-language-server'), '--stdio', '--tsserver-path', lsp_settings#exec_path('tsserver')])},

pyls installation of pip3 failed (windows10)

Win10
vim8.2.119

I have tried to reinstall pyls (after all plugins cleanup) and I get the following error:

C:\Users\maksim.kim\AppData\Local\Programs\Python\Python38\python.exe
C:\Users\maksim.kim\AppData\Local\Programs\Python\Python37\python.exe
C:\Users\maksim.kim\AppData\Local\Microsoft\WindowsApps\python.exe
C:\Users\maksim.kim\vimfiles\pack\minpac\start\vim-lsp-settings\servers\pyls\venv\Scripts\pip3.exe
Collecting pip
  Using cached https://files.pythonhosted.org/packages/00/b6/9cfa56b4081ad13874b0c6f96af8ce16cfbc1cb06bedf8e9164ce5551ec1/pip-19.3.1-py2.py3-none-
any.whl
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\maksim.kim\\AppData\\Local\\Temp\\pip-uni
nstall-u_s3s5le\\pip3.exe'
Consider using the `--user` option or check the permissions.

Collecting python-language-server
  Using cached https://files.pythonhosted.org/packages/7a/4f/38e322cfcfb04ef4c8b3be731aed773bba2ea5980f6e9a06e698de342026/python-language-server-0
.31.4.tar.gz
Collecting jedi<0.16,>=0.14.1
  Using cached https://files.pythonhosted.org/packages/e9/97/55e575a5b49e5c3df9eb3c116c61021d7badf556c816be13bbd7baf55234/jedi-0.15.2-py2.py3-none
-any.whl
Collecting python-jsonrpc-server>=0.3.2
  Using cached https://files.pythonhosted.org/packages/44/18/8a34b201ea1c556fc17a297c216ae859d5eef664e914cc60d37c8f6f6d1b/python-jsonrpc-server-0.
3.2.tar.gz
Collecting pluggy
  Using cached https://files.pythonhosted.org/packages/a0/28/85c7aa31b80d150b772fbe4a229487bc6644da9ccb7e427dd8cc60cb8a62/pluggy-0.13.1-py2.py3-no
ne-any.whl
Collecting parso>=0.5.2
  Using cached https://files.pythonhosted.org/packages/9b/b0/90353a5ece0987279837835224dead0c424833a224195683e188d384e06b/parso-0.5.2-py2.py3-none
-any.whl
Collecting future>=0.14.0
  Using cached https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
Installing collected packages: parso, jedi, future, python-jsonrpc-server, pluggy, python-language-server
    Running setup.py install for future ... done
    Running setup.py install for python-jsonrpc-server ... done
    Running setup.py install for python-language-server ... done
Successfully installed future-0.18.2 jedi-0.15.2 parso-0.5.2 pluggy-0.13.1 python-jsonrpc-server-0.3.2 python-language-server-0.31.4

NOTE: server itself works as far as I can see.

:LspUninstallServer

I wrongly installed javascript-typescript-langserver, but for filetype=javasript (and filetype=typescript), I want to use typescript-language-server.
I want to just remove javascript-typescript-langserver server and config.

:LspInstallServer not an editor command

I have all required plugins installed, but when issue LspInstallServer I got the error not an editor command.

Archlinux / vim-git latest (via aur), install plugin using native vim8 method

./clangd: /usr/lib/libtinfo.so.6: no version information available (required by ./clangd)

I can't able to make clangd install properly with :LspInstallServer on c sourcefile:

/usr/bin/lsb_release
Downloading clangd and LLVM...
hello
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  383M  100  383M    0     0  2965k      0  0:02:12  0:02:12 --:--:-- 3658k
./clangd: /usr/lib/libtinfo.so.6: no version information available (required by ./clangd)
clangd version 9.0.0 (https://github.com/llvm/llvm-project.git fe6dbadc0d53efdc34c096dd1695f23467ea6591)
ldd ./clangd
./clangd: /usr/lib/libtinfo.so.6: no version information available (required by ./clangd)
        linux-vdso.so.1 (0x00007ffe347c4000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f6fcc9e8000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f6fcc9ce000)
        librt.so.1 => /usr/lib/librt.so.1 (0x00007f6fcc9c3000)
        libdl.so.2 => /usr/lib/libdl.so.2 (0x00007f6fcc9be000)
        libtinfo.so.6 => /usr/lib/libtinfo.so.6 (0x00007f6fcc94f000)
        libm.so.6 => /usr/lib/libm.so.6 (0x00007f6fcc809000)
        libz3.so.4.8 => not found
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f6fcc61d000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f6fcc603000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f6fcc43c000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f6fcca2c000)
pacman -Q | grep ncurses
ncurses 6.1-7
ls -l /usr/lib/libtinfo.so.6
lrwxrwxrwx 1 root root 16 Nov 13 17:53 /usr/lib/libtinfo.so.6 -> libncursesw.so.6*

vim-lsp throws Error when opening file and gopls not working

When I open .go file, lsp throws an error.

Error detected while processing function lsp#enable[19]..<SNR>44_register_events[17]..<SNR>44_on_text_document_did_open[5]..<SNR>44_ensure_flush[1]..lsp#ut
ils#step#start[1]..<SNR>54_next[9]..<lambda>3[1]..<SNR>44_ensure_start[35]..lsp#client#start[1]..<SNR>55_lsp_start[5]..async#job#start[1]..<SNR>56_job_star
t:
line   62:
E474: Invalid argument

I thought it relate to #19, so I did :LspInstallServer and it seems failed to setup gopls and :LspStatus says

gopls: not running

the output of :LspInstallServer

  1 go: finding golang.org/x/tools/gopls v0.2.2
  2 go: finding golang.org/x/tools latest
  3 go: finding golang.org/x/xerrors latest
  4 go: finding golang.org/x/sync latest
  5 go: finding github.com/BurntSushi/toml v0.3.1
  6 go: finding honnef.co/go/tools v0.0.1-2019.2.3
  7 go: finding github.com/sergi/go-diff v1.1.0
  8 go: finding golang.org/x/mod v0.1.0
  9 go: finding golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee
 10 golang.org/x/tools/gopls/internal/hooks
 11 # golang.org/x/tools/gopls/internal/hooks
 12 pkg/mod/golang.org/x/tools/[email protected]/internal/hooks/analysis.go:17:30: first argument to append must be slice; have map[string]*analysis.Analyzer
 13 pkg/mod/golang.org/x/tools/[email protected]/internal/hooks/analysis.go:20:30: first argument to append must be slice; have map[string]*analysis.Analyzer
 14 pkg/mod/golang.org/x/tools/[email protected]/internal/hooks/analysis.go:23:30: first argument to append must be slice; have map[string]*analysis.Analyzer

However, gopls seems installed successfully because there is a gopls directory on $HOME/.vim/plugged/vim-lsp-settings/servers.

Vim version:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan  6 2020 00:32:39)
macOS version
Included patches: 1-50
Compiled by Homebrew

gopls version:

golang.org/x/tools/gopls 0.2.2
    golang.org/x/tools/[email protected] h1:ujGisyytgY1VGcmd66wIJ9+wVAfmodXj6daHM43HRXk=

Yaml: server not found

I open a .yaml file and issue :LspInstallServer but vim returns "Server not found" message.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.