diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f592b21..17f9601 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,6 +38,7 @@ jobs: options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined steps: - uses: actions/checkout@v2 + - run: | eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) go get -u github.com/go-delve/delve/cmd/dlv @@ -79,17 +80,26 @@ jobs: name: 'package-linux' path: 'package/linux-${{ github.run_id }}.tar.gz' + # - name: Start SSH session if failed + # uses: luchihoratiu/debug-via-ssh@main + # if: failure() + # with: + # NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} + # SSH_PASS: ${{ secrets.SSH_PASS }} + MacOS: runs-on: 'macos-10.15' steps: - uses: actions/checkout@v2 + - run: | brew update-reset brew doctor || true - for p in macvim tcl-tk llvm lua luajit love; do - brew install $p - brew outdated $p || brew upgrade $p + for p in python@3.8 tcl-tk llvm lua luajit love; do + brew install $p || brew outdated $p || brew upgrade $p done + brew install --cask macvim + brew link --overwrite python@3.8 name: 'Install vim and deps' - run: go get -u github.com/go-delve/delve/cmd/dlv @@ -128,6 +138,13 @@ jobs: name: 'package-macos' path: 'package/macos-${{ github.run_id }}.tar.gz' + # - name: Start SSH session if failed + # uses: luchihoratiu/debug-via-ssh@main + # if: failure() + # with: + # NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} + # SSH_PASS: ${{ secrets.SSH_PASS }} + PublishRelease: runs-on: 'ubuntu-16.04' needs: diff --git a/python3/vimspector/variables.py b/python3/vimspector/variables.py index 1d62c04..4028722 100644 --- a/python3/vimspector/variables.py +++ b/python3/vimspector/variables.py @@ -84,6 +84,12 @@ class WatchResult( Expandable ): self.result = result +class WatchFailure( WatchResult ): + def __init__( self, reason ): + super().__init__( { 'result': reason } ) + self.changed = True + + class Variable( Expandable ): """Holds one level of an expanded value tree. Also itself expandable.""" def __init__( self, variable: dict ): @@ -296,11 +302,14 @@ class VariablesView( object ): def EvaluateWatches( self ): for watch in self._watches: - self._connection.DoRequest( partial( self._UpdateWatchExpression, - watch ), { - 'command': 'evaluate', - 'arguments': watch.expression, - } ) + self._connection.DoRequest( + partial( self._UpdateWatchExpression, watch ), + { + 'command': 'evaluate', + 'arguments': watch.expression, + }, + failure_handler = lambda reason, msg, watch=watch: + self._WatchExpressionFailed( reason, watch ) ) def _UpdateWatchExpression( self, watch: Watch, message: dict ): if watch.result is not None: @@ -321,6 +330,14 @@ class VariablesView( object ): self._DrawWatches() + def _WatchExpressionFailed( self, reason: str, watch: Watch ): + if watch.result is not None: + # We already have a result for this watch. Wut ? + return + + watch.result = WatchFailure( reason ) + self._DrawWatches() + def ExpandVariable( self ): if vim.current.buffer == self._vars.buf: view = self._vars diff --git a/tests/variables.test.vim b/tests/variables.test.vim index 155e1d9..9152875 100644 --- a/tests/variables.test.vim +++ b/tests/variables.test.vim @@ -557,3 +557,37 @@ function Test_EvaluatePromptConsole() call vimspector#test#setup#Reset() %bwipe! endfunction + +function! Test_EvaluateFailure() + call s:StartDebugging() + + " Add a wtch + call vimspector#AddWatch( 'test' ) + call WaitForAssert( {-> + \ AssertMatchist( + \ [ + \ 'Watches: ----', + \ 'Expression: test', + \ " *- Result: NameError: name 'test' is not defined", + \ ], + \ getbufline( winbufnr( g:vimspector_session_windows.watches ), + \ 1, + \ '$' ) + \ ) + \ } ) + + VimspectorEval test + call assert_equal( bufnr( 'vimspector.Console' ), + \ winbufnr( g:vimspector_session_windows.output ) ) + call WaitForAssert( {-> + \ assert_equal( + \ [ + \ "NameError: name 'test' is not defined" + \ ], + \ getbufline( bufnr( 'vimspector.Console' ), '$', '$' ) + \ ) + \ } ) + + call vimspector#test#setup#Reset() + %bwipe! +endfunction