summaryrefslogtreecommitdiff
path: root/vim/pack/downloads/opt/lsp/test/tsserver_tests.vim
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-06-30 17:20:44 -0500
committerMarc Coquand <marc@mccd.space>2024-06-30 17:20:44 -0500
commitaeabdffa8870c2b90a32f53c1d0e5b63367a6e27 (patch)
treed3b8e3395cbfc5c9ba4f1dd28ff807f18d582b26 /vim/pack/downloads/opt/lsp/test/tsserver_tests.vim
parent97ce8456231b997135be6c5f1afaee08eff2cbb1 (diff)
downloadrcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.tar.gz
rcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.tar.bz2
rcm-aeabdffa8870c2b90a32f53c1d0e5b63367a6e27.zip
Vim
Diffstat (limited to 'vim/pack/downloads/opt/lsp/test/tsserver_tests.vim')
-rw-r--r--vim/pack/downloads/opt/lsp/test/tsserver_tests.vim43
1 files changed, 43 insertions, 0 deletions
diff --git a/vim/pack/downloads/opt/lsp/test/tsserver_tests.vim b/vim/pack/downloads/opt/lsp/test/tsserver_tests.vim
new file mode 100644
index 0000000..99e2836
--- /dev/null
+++ b/vim/pack/downloads/opt/lsp/test/tsserver_tests.vim
@@ -0,0 +1,43 @@
+vim9script
+# Unit tests for Vim Language Server Protocol (LSP) typescript client
+
+source common.vim
+source term_util.vim
+source screendump.vim
+
+var lspServers = [{
+ filetype: ['typescript', 'javascript'],
+ path: exepath('typescript-language-server'),
+ args: ['--stdio']
+ }]
+call LspAddServer(lspServers)
+echomsg systemlist($'{lspServers[0].path} --version')
+
+# Test for auto-completion. Make sure that only keywords that matches with the
+# keyword before the cursor are shown.
+# def g:Test_LspCompletion1()
+# var lines =<< trim END
+# const http = require('http')
+# http.cr
+# END
+# writefile(lines, 'Xcompletion1.js')
+# var buf = g:RunVimInTerminal('--cmd "silent so start_tsserver.vim" Xcompletion1.js', {rows: 10, wait_for_ruler: 1})
+# sleep 5
+# term_sendkeys(buf, "GAe")
+# g:TermWait(buf)
+# g:VerifyScreenDump(buf, 'Test_tsserver_completion_1', {})
+# term_sendkeys(buf, "\<BS>")
+# g:TermWait(buf)
+# g:VerifyScreenDump(buf, 'Test_tsserver_completion_2', {})
+#
+# g:StopVimInTerminal(buf)
+# delete('Xcompletion1.js')
+# enddef
+
+# Start the typescript language server. Returns true on success and false on
+# failure.
+def g:StartLangServer(): bool
+ return g:StartLangServerWithFile('Xtest.ts')
+enddef
+
+# vim: shiftwidth=2 softtabstop=2 noexpandtab