Yet more hacking. This sort of makes it work for rust

This commit is contained in:
Ben Jackson 2018-05-29 02:15:18 +01:00
commit 65e2a50d28
6 changed files with 66 additions and 9 deletions

View file

@ -119,6 +119,21 @@
"args": [],
"cwd": "/Users/ben/Development/vim"
}
},
"racerd": {
"adapter": "lldb",
"configuration": {
"type": "lldb",
"request": "launch",
"name": "LLDB: Launch",
"program": "/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/racerd/target/debug/racerd",
"args": [
"serve",
"--port=12345",
"--secret-file=secretfile"
],
"cwd": "/Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd"
}
}
}
}

View file

@ -190,6 +190,40 @@ not always (or not completely).
```
* C, C++, Rust, etc.: [CodeLLDB](https://github.com/vadimcn/vscode-lldb)
```
{
"adapters": {
"lldb": {
"name": "lldb",
"command": [
"lldb",
"-b",
"-O",
"command script import '<extension path>/adapter'",
"-O",
"script adapter.main.run_stdio_session()"
]
}
...
},
"configurations": {
"<name>: Launch": {
"adapter": "lldb",
"configuration": {
"type": "lldb",
"request": "launch",
"name": "<name>: Launch",
"program": "<path to binary>",
"args": [ .. ],
"cwd": "<working directory>"
}
}
}
}
```
* Python: [vscode-python](https://github.com/Microsoft/vscode-python)
```
@ -229,8 +263,6 @@ Also the mock debugger, but that isn't actually useful.
Known not to work:
* CodeLLDB. This doesn't work because it requires unique logic to launch the
server, and it uses TCP/IP rather than standard streams.
* Java Debug Server. This doesn't work (yet) because it runs as a jdt.ls plugin.
Support for this may be added in conjunction with [ycmd][], but this
architecture is incredibly complex and vastly different from any other.

View file

@ -59,10 +59,13 @@ class CodeView( object ):
if not frame or not frame.get( 'source' ):
return False
if 'path' not in frame[ 'source' ]:
return False
vim.current.window = self._window
buffer_number = int( vim.eval( 'bufnr( "{0}", 1 )'.format(
frame[ 'source' ].get( 'path', '???' ) ) ) )
frame[ 'source' ][ 'path' ] ) ) )
try:
vim.command( 'bu {0}'.format( buffer_number ) )
@ -149,6 +152,9 @@ class CodeView( object ):
for file_name, breakpoints in self._breakpoints.items():
for breakpoint in breakpoints:
if 'line' not in breakpoint:
continue
sign_id = self._next_sign_id
self._next_sign_id += 1
self._signs[ 'breakpoints' ].append( sign_id )

View file

@ -138,11 +138,15 @@ class DebugAdapterConnection( object ):
if handler:
handler( message )
else:
self._logger.error(
'Request failed: {0}'.format(
message.get( 'message' ) or '<silence>' ) )
utils.UserMessage( 'Request failed: {0}'.format( message[ 'message' ] ),
reason = (
message.get( 'body', {} ).get( 'error', {} ).get( 'format' ) or
message.get( 'message' ) or
'no reason' )
self._logger.error( 'Request failed: {0}'.format( reason ) )
utils.UserMessage( 'Request failed: {0}'.format( reason ),
persist = True )
elif message[ 'type' ] == 'event':
method = 'OnEvent_' + message[ 'event' ]
if method in dir( self._handler ):

View file

@ -525,6 +525,6 @@ class DebugSession( object ):
utils.UserMessage( 'Paused in thread {0} due to {1}'.format(
event.get( 'threadId', '<unknown>' ),
event.get( 'description', event[ 'reason' ] ) ) )
event.get( 'description', event.get( 'reason', '' ) ) ) )
self._stackTraceView.OnStopped( event )

View file

@ -182,7 +182,7 @@ class StackTraceView( object ):
stackFrames = thread[ '_frames' ]
for frame in stackFrames:
if frame[ 'source' ]:
if frame.get( 'source' ):
source = frame[ 'source' ]
else:
source = { 'name': '<unknown>' }