From: Ubaldo Tiberi Date: Sat, 20 May 2023 18:44:31 +0000 (+0200) Subject: removed quotes in dicts key and backslashes for new lines X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=64782d7b22ef8bfce91b0537561059570b538e5f;p=vim-lsp.git removed quotes in dicts key and backslashes for new lines --- diff --git a/README.md b/README.md index fa1faaf..b67accb 100644 --- a/README.md +++ b/README.md @@ -56,37 +56,37 @@ vim9script # Clangd language server call LspAddServer([{ - \ 'name': 'clangd', - \ 'filetype': ['c', 'cpp'], - \ 'path': '/usr/local/bin/clangd', - \ 'args': ['--background-index'] - \ }]) + name: 'clangd', + filetype: ['c', 'cpp'], + path: '/usr/local/bin/clangd', + args: ['--background-index'] + }]) # Javascript/Typescript language server call LspAddServer([{ - \ 'name': 'typescriptlang', - \ 'filetype': ['javascript', 'typescript'], - \ 'path': '/usr/local/bin/typescript-language-server', - \ 'args': ['--stdio'], - \ }]) + name: 'typescriptlang', + filetype: ['javascript', 'typescript'], + path: '/usr/local/bin/typescript-language-server', + args: ['--stdio'], + }]) # Go language server call LspAddServer([{ - \ 'name': 'golang', - \ 'filetype': ['go', 'gomod'], - \ 'path': '/usr/local/bin/gopls', - \ 'args': ['serve'], - \ 'syncInit': v:true - \ }]) + name: 'golang', + filetype: ['go', 'gomod'], + path: '/usr/local/bin/gopls', + args: ['serve'], + syncInit: v:true + }]) # Rust language server call LspAddServer([{ - \ 'name': 'rustlang', - \ 'filetype': ['rust'], - \ 'path': '/usr/local/bin/rust-analyzer', - \ 'args': [], - \ 'syncInit': v:true - \ }]) + name: 'rustlang', + filetype: ['rust'], + path: '/usr/local/bin/rust-analyzer', + args: [], + syncInit: v:true + }]) ``` The above lines register the language servers for C/C++, Javascript/Typescript, Go and Rust file types. Refer to the [Wiki](https://github.com/yegappan/lsp/wiki) page for various language server specific configuration. @@ -108,13 +108,13 @@ If you used [vim-plug](https://github.com/junegunn/vim-plug) to install the LSP ```viml vim9script var lspServers = [ - \ { - \ 'name': 'clang', - \ 'filetype': ['c', 'cpp'], - \ 'path': '/usr/local/bin/clangd', - \ 'args': ['--background-index'] - \ } - \ ] + { + name: 'clang', + filetype: ['c', 'cpp'], + path: '/usr/local/bin/clangd', + args: ['--background-index'] + } + ] autocmd VimEnter * call LspAddServer(lspServers) var lspOpts = {'autoHighlightDiags': v:true} diff --git a/doc/lsp.txt b/doc/lsp.txt index 6688704..ef8223a 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -166,19 +166,19 @@ LSP plugin, the steps are described later in this section: > vim9script var lspServers = [ - \ { - \ 'name': 'typescriptls', - \ 'filetype': ['javascript', 'typescript'], - \ 'path': '/usr/local/bin/typescript-language-server', - \ 'args': ['--stdio'] - \ }, - \ { - \ 'name': 'pythonls', - \ 'filetype': 'python', - \ 'path': '/usr/local/bin/pyls', - \ 'args': ['--check-parent-process', '-v'] - \ } - \ ] + { + name: 'typescriptls', + filetype: ['javascript', 'typescript'], + path: '/usr/local/bin/typescript-language-server', + args: ['--stdio'] + }, + { + name: 'pythonls', + filetype: 'python', + path: '/usr/local/bin/pyls', + args: ['--check-parent-process', '-v'] + } + ] call LspAddServer(lspServers) < Depending on the location of the typescript and python pyls language servers @@ -190,49 +190,49 @@ Shell script, Vim script and PHP file types: > vim9script var lspServers = [ - \ { - \ 'name': 'clangd', - \ 'filetype': ['c', 'cpp'], - \ 'path': '/usr/local/bin/clangd', - \ 'args': ['--background-index'] - \ }, - \ { - \ 'name': 'golang', - \ 'filetype': ['go', 'gomod', 'gohtmltmpl', 'gotexttmpl'], - \ 'path': '/path/to/.go/bin/gopls', - \ 'args': [], - \ 'syncInit': v:true, - \ }, - \ { - \ 'name': 'rustls', - \ filetype': ['rust'], - \ 'path': '/path/to/.cargo/bin/rust-analyzer', - \ 'args': [], - \ 'syncInit': v:true, - \ }, - \ { - \ 'name': 'bashls', - \ 'filetype': 'sh', - \ 'path': '/usr/local/bin/bash-language-server', - \ 'args': ['start'] - \ }, - \ { - \ 'name': 'vimls', - \ 'filetype': ['vim'], - \ 'path': '/usr/local/bin/vim-language-server', - \ 'args': ['--stdio'] - \ }, - \ { - \ 'name': 'phpls', - \ 'filetype': ['php'], - \ 'path': '/usr/local/bin/intelephense', - \ 'args': ['--stdio'], - \ 'syncInit': v:true, - \ 'initializationOptions': { - \ 'licenceKey': 'xxxxxxxxxxxxxxx' - \ } - \ } - \ ] + { + name: 'clangd', + filetype: ['c', 'cpp'], + path: '/usr/local/bin/clangd', + args: ['--background-index'] + }, + { + name: 'golang', + filetype: ['go', 'gomod', 'gohtmltmpl', 'gotexttmpl'], + path: '/path/to/.go/bin/gopls', + args: [], + syncInit: v:true, + }, + { + name: 'rustls', + filetype: ['rust'], + path: '/path/to/.cargo/bin/rust-analyzer', + args: [], + syncInit: v:true, + }, + { + name: 'bashls', + filetype: 'sh', + path: '/usr/local/bin/bash-language-server', + args: ['start'] + }, + { + name: 'vimls', + filetype: ['vim'], + path: '/usr/local/bin/vim-language-server', + args: ['--stdio'] + }, + { + name: 'phpls', + filetype: ['php'], + path': '/usr/local/bin/intelephense', + args: ['--stdio'], + syncInit: v:true, + initializationOptions: { + licenceKey: 'xxxxxxxxxxxxxxx' + } + } + ] call LspAddServer(lspServers) < To add a language server, the following information is needed: @@ -356,13 +356,13 @@ server and to set the language server options. For example: > vim9script var lspServers = [ - \ { - \ 'name': 'clangd', - \ 'filetype': ['c', 'cpp'], - \ 'path': '/usr/local/bin/clangd', - \ 'args': ['--background-index'] - \ } - \ ] + { + name: 'clangd', + filetype: ['c', 'cpp'], + path: '/usr/local/bin/clangd', + args: ['--background-index'] + } + ] autocmd VimEnter * call LspAddServer(lspServers) var lspOpts = {'autoHighlightDiags': v:true} @@ -1050,13 +1050,13 @@ python: > vim9script var lspServers = [ - \ { - \ 'filetype': 'python', - \ 'omnicompl': v:false, - \ 'path': '/usr/local/bin/pyls', - \ 'args': ['--check-parent-process', '-v'] - \ } - \ ] + { + filetype: 'python', + omnicompl: v:false, + path: '/usr/local/bin/pyls', + args: ['--check-parent-process', '-v'] + } + ] < If you want to use omni completion, in addition to the automatic completion, then you can set the 'omnifunc' option to the "g:LspOmniFunc" function: >