]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Revert "Update instructions for using vim-plug to install the plugin"
authorYegappan Lakshmanan <yegappan@yahoo.com>
Thu, 18 Jan 2024 05:38:43 +0000 (21:38 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Thu, 18 Jan 2024 05:38:43 +0000 (21:38 -0800)
This reverts commit 9cff5462634e04fee13edbdb661a02ca0c71d53d.

README.md
autoload/lsp/symbol.vim
test/run_tests.sh
test/tsserver_tests.vim

index ffedb69aa0ed084003c9d6e5724dc90b9cf7d11f..b2c8df1ae715e6183ad9b4690abada9c09895ec8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -45,7 +45,6 @@ The following language server protocol (LSP) features are supported:
 * Folding code
 * Inlay hints
 * Visually select symbol block/region
-* Semantic Highlight
 
 ## Configuration
 
@@ -158,9 +157,6 @@ call LspOptionsSet(#{
 
 If you used [vim-plug](https://github.com/junegunn/vim-plug) to install the LSP plugin, then you need to use the VimEnter autocmd to initialize the LSP server and to set the LSP server options.  For example:
 ```viml
-let lspOpts = #{autoHighlightDiags: v:true}
-autocmd VimEnter * call LspOptionsSet(lspOpts)
-
 let lspServers = [#{
        \         name: 'clang',
        \         filetype: ['c', 'cpp'],
@@ -168,6 +164,9 @@ let lspServers = [#{
        \         args: ['--background-index']
        \ }]
 autocmd VimEnter * call LspAddServer(lspServers)
+
+let lspOpts = #{autoHighlightDiags: v:true}
+autocmd VimEnter * call LspOptionsSet(lspOpts)
 ```
 
 ## Supported Commands
index 76bcfa913a9d3cd264555b4666a89d1790124796..7d26df82a3f6bc8ab28e2a8e35f5eb48e411a607 100644 (file)
@@ -454,30 +454,15 @@ export def ShowLocations(lspserver: dict<any>, locations: list<dict<any>>,
 enddef
 
 # Key filter callback function used for the symbol popup window.
-def SymbolFilterCB(symPopupWin: number, key: string): bool
-  var keyHandled = false
-
-  if key == "\<C-E>"
-      || key == "\<C-D>"
-      || key == "\<C-F>"
-      || key == "\<PageDown>"
-      || key == "\<C-Y>"
-      || key == "\<C-U>"
-      || key == "\<C-B>"
-      || key == "\<PageUp>"
-      || key == "\<C-Home>"
-      || key == "\<C-End>"
-    # scroll the popup window
-    win_execute(symPopupWin, $'normal! {key}')
-    keyHandled = true
-  endif
-
-  if !keyHandled
-    # For any other key, close the window
-    symPopupWin->popup_close()
+# Vim doesn't close the popup window when the escape key is pressed.
+# This is function supports that.
+def SymbolFilterCB(lspserver: dict<any>, id: number, key: string): bool
+  if key == "\<Esc>"
+    lspserver.peekSymbolPopup->popup_close()
+    return true
   endif
 
-  return keyHandled
+  return false
 enddef
 
 # Display the file specified by LSP "LocationLink" in a popup window and
@@ -496,6 +481,7 @@ def PeekSymbolLocation(lspserver: dict<any>, location: dict<any>)
     # If the symbol popup window is already present, close it.
     lspserver.peekSymbolPopup->popup_close()
   endif
+  var CbFunc = function(SymbolFilterCB, [lspserver])
   var popupAttrs = {
     title: $"{fnamemodify(fname, ':t')} ({fnamemodify(fname, ':h')})",
     wrap: false,
@@ -507,7 +493,7 @@ def PeekSymbolLocation(lspserver: dict<any>, location: dict<any>)
     cursorline: true,
     border: [],
     mapping: false,
-    filter: SymbolFilterCB
+    filter: CbFunc
   }
   lspserver.peekSymbolPopup = popup_atcursor(bnum, popupAttrs)
 
index 91473028ad96f5252e00ba2827aac15524d85d1b..e99590538d096ff631d87fce90e422bd5a2120c1 100755 (executable)
@@ -2,11 +2,7 @@
 
 # Script to run the unit-tests for the LSP Vim plugin
 
-#VIMPRG=${VIMPRG:=$(which vim)}
-#VIMPRG=/home/yega/bin/vim90/bin/vim
-#VIMRUNTIME=/home/yega/bin/vim90/share/vim/vim90
-export VIMPRG=/home/yega/Documents/vim/vim9/vim/src/vim
-export VIMRUNTIME=/home/yega/Documents/vim/vim9/vim/runtime
+VIMPRG=${VIMPRG:=$(which vim)}
 if [ -z "$VIMPRG" ]; then
   echo "ERROR: vim (\$VIMPRG) is not found in PATH"
   exit 1
@@ -14,8 +10,7 @@ fi
 
 VIM_CMD="$VIMPRG -u NONE -U NONE -i NONE --noplugin -N --not-a-term"
 
-#TESTS="clangd_tests.vim tsserver_tests.vim gopls_tests.vim not_lspserver_related_tests.vim markdown_tests.vim"
-TESTS="clangd_tests.vim"
+TESTS="clangd_tests.vim tsserver_tests.vim gopls_tests.vim not_lspserver_related_tests.vim markdown_tests.vim"
 
 RunTestsInFile() {
   testfile=$1
index e553e98b740f660c4cc463f0aba10001110cccf1..99e28368beeba952da377a3d0d0f28582ef8ff14 100644 (file)
@@ -5,9 +5,6 @@ source common.vim
 source term_util.vim
 source screendump.vim
 
-var lspOpts = {autoComplete: false}
-g:LspOptionsSet(lspOpts)
-
 var lspServers = [{
       filetype: ['typescript', 'javascript'],
       path: exepath('typescript-language-server'),
@@ -37,39 +34,6 @@ echomsg systemlist($'{lspServers[0].path} --version')
 #   delete('Xcompletion1.js')
 # enddef
 
-# Test for auto-import using omni completion
-def g:Test_autoimport()
-  :silent! edit autoImportMod1.ts
-  sleep 200m
-  var lines =<< trim END
-    export function getNumber() {
-      return 1;
-    }
-  END
-  setline(1, lines)
-  :redraw!
-  g:WaitForServerFileLoad(0)
-
-  var save_completopt = &completeopt
-  set completeopt=
-
-  :split autoImportMod2.ts
-  :sleep 200m
-  setline(1, 'console.log(getNum')
-  g:WaitForServerFileLoad(2)
-  feedkeys("A\<C-X>\<C-O>());", 'xt')
-  var expected =<< trim END
-    import { getNumber } from "./autoImportMod1";
-
-    ());console.log(getNumber
-  END
-  assert_equal(expected, getline(1, '$'))
-
-  &completeopt = save_completopt
-
-  :%bw!
-enddef
-
 # Start the typescript language server.  Returns true on success and false on
 # failure.
 def g:StartLangServer(): bool