diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1f3270b..f592b21 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -86,7 +86,7 @@ jobs: - run: | brew update-reset brew doctor || true - for p in macvim tcl-tk llvm; do + for p in macvim tcl-tk llvm lua luajit love; do brew install $p brew outdated $p || brew upgrade $p done diff --git a/.gitignore b/.gitignore index 64341cf..77f22a9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ tests/*.res tests/messages tests/debuglog test.log +*.testlog gadgets/ package/ *.pyc diff --git a/README.md b/README.md index bcba8cf..bb13d1a 100644 --- a/README.md +++ b/README.md @@ -141,10 +141,10 @@ runtime dependencies). They are categorised by their level of support: | Go | Tested | `--enable-go` | vscode-go | Go, [Delve][] | | TCL | Supported | `--all` or `--enable-tcl` | tclpro | TCL 8.5 | | Bourne Shell | Supported | `--all` or `--enable-bash` | vscode-bash-debug | Bash v?? | +| Lua | Supported | `--all` or `--enable-lua` | local-lua-debugger-vscode | Node >=12.13.0, Npm, Lua interpreter | | Node.js | Supported | `--force-enable-node` | vscode-node-debug2 | 6 < Node < 12, Npm | | Javascript | Supported | `--force-enable-chrome` | debugger-for-chrome | Chrome | | Java | Supported | `--force-enable-java ` | vscode-java-debug | Compatible LSP plugin (see [later](#java)) | -| Lua | Supported | `--force-enable-lua` | local-lua-debugger-vscode | Node, Npm, Lua interpreter | | C# (dotnet core) | Experimental | `--force-enable-csharp` | netcoredbg | DotNet core | | C# (mono) | Experimental | `--force-enable-csharp` | vscode-mono-debug | Mono | | Python.legacy | Legacy | `--force-enable-python.legacy` | vscode-python | Node 10, Python 2.7 or Python 3 | @@ -1419,7 +1419,7 @@ Lua is supported through This debugger uses stdio to communicate with the running process, so calls to `io.read` will cause problems. -* `./install_gadget.py --force-enable-lua` or `:VimspectorInstall local-lua-debugger-vscode` +* `./install_gadget.py --enable-lua` or `:VimspectorInstall local-lua-debugger-vscode` * Examples: `support/test/lua/simple` and `support/test/lua/love` ```json diff --git a/python3/vimspector/gadgets.py b/python3/vimspector/gadgets.py index c0c4890..363def6 100644 --- a/python3/vimspector/gadgets.py +++ b/python3/vimspector/gadgets.py @@ -497,10 +497,10 @@ GADGETS = { }, 'local-lua-debugger-vscode': { 'language': 'lua', - 'enabled': False, + 'enabled': True, 'repo': { 'url': 'https://github.com/tomblind/local-lua-debugger-vscode.git', - 'ref': 'release-0.2.0' + 'ref': 'release-${version}' }, 'all': { 'version': '0.2.0', diff --git a/support/test/lua/love-headless/.vimspector.json b/support/test/lua/love-headless/.vimspector.json new file mode 100644 index 0000000..8864784 --- /dev/null +++ b/support/test/lua/love-headless/.vimspector.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json#", + "configurations": { + "love": { + "adapter": "lua-local", + "configuration": { + "request": "launch", + "type": "lua-local", + "cwd": "${workspaceFolder}", + "program": { + "command": "love" + }, + "args": ["${workspaceFolder}"] + } + } + } +} diff --git a/support/test/lua/love-headless/conf.lua b/support/test/lua/love-headless/conf.lua new file mode 100644 index 0000000..f74d620 --- /dev/null +++ b/support/test/lua/love-headless/conf.lua @@ -0,0 +1,12 @@ +function love.conf(t) + t.modules.audio = false + t.modules.font = false + t.modules.graphics = false + t.modules.image = false + t.modules.mouse = false + t.modules.physics = false + t.modules.sound = false + t.modules.touch = false + t.modules.video = false + t.modules.window = false +end diff --git a/support/test/lua/love-headless/main.lua b/support/test/lua/love-headless/main.lua new file mode 100644 index 0000000..899a864 --- /dev/null +++ b/support/test/lua/love-headless/main.lua @@ -0,0 +1,10 @@ +if pcall(require, 'lldebugger') then + require('lldebugger').start() +end + +local time = 0 + +function love.update(dt) + time = time + dt + love.event.quit() +end diff --git a/tests/ci/image/Dockerfile b/tests/ci/image/Dockerfile index 15d0ad0..4494cf1 100644 --- a/tests/ci/image/Dockerfile +++ b/tests/ci/image/Dockerfile @@ -4,6 +4,11 @@ ENV DEBIAN_FRONTEND=noninteractive ENV LC_ALL C.UTF-8 RUN apt-get update && \ + apt install -y curl dirmngr apt-transport-https lsb-release ca-certificates \ + software-properties-common && \ + curl -sL https://deb.nodesource.com/setup_12.x | bash - && \ + add-apt-repository ppa:bartbes/love-stable -y && \ + apt-get update && \ apt-get -y dist-upgrade && \ apt-get -y install python3-dev \ python3-pip \ @@ -17,9 +22,10 @@ RUN apt-get update && \ tcllib \ gdb \ lldb \ - curl \ nodejs \ - npm && \ + lua5.1 \ + luajit \ + love && \ apt-get -y autoremove RUN ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \ diff --git a/tests/language_lua.test.vim b/tests/language_lua.test.vim new file mode 100644 index 0000000..0dafb10 --- /dev/null +++ b/tests/language_lua.test.vim @@ -0,0 +1,84 @@ +function! SetUp() + let g:vimspector_enable_mappings = 'HUMAN' + call vimspector#test#setup#SetUpWithMappings( v:none ) +endfunction + +function! ClearDown() + call vimspector#test#setup#ClearDown() +endfunction + + +function! BaseTest( configuration ) + let fn='simple.lua' + lcd ../support/test/lua/simple + exe 'edit ' . fn + + call vimspector#SetLineBreakpoint( fn, 9 ) + call vimspector#LaunchWithSettings( { 'configuration': a:configuration } ) + + " This debugger is ignoring stopOnEntry when not running a custom executable + " and always stopping on the first line after setting the hook. This first + " check assumes that behavior. + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 5, 1 ) + call WaitForAssert( {-> + \ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 5 ) + \ } ) + " Continue + call feedkeys( "\", 'xt' ) + + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 9, 1 ) + call WaitForAssert( {-> + \ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 9 ) + \ } ) + + " Step + call feedkeys( "\", 'xt' ) + + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 10, 1 ) + call WaitForAssert( {-> + \ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 10 ) + \ } ) + + call vimspector#test#setup#Reset() + + lcd - + %bwipeout! +endfunction + + +function! Test_Lua_Simple() + call BaseTest( 'lua' ) +endfunction + + +function! Test_Lua_Luajit() + call BaseTest( 'luajit' ) +endfunction + + +function! Test_Lua_Love() + let fn='main.lua' + lcd ../support/test/lua/love-headless + exe 'edit ' . fn + + call vimspector#SetLineBreakpoint( fn, 8 ) + call vimspector#LaunchWithSettings( { 'configuration': 'love' } ) + + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 8, 1 ) + call WaitForAssert( {-> + \ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 8 ) + \ } ) + + " Step + call feedkeys( "\", 'xt' ) + + call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 9, 1 ) + call WaitForAssert( {-> + \ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 9 ) + \ } ) + + call vimspector#test#setup#Reset() + + lcd - + %bwipeout! +endfunction