diff --git a/.vimspector.json b/.vimspector.json index 256a279..31cd5b8 100644 --- a/.vimspector.json +++ b/.vimspector.json @@ -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" + } } } } diff --git a/README.md b/README.md index 0b7784c..0082ee7 100644 --- a/README.md +++ b/README.md @@ -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 '/adapter'", + "-O", + "script adapter.main.run_stdio_session()" + ] + } + ... + }, + "configurations": { + ": Launch": { + "adapter": "lldb", + "configuration": { + "type": "lldb", + "request": "launch", + "name": ": Launch", + "program": "", + "args": [ .. ], + "cwd": "" + } + } + } +} +``` + * 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. diff --git a/python3/vimspector/code.py b/python3/vimspector/code.py index 8d5908c..a6e4881 100644 --- a/python3/vimspector/code.py +++ b/python3/vimspector/code.py @@ -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 ) diff --git a/python3/vimspector/debug_adapter_connection.py b/python3/vimspector/debug_adapter_connection.py index 7489747..40d5aca 100644 --- a/python3/vimspector/debug_adapter_connection.py +++ b/python3/vimspector/debug_adapter_connection.py @@ -138,11 +138,15 @@ class DebugAdapterConnection( object ): if handler: handler( message ) else: - self._logger.error( - 'Request failed: {0}'.format( - message.get( 'message' ) or '' ) ) - 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 ): diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index 747db92..3a29d90 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -525,6 +525,6 @@ class DebugSession( object ): utils.UserMessage( 'Paused in thread {0} due to {1}'.format( event.get( 'threadId', '' ), - event.get( 'description', event[ 'reason' ] ) ) ) + event.get( 'description', event.get( 'reason', '' ) ) ) ) self._stackTraceView.OnStopped( event ) diff --git a/python3/vimspector/stack_trace.py b/python3/vimspector/stack_trace.py index 16dd62a..aefb74d 100644 --- a/python3/vimspector/stack_trace.py +++ b/python3/vimspector/stack_trace.py @@ -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': '' }