mirror of
https://github.com/prabirshrestha/vim-lsp.git
synced 2025-12-14 20:35:59 +01:00
Add integration tests with gopls instead of rust-analyzer (#1108)
* Revert "remove flaky integration tests (#1098)"
This reverts commit 78c107085a.
* use gopls for integration tests instead of rust-analyzer
* specific Go and gopls versions via envvar on CI
* remove unused test helper for Rust test project
based on https://github.com/prabirshrestha/vim-lsp/pull/1108#discussion_r595689580
* include multibyte text in integration test case
based on https://github.com/prabirshrestha/vim-lsp/pull/1108#discussion_r595690354
* cache gopls binary on running CI workflows
* update doc to run integ tests
This commit is contained in:
31
.github/workflows/linux_neovim.yml
vendored
31
.github/workflows/linux_neovim.yml
vendored
@@ -8,6 +8,11 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
VIM_LSP_GO_VERSION: '1.16.2'
|
||||
VIM_LSP_GOPLS_VERSION: '0.6.6'
|
||||
VIM_LSP_GOPLS_CACHE_VER: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
@@ -31,13 +36,27 @@ jobs:
|
||||
mkdir -p ~/nvim/bin
|
||||
curl -L https://github.com/neovim/neovim/releases/download/${{matrix.neovim_version}}/nvim.appimage -o ~/nvim/bin/nvim
|
||||
chmod u+x ~/nvim/bin/nvim
|
||||
- name: Download language servers
|
||||
- name: Cache gopls
|
||||
id: cache-gopls
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: bin/gopls
|
||||
key: ${{ runner.os }}-${{ env.VIM_LSP_GO_VERSION }}-${{ env.VIM_LSP_GOPLS_VERSION }}-${{ env.VIM_LSP_GOPLS_CACHE_VER }}-gopls
|
||||
- name: Install Go for gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.VIM_LSP_GO_VERSION }}
|
||||
- name: Install gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/langservers
|
||||
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/download/2020-12-21/rust-analyzer-linux -o ~/langservers/rust-analyzer
|
||||
chmod u+x ~/langservers/rust-analyzer
|
||||
~/langservers/rust-analyzer --version
|
||||
go get golang.org/x/tools/gopls@v${{ env.VIM_LSP_GOPLS_VERSION }}
|
||||
gopls version
|
||||
mkdir bin
|
||||
mv "$(which gopls)" ./bin/
|
||||
env:
|
||||
GO111MODULE: 'on'
|
||||
- name: Download test runner
|
||||
shell: bash
|
||||
run: git clone --depth 1 --branch v1.5.5 --single-branch https://github.com/thinca/vim-themis ~/themis
|
||||
@@ -45,8 +64,8 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=~/nvim/bin:$PATH
|
||||
export PATH=~/langservers:$PATH
|
||||
export PATH=~/themis/bin:$PATH
|
||||
export PATH=./bin:$PATH
|
||||
export THEMIS_VIM=nvim
|
||||
nvim --version
|
||||
themis
|
||||
|
||||
31
.github/workflows/linux_vim.yml
vendored
31
.github/workflows/linux_vim.yml
vendored
@@ -8,6 +8,11 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
VIM_LSP_GO_VERSION: '1.16.2'
|
||||
VIM_LSP_GOPLS_VERSION: '0.6.6'
|
||||
VIM_LSP_GOPLS_CACHE_VER: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
@@ -33,13 +38,27 @@ jobs:
|
||||
mkdir -p ~/vim/bin
|
||||
curl -L https://github.com/vim/vim-appimage/releases/download/v${{matrix.vim_version}}/GVim-v${{matrix.vim_version}}.glibc${{matrix.glibc_version}}-x86_64.AppImage -o ~/vim/bin/vim
|
||||
chmod u+x ~/vim/bin/vim
|
||||
- name: Download language servers
|
||||
- name: Cache gopls
|
||||
id: cache-gopls
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: bin/gopls
|
||||
key: ${{ runner.os }}-${{ env.VIM_LSP_GO_VERSION }}-${{ env.VIM_LSP_GOPLS_VERSION }}-${{ env.VIM_LSP_GOPLS_CACHE_VER }}-gopls
|
||||
- name: Install Go for gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.VIM_LSP_GO_VERSION }}
|
||||
- name: Install gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/langservers
|
||||
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/download/2020-12-21/rust-analyzer-linux -o ~/langservers/rust-analyzer
|
||||
chmod u+x ~/langservers/rust-analyzer
|
||||
~/langservers/rust-analyzer --version
|
||||
go get golang.org/x/tools/gopls@v${{ env.VIM_LSP_GOPLS_VERSION }}
|
||||
gopls version
|
||||
mkdir bin
|
||||
mv "$(which gopls)" ./bin/
|
||||
env:
|
||||
GO111MODULE: 'on'
|
||||
- name: Download test runner
|
||||
shell: bash
|
||||
run: git clone --depth 1 --branch v1.5.5 --single-branch https://github.com/thinca/vim-themis ~/themis
|
||||
@@ -47,8 +66,8 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=~/vim/bin:$PATH
|
||||
export PATH=~/langservers:$PATH
|
||||
export PATH=~/themis/bin:$PATH
|
||||
export PATH=./bin:$PATH
|
||||
export THEMIS_VIM=vim
|
||||
vim --version
|
||||
themis
|
||||
|
||||
31
.github/workflows/mac_neovim.yml
vendored
31
.github/workflows/mac_neovim.yml
vendored
@@ -8,6 +8,11 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
VIM_LSP_GO_VERSION: '1.16.2'
|
||||
VIM_LSP_GOPLS_VERSION: '0.6.6'
|
||||
VIM_LSP_GOPLS_CACHE_VER: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
@@ -34,19 +39,33 @@ jobs:
|
||||
- name: Download test runner
|
||||
shell: bash
|
||||
run: git clone --depth 1 --branch v1.5.5 --single-branch https://github.com/thinca/vim-themis ~/themis
|
||||
- name: Download language servers
|
||||
- name: Cache gopls
|
||||
id: cache-gopls
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: bin/gopls
|
||||
key: ${{ runner.os }}-${{ env.VIM_LSP_GO_VERSION }}-${{ env.VIM_LSP_GOPLS_VERSION }}-${{ env.VIM_LSP_GOPLS_CACHE_VER }}-gopls
|
||||
- name: Install Go for gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.VIM_LSP_GO_VERSION }}
|
||||
- name: Install gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/langservers
|
||||
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/download/2020-12-21/rust-analyzer-mac -o ~/langservers/rust-analyzer
|
||||
chmod u+x ~/langservers/rust-analyzer
|
||||
~/langservers/rust-analyzer --version
|
||||
go get golang.org/x/tools/gopls@v${{ env.VIM_LSP_GOPLS_VERSION }}
|
||||
gopls version
|
||||
mkdir bin
|
||||
mv "$(which gopls)" ./bin/
|
||||
env:
|
||||
GO111MODULE: 'on'
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=~/nvim-osx64/bin:$PATH
|
||||
export PATH=~/langservers:$PATH
|
||||
export PATH=~/themis/bin:$PATH
|
||||
export PATH=./bin:$PATH
|
||||
export THEMIS_VIM=nvim
|
||||
nvim --version
|
||||
themis
|
||||
|
||||
31
.github/workflows/mac_vim.yml
vendored
31
.github/workflows/mac_vim.yml
vendored
@@ -8,6 +8,11 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
VIM_LSP_GO_VERSION: '1.16.2'
|
||||
VIM_LSP_GOPLS_VERSION: '0.6.6'
|
||||
VIM_LSP_GOPLS_CACHE_VER: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: macos-latest
|
||||
@@ -19,18 +24,32 @@ jobs:
|
||||
- name: Download test runner
|
||||
shell: bash
|
||||
run: git clone --depth 1 --branch v1.5.5 --single-branch https://github.com/thinca/vim-themis ~/themis
|
||||
- name: Download language servers
|
||||
- name: Cache gopls
|
||||
id: cache-gopls
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: bin/gopls
|
||||
key: ${{ runner.os }}-${{ env.VIM_LSP_GO_VERSION }}-${{ env.VIM_LSP_GOPLS_VERSION }}-${{ env.VIM_LSP_GOPLS_CACHE_VER }}-gopls
|
||||
- name: Install Go for gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.VIM_LSP_GO_VERSION }}
|
||||
- name: Install gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p ~/langservers
|
||||
curl -L https://github.com/rust-analyzer/rust-analyzer/releases/download/2020-12-21/rust-analyzer-mac -o ~/langservers/rust-analyzer
|
||||
chmod u+x ~/langservers/rust-analyzer
|
||||
~/langservers/rust-analyzer --version
|
||||
go get golang.org/x/tools/gopls@v${{ env.VIM_LSP_GOPLS_VERSION }}
|
||||
gopls version
|
||||
mkdir bin
|
||||
mv "$(which gopls)" ./bin/
|
||||
env:
|
||||
GO111MODULE: 'on'
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
run: |
|
||||
export PATH=~/themis/bin:$PATH
|
||||
export PATH=~/langservers:$PATH
|
||||
export PATH=./bin:$PATH
|
||||
export THEMIS_VIM=vim
|
||||
vim --version
|
||||
themis
|
||||
|
||||
27
.github/workflows/windows_neovim.yml
vendored
27
.github/workflows/windows_neovim.yml
vendored
@@ -8,6 +8,11 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
VIM_LSP_GO_VERSION: '1.16.2'
|
||||
VIM_LSP_GOPLS_VERSION: '0.6.6'
|
||||
VIM_LSP_GOPLS_CACHE_VER: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
@@ -33,6 +38,27 @@ jobs:
|
||||
- name: Extract neovim
|
||||
shell: PowerShell
|
||||
run: Expand-Archive -Path neovim.zip -DestinationPath $env:USERPROFILE
|
||||
- name: Cache gopls
|
||||
id: cache-gopls
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: bin/gopls
|
||||
key: ${{ runner.os }}-${{ env.VIM_LSP_GO_VERSION }}-${{ env.VIM_LSP_GOPLS_VERSION }}-${{ env.VIM_LSP_GOPLS_CACHE_VER }}-gopls
|
||||
- name: Install Go for gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.VIM_LSP_GO_VERSION }}
|
||||
- name: Install gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
go get golang.org/x/tools/gopls@v${{ env.VIM_LSP_GOPLS_VERSION }}
|
||||
gopls version
|
||||
mkdir bin
|
||||
mv "$(which gopls)" ./bin/
|
||||
env:
|
||||
GO111MODULE: 'on'
|
||||
- name: Download test runner
|
||||
shell: PowerShell
|
||||
run: git clone --depth 1 --branch v1.5.5 --single-branch https://github.com/thinca/vim-themis $env:USERPROFILE\themis
|
||||
@@ -41,6 +67,7 @@ jobs:
|
||||
run: |
|
||||
SET PATH=%USERPROFILE%\Neovim\bin;%PATH%;
|
||||
SET PATH=%USERPROFILE%\themis\bin;%PATH%;
|
||||
SET PATH=.\bin;%PATH%;
|
||||
SET THEMIS_VIM=nvim
|
||||
nvim --version
|
||||
themis
|
||||
|
||||
27
.github/workflows/windows_vim.yml
vendored
27
.github/workflows/windows_vim.yml
vendored
@@ -8,6 +8,11 @@ on:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
VIM_LSP_GO_VERSION: '1.16.2'
|
||||
VIM_LSP_GOPLS_VERSION: '0.6.6'
|
||||
VIM_LSP_GOPLS_CACHE_VER: 1
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
@@ -40,6 +45,27 @@ jobs:
|
||||
- name: Extract vim
|
||||
shell: PowerShell
|
||||
run: Expand-Archive -Path vim.zip -DestinationPath $env:USERPROFILE
|
||||
- name: Cache gopls
|
||||
id: cache-gopls
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: bin/gopls
|
||||
key: ${{ runner.os }}-${{ env.VIM_LSP_GO_VERSION }}-${{ env.VIM_LSP_GOPLS_VERSION }}-${{ env.VIM_LSP_GOPLS_CACHE_VER }}-gopls
|
||||
- name: Install Go for gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.VIM_LSP_GO_VERSION }}
|
||||
- name: Install gopls
|
||||
if: steps.cache-gopls.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
go get golang.org/x/tools/gopls@v${{ env.VIM_LSP_GOPLS_VERSION }}
|
||||
gopls version
|
||||
mkdir bin
|
||||
mv "$(which gopls)" ./bin/
|
||||
env:
|
||||
GO111MODULE: 'on'
|
||||
- name: Download test runner
|
||||
shell: PowerShell
|
||||
run: git clone --depth 1 --branch v1.5.5 --single-branch https://github.com/thinca/vim-themis $env:USERPROFILE\themis
|
||||
@@ -48,5 +74,6 @@ jobs:
|
||||
run: |
|
||||
SET PATH=%USERPROFILE%\vim\${{matrix.vim_ver_path}};%PATH%;
|
||||
SET PATH=%USERPROFILE%\themis\bin;%PATH%;
|
||||
SET PATH=.\bin;%PATH%;
|
||||
vim --version
|
||||
themis
|
||||
|
||||
@@ -183,5 +183,5 @@ let g:asyncomplete_log_file = expand('~/asyncomplete.log')
|
||||
## Tests
|
||||
|
||||
[vim-themis](https://github.com/thinca/vim-themis) is used for testing. To run
|
||||
integration tests [rust-analyzer](https://github.com/rust-analyzer/rust-analyzer)
|
||||
integration tests [gopls](https://github.com/golang/tools/tree/master/gopls)
|
||||
executable must be in path.
|
||||
|
||||
40
test/integration/go/document_formatting.vimspec
Normal file
40
test/integration/go/document_formatting.vimspec
Normal file
@@ -0,0 +1,40 @@
|
||||
Describe integration#go#document_formatting
|
||||
Before
|
||||
%bwipeout!
|
||||
if lsp#test#hasproject('go')
|
||||
call lsp#test#openproject('go', {})
|
||||
endif
|
||||
End
|
||||
|
||||
After all
|
||||
%bwipeout!
|
||||
call lsp#test#closeproject('go')
|
||||
End
|
||||
|
||||
It should correctly format document when using LspDocumentFormatSync
|
||||
if !lsp#test#hasproject('go')
|
||||
Skip go project not supported
|
||||
endif
|
||||
|
||||
Assert Equals(lsp#get_server_status('gopls'), 'running')
|
||||
|
||||
execute printf('keepalt keepjumps edit %s', lsp#test#projectdir('go') . '/documentformat.go')
|
||||
let l:original = getline(1, "$")
|
||||
|
||||
call execute('LspDocumentFormatSync')
|
||||
|
||||
let got = getline(1, "$")
|
||||
let want = [
|
||||
\ 'package main',
|
||||
\ '',
|
||||
\ 'func main() {',
|
||||
\ ' print("hello, world!")',
|
||||
\ ' print("こんにちは、世界")',
|
||||
\ ' print("a β c")',
|
||||
\ ' print("δ")',
|
||||
\ '}'
|
||||
\ ]
|
||||
Assert Equals(got, want)
|
||||
End
|
||||
|
||||
End
|
||||
7
test/testproject-go/documentformat.go
Normal file
7
test/testproject-go/documentformat.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package main
|
||||
func main() {
|
||||
print("hello, world!")
|
||||
print("こんにちは、世界")
|
||||
print("a β c")
|
||||
print("δ")
|
||||
}
|
||||
1
test/testproject-rust/.gitignore
vendored
Normal file
1
test/testproject-rust/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
target/
|
||||
5
test/testproject-rust/Cargo.lock
generated
Normal file
5
test/testproject-rust/Cargo.lock
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "testproject-rust"
|
||||
version = "0.1.0"
|
||||
9
test/testproject-rust/Cargo.toml
Normal file
9
test/testproject-rust/Cargo.toml
Normal file
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "testproject-rust"
|
||||
version = "0.1.0"
|
||||
authors = ["Prabir Shrestha <mail@prabir.me>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
3
test/testproject-rust/src/calc/add.rs
Normal file
3
test/testproject-rust/src/calc/add.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub fn add(a: u32, b: u32) -> u32 {
|
||||
a + b
|
||||
}
|
||||
1
test/testproject-rust/src/calc/mod.rs
Normal file
1
test/testproject-rust/src/calc/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod add;
|
||||
13
test/testproject-rust/src/documentdefinition.rs
Normal file
13
test/testproject-rust/src/documentdefinition.rs
Normal file
@@ -0,0 +1,13 @@
|
||||
use crate::calc::add::add;
|
||||
|
||||
fn document_definition_same_file() {
|
||||
func1();
|
||||
}
|
||||
|
||||
fn func1() {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn document_definition_different_file() {
|
||||
add(1, 2);
|
||||
}
|
||||
11
test/testproject-rust/src/documentdiagnostics.rs
Normal file
11
test/testproject-rust/src/documentdiagnostics.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
fn document_diagnostics() {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn broken1(
|
||||
print
|
||||
}
|
||||
|
||||
fn broken2()
|
||||
broken(1);
|
||||
}
|
||||
3
test/testproject-rust/src/documentformat.rs
Normal file
3
test/testproject-rust/src/documentformat.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn format () {
|
||||
unimplemented!();
|
||||
}
|
||||
8
test/testproject-rust/src/main.rs
Normal file
8
test/testproject-rust/src/main.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
mod calc;
|
||||
|
||||
mod documentdefinition;
|
||||
mod documentformat;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
@@ -1,36 +1,31 @@
|
||||
function! lsp#test#projectdir(name) abort
|
||||
if a:name ==# 'rust'
|
||||
return expand('%:p:h') .'/test/testproject-rust'
|
||||
elseif a:name ==# 'go'
|
||||
return expand('%:p:h') .'/test/testproject-go'
|
||||
else
|
||||
throw 'projectdir not supported for ' . a:name
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! lsp#test#openproject(name, options) abort
|
||||
call lsp#enable()
|
||||
if a:name ==# 'rust'
|
||||
if a:name ==# 'go'
|
||||
filetype on
|
||||
|
||||
call lsp#register_server({
|
||||
\ 'name': 'rust',
|
||||
\ 'cmd': ['rust-analyzer'],
|
||||
\ 'allowlist': ['rust'],
|
||||
\ 'root_uri':{server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'Cargo.toml'))},
|
||||
\ 'capabilities': { 'experimental': { 'statusNotification': v:true } },
|
||||
\ 'name': 'gopls',
|
||||
\ 'cmd': ['gopls'],
|
||||
\ 'allowlist': ['go'],
|
||||
\ })
|
||||
" status notification required to know ready status of rust analyzer
|
||||
" for more info refer to: https://github.com/rust-analyzer/rust-analyzer/pull/5188
|
||||
|
||||
" open .rs file to trigger rust analyzer then close it
|
||||
execute printf('keepalt keepjumps edit %s', lsp#test#projectdir(a:name) . '/src/documentformat.rs')
|
||||
call lsp#enable()
|
||||
|
||||
" open .go file to trigger gopls then close it
|
||||
execute printf('keepalt keepjumps edit %s', lsp#test#projectdir(a:name) . '/documentformat.go')
|
||||
" wait for server starting
|
||||
call lsp#test#wait(10000, {-> lsp#get_server_status('gopls') ==# 'running' })
|
||||
|
||||
%bwipeout!
|
||||
|
||||
" wait for ready status from rust-analyzer
|
||||
call lsp#callbag#pipe(
|
||||
\ lsp#stream(),
|
||||
\ lsp#callbag#filter({x->has_key(x, 'response') && has_key(x['response'], 'method')
|
||||
\ && x['response']['method'] ==# 'rust-analyzer/status' && x['response']['params']['status'] ==# 'ready' }),
|
||||
\ lsp#callbag#take(1),
|
||||
\ lsp#callbag#toList(),
|
||||
\ ).wait({ 'timeout': 10000, 'sleep': 100 })
|
||||
else
|
||||
throw 'open project not not supported for ' . a:name
|
||||
endif
|
||||
@@ -43,13 +38,13 @@ function! lsp#test#closeproject(name) abort
|
||||
endfunction
|
||||
|
||||
function! lsp#test#hasproject(name) abort
|
||||
if a:name ==# 'rust' && executable('rust-analyzer')
|
||||
if a:name ==# 'go' && executable('gopls')
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! lsp#test#wait(condition) abort
|
||||
call lsp#utils#_wait(5000, a:condition)
|
||||
function! lsp#test#wait(timeout, condition) abort
|
||||
call lsp#utils#_wait(a:timeout, a:condition)
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user