]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Update help and readme
authorYegappan Lakshmanan <yegappan@yahoo.com>
Mon, 4 Jan 2021 04:44:46 +0000 (20:44 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Mon, 4 Jan 2021 04:44:46 +0000 (20:44 -0800)
README.md
autoload/lsp.vim
doc/lsp.txt
plugin/lsp.vim

index a19266f7095feab142c7b20b850ee238e9a8b00f..66a00f4702c4f2d56ef509b7a6b594c89fa0c88c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,3 +2,57 @@
 
 Language Server Protocol (LSP) plugin for Vim9.
 
+# Installation
+
+You can install this plugin directly from github using the following steps:
+
+```
+    $ mkdir -p $HOME/.vim/pack/downloads/lsp
+    $ cd $HOME/.vim/packa/downloads/lsp
+    $ git clone https://github.com/yegappan/lsp
+```
+
+or you can use any one of the Vim plugin managers (dein.vim, pathogen, vam,
+vim-plug, volt, Vundle, etc.) to install and manage this plugin.
+
+You will also need to install one or more language servers corresponding to the
+programming languages that you are using. Refer to the https://langserver.org/
+page for the list of available language servers.
+
+# Configuration
+
+To register a LSP server, add the following lines to your .vimrc file:
+```
+   let lspServers = [
+               \     {
+               \       'filetype': ['c', 'cpp'],
+               \       'path': '/usr/local/bin/clangd',
+               \       'args': ['--background-index']
+               \     },
+               \     {
+               \       'filetype': ['javascript', 'typescript'],
+               \       'path': '/usr/local/bin/typescript-language-server',
+               \       'args': ['--stdio']
+               \     }
+               \     {
+               \       'filetype': 'sh',
+               \       'path': '/usr/local/bin/bash-language-server',
+               \       'args': ['start']
+               \     },
+               \   ]
+   call lsp#addServer(lspServers)
+```
+
+The above lines add the LSP servers for C, C++, Javascript, Typescript and
+Shell script file types.
+
+To add a LSP server, the following information is needed:
+
+Field|Description
+-----|-----------
+filetype|One or more file types supported by the LSP server.  This can be a String or a List. To specify multiple multiple file types, use a List.
+path|complete path to the LSP server executable (without any arguments).
+args|a list of command-line arguments passed to the LSP server. Each argument is a separate List item.
+
+The LSP servers are added using the lsp#addServer() function. This function
+accepts a list of LSP servers with the above information.
index 2e799c8e3b356312a27a196e810219aa701d4f80..ff0cc964436691978b6a884c5f586a612b16d926 100644 (file)
@@ -615,7 +615,9 @@ def lsp#updateOutlineWindow(fname: string,
 
   :setlocal modifiable
   :silent! :%d _
-  setline(1, ['# File Outline', '# ' .. fname])
+  setline(1, ['# LSP Outline View',
+               '# ' .. fnamemodify(fname, ':t') .. ' ('
+                               .. fnamemodify(fname, ':h') .. ')'])
 
   # First two lines in the buffer display comment information
   var lnumMap: list<dict<any>> = [{}, {}]
@@ -710,6 +712,8 @@ enddef
 def s:outlineCleanup()
   # Remove the outline autocommands
   :silent! autocmd! LSPOutline
+
+  :silent! syntax clear LSPTitle
 enddef
 
 # open the symbol outline window
@@ -739,6 +743,17 @@ def s:openOutlineWindow()
   :nnoremap <silent> <buffer> <CR> :call <SID>outlineJumpToSymbol()<CR>
   :setlocal nomodifiable
 
+  # highlight all the symbol types
+  :syntax keyword LSPTitle File Module Namespace Package Class Method Property
+  :syntax keyword LSPTitle Field Constructor Enum Interface Function Variable
+  :syntax keyword LSPTitle Constant String Number Boolean Array Object Key Null
+  :syntax keyword LSPTitle EnumMember Struct Event Operator TypeParameter
+
+  if str2nr(&t_Co) > 2
+    highlight clear LSPTitle
+    highlight default link LSPTitle Title
+  endif
+
   prop_type_add('LspOutlineHighlight', {bufnr: bufnr(), highlight: 'Search'})
 
   augroup LSPOutline
index 552fade9c5e775d62097fd5b850452afad18a46e..c80225293cf969eb99da1760a07bdce8c875adb6 100644 (file)
@@ -80,7 +80,7 @@ The following commands are provided:
                        cursor in a new quickfix list.
 :LspHighlight          Highlight all the matches for the keyword under cursor
 :LspHighlightClear     Clear all the matches highlighted by :LspHighlight
-:LspShowSymbols                Show the list of symbols defined in the current file
+:LspOutline            Show the list of symbols defined in the current file
                        in a separate window.
 :LspFormat             Format the current file using the LSP server.
 :{range}LspFormat      Format the specified range of files.
@@ -91,6 +91,15 @@ The following commands are provided:
 :LspRename             Rename the current symbol
 :LspCodeAction         Apply the code action supplied by the LSP server to
                        the diagnostic in the current line.
+:LspSymbolSearch       Perform a workspace wide search for a symbol
+:LSPSelectionRange     Visually select the current symbol range
+:LSPFold               Fold the current file
+:LspWorkspaceAddFolder {folder}
+                       Add a folder to the workspace
+:LspWorkspaceRemoveFolder {folder}
+                       Remove a folder from the workspace
+:LspWorkspaceListFolders
+                       Show the list of folders in the workspace
 
 ==============================================================================
 4. Configuration                               *lsp-configuration*
index 7f68c823c12d23245b2719a221d55ebd39a6c8ed..d60d7815562dcd3824897c831f3de56f4bc323e5 100644 (file)
@@ -36,8 +36,8 @@ command! -nargs=0 -bar LspCalling call lsp#outgoingCalls()
 command! -nargs=0 -bar LspRename call lsp#rename()
 command! -nargs=0 -bar LspCodeAction call lsp#codeAction()
 command! -nargs=? -bar LspSymbolSearch call lsp#symbolSearch(<q-args>)
+command! -nargs=0 -bar LspSelectionRange call lsp#selectionRange()
+command! -nargs=0 -bar LspFold call lsp#foldDocument()
 command! -nargs=0 -bar LspWorkspaceListFolders call lsp#listWorkspaceFolders()
 command! -nargs=1 -bar -complete=dir LspWorkspaceAddFolder call lsp#addWorkspaceFolder(<q-args>)
 command! -nargs=1 -bar -complete=dir LspWorkspaceRemoveFolder call lsp#removeWorkspaceFolder(<q-args>)
-command! -nargs=0 -bar LspSelectionRange call lsp#selectionRange()
-command! -nargs=0 -bar LspFold call lsp#foldDocument()