Add lua support through local-lua-debugger-vscode
Add the lua adapter to gadgets.py and installer.py, update the README.md file and create basic tests using lua, luajit and love.
This commit is contained in:
parent
2bdb30a45e
commit
2819e224e7
7 changed files with 185 additions and 4 deletions
55
README.md
55
README.md
|
|
@ -143,6 +143,7 @@ runtime dependencies). They are categorised by their level of support:
|
||||||
| Node.js | Supported | `--force-enable-node` | vscode-node-debug2 | 6 < Node < 12, Npm |
|
| Node.js | Supported | `--force-enable-node` | vscode-node-debug2 | 6 < Node < 12, Npm |
|
||||||
| Javascript | Supported | `--force-enable-chrome` | debugger-for-chrome | Chrome |
|
| Javascript | Supported | `--force-enable-chrome` | debugger-for-chrome | Chrome |
|
||||||
| Java | Supported | `--force-enable-java ` | vscode-java-debug | Compatible LSP plugin (see [later](#java)) |
|
| 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# (dotnet core) | Experimental | `--force-enable-csharp` | netcoredbg | DotNet core |
|
||||||
| C# (mono) | Experimental | `--force-enable-csharp` | vscode-mono-debug | Mono |
|
| 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 |
|
| Python.legacy | Legacy | `--force-enable-python.legacy` | vscode-python | Node 10, Python 2.7 or Python 3 |
|
||||||
|
|
@ -1410,6 +1411,60 @@ For the launch arguments, see the
|
||||||
See [this issue](https://github.com/puremourning/vimspector/issues/3) for more
|
See [this issue](https://github.com/puremourning/vimspector/issues/3) for more
|
||||||
background.
|
background.
|
||||||
|
|
||||||
|
## Lua
|
||||||
|
|
||||||
|
Lua is supported through
|
||||||
|
[local-lua-debugger-vscode](https://github.com/tomblind/local-lua-debugger-vscode).
|
||||||
|
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`
|
||||||
|
* Examples: `support/test/lua/simple` and `support/test/lua/love`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json#",
|
||||||
|
"configurations": {
|
||||||
|
"lua": {
|
||||||
|
"adapter": "lua-local",
|
||||||
|
"configuration": {
|
||||||
|
"request": "launch",
|
||||||
|
"type": "lua-local",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"program": {
|
||||||
|
"lua": "lua",
|
||||||
|
"file": "${file}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"luajit": {
|
||||||
|
"adapter": "lua-local",
|
||||||
|
"configuration": {
|
||||||
|
"request": "launch",
|
||||||
|
"type": "lua-local",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"program": {
|
||||||
|
"lua": "luajit",
|
||||||
|
"file": "${file}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"love": {
|
||||||
|
"adapter": "lua-local",
|
||||||
|
"configuration": {
|
||||||
|
"request": "launch",
|
||||||
|
"type": "lua-local",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"program": {
|
||||||
|
"command": "love"
|
||||||
|
},
|
||||||
|
"args": ["${workspaceFolder}"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## Other servers
|
## Other servers
|
||||||
|
|
||||||
* Java - vscode-javac. This works, but is not as functional as Java Debug
|
* Java - vscode-javac. This works, but is not as functional as Java Debug
|
||||||
|
|
|
||||||
|
|
@ -495,4 +495,31 @@ GADGETS = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'local-lua-debugger-vscode': {
|
||||||
|
'language': 'lua',
|
||||||
|
'enabled': False,
|
||||||
|
'repo': {
|
||||||
|
'url': 'https://github.com/tomblind/local-lua-debugger-vscode.git',
|
||||||
|
'ref': 'release-0.2.0'
|
||||||
|
},
|
||||||
|
'all': {
|
||||||
|
'version': '0.2.0',
|
||||||
|
},
|
||||||
|
'do': lambda name, root, gadget: installer.InstallLuaLocal( name,
|
||||||
|
root,
|
||||||
|
gadget ),
|
||||||
|
'adapters': {
|
||||||
|
'lua-local': {
|
||||||
|
'command': [
|
||||||
|
'node',
|
||||||
|
'${gadgetDir}/local-lua-debugger-vscode/extension/debugAdapter.js'
|
||||||
|
],
|
||||||
|
'name': 'lua-local',
|
||||||
|
'configuration': {
|
||||||
|
'interpreter': 'lua',
|
||||||
|
'extensionPath': '${gadgetDir}/local-lua-debugger-vscode'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -425,6 +425,13 @@ def InstallNodeDebug( name, root, gadget ):
|
||||||
MakeSymlink( name, root )
|
MakeSymlink( name, root )
|
||||||
|
|
||||||
|
|
||||||
|
def InstallLuaLocal( name, root, gadget ):
|
||||||
|
with CurrentWorkingDir( root ):
|
||||||
|
CheckCall( [ 'npm', 'install' ] )
|
||||||
|
CheckCall( [ 'npm', 'run', 'build' ] )
|
||||||
|
MakeSymlink( name, root )
|
||||||
|
|
||||||
|
|
||||||
def InstallGagdet( name: str,
|
def InstallGagdet( name: str,
|
||||||
gadget: dict,
|
gadget: dict,
|
||||||
manifest: Manifest,
|
manifest: Manifest,
|
||||||
|
|
|
||||||
17
support/test/lua/love/.vimspector.json
Normal file
17
support/test/lua/love/.vimspector.json
Normal file
|
|
@ -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}"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
21
support/test/lua/love/main.lua
Normal file
21
support/test/lua/love/main.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
if pcall(require, 'lldebugger') then
|
||||||
|
require('lldebugger').start()
|
||||||
|
end
|
||||||
|
|
||||||
|
local rect = {0, 0, 64, 64}
|
||||||
|
|
||||||
|
|
||||||
|
function love.update(dt)
|
||||||
|
rect[1] = rect[1] + 10 * dt
|
||||||
|
rect[2] = rect[2] + 10 * dt
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function love.draw()
|
||||||
|
love.graphics.rectangle('fill', rect[1], rect[2], rect[3], rect[4])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function love.keypressed()
|
||||||
|
love.event.quit()
|
||||||
|
end
|
||||||
29
support/test/lua/simple/.vimspector.json
Normal file
29
support/test/lua/simple/.vimspector.json
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json#",
|
||||||
|
"configurations": {
|
||||||
|
"lua": {
|
||||||
|
"adapter": "lua-local",
|
||||||
|
"configuration": {
|
||||||
|
"request": "launch",
|
||||||
|
"type": "lua-local",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"program": {
|
||||||
|
"lua": "lua",
|
||||||
|
"file": "simple.lua"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"luajit": {
|
||||||
|
"adapter": "lua-local",
|
||||||
|
"configuration": {
|
||||||
|
"request": "launch",
|
||||||
|
"type": "lua-local",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"program": {
|
||||||
|
"lua": "luajit",
|
||||||
|
"file": "simple.lua"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
support/test/lua/simple/simple.lua
Normal file
25
support/test/lua/simple/simple.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
if pcall(require, 'lldebugger') then
|
||||||
|
require('lldebugger').start()
|
||||||
|
end
|
||||||
|
|
||||||
|
local separator = ' '
|
||||||
|
|
||||||
|
|
||||||
|
local function createMessage()
|
||||||
|
local words = {}
|
||||||
|
table.insert(words, 'Hello')
|
||||||
|
table.insert(words, 'world')
|
||||||
|
return table.concat(words, separator)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function withEmphasis(func)
|
||||||
|
return function()
|
||||||
|
return func() .. '!'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
createMessage = withEmphasis(createMessage)
|
||||||
|
|
||||||
|
print(createMessage())
|
||||||
Loading…
Add table
Add a link
Reference in a new issue