]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Enable code coverage
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 22 Jan 2022 16:12:02 +0000 (08:12 -0800)
committerYegappan Lakshmanan <yegappan@yahoo.com>
Sat, 22 Jan 2022 16:12:02 +0000 (08:12 -0800)
.github/workflows/coverage.yml [new file with mode: 0644]
autoload/handlers.vim
test/unit_tests.vim

diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
new file mode 100644 (file)
index 0000000..cca3fd2
--- /dev/null
@@ -0,0 +1,39 @@
+name: coverage
+on: [push, pull_request]
+jobs:
+  linux:
+    name: linux
+    runs-on: ubuntu-18.04
+    steps:
+      - name: Checkout Code
+        uses: actions/checkout@v2
+      - name: Run Tests
+        run: |
+          uname -a
+          export LSP_PROFILE=1
+          export VIMPRG=vim
+          $VIMPRG --version
+          cd ./test
+          ./run_tests.sh
+      - name: Install Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.5
+      - name: Install covimerage
+        run: |
+          pip install covimerage
+          covimerage --version
+      - name: Run covimerage
+        run: |
+          cd ./test
+          covimerage write_coverage lsp_profile.txt
+      - name: Take coverage
+        run: |
+          cd ./test
+          coverage report
+          coverage xml
+      - name: Upload coverage to codecov
+        uses: codecov/codecov-action@v2
+        with:
+          token: ${{ secrets.CODECOV_TOKEN }}
+          file: ./test/coverage.xml
index a83f9cdb3b38291731f6d1e330d87b7734e39f15..3e8dacdc1ffcfb6a483f4f2eb2e63780b2a6c369 100644 (file)
@@ -833,8 +833,7 @@ export def ProcessRequest(lspserver: dict<any>, request: dict<any>)
   if lspRequestHandlers->has_key(request.method)
     lspRequestHandlers[request.method](lspserver, request)
   else
-    util.ErrMsg('Error: Unsupported request received from LSP server ' ..
-                                                       request->string())
+    util.ErrMsg('Error: Unsupported request message received from the LSP server (' .. lspserver.path .. '), message = ' .. request->string())
   endif
 enddef
 
index 89337098f0051892214e60060caf15b29e1ceb45..fceb9c21b57ca085487a0221fc7c77f6eb1c9739 100644 (file)
@@ -6,6 +6,18 @@ filetype on
 filetype plugin on
 filetype indent on
 
+# Set the $LSP_PROFILE environment variable to profile the LSP plugin
+var do_profile: bool = false
+if exists('$LSP_PROFILE')
+  do_profile = true
+endif
+
+if do_profile
+  # profile the LSP plugin
+  profile start lsp_profile.txt
+  profile! file */lsp/*
+endif
+
 set rtp+=../
 source ../plugin/lsp.vim
 var lspServers = [{