Compare commits

..

1 commit

112 changed files with 2259 additions and 10661 deletions

View file

@ -17,12 +17,12 @@ assignees: ''
> Please answer the following questions > Please answer the following questions
* Does your issue reproduce using `vim --clean -Nu /path/to/vimspector/support/minimal_vimrc` ? \[Yes/No] * Does your issue reproduce using `vim -Nu /path/to/vimspector/support/minimal_vimrc` ? \[Yes/No]
* If you are using Neovim, does your issue reproduce using Vim? \[Yes/No] * If you are using Neovim, does your issue reproduce using Vim? \[Yes/No]
> List of steps to reproduce: > List of steps to reproduce:
> 1. Run `vim ---clean Nu /path/to/vimspector/support/minimal_vimrc` > 1. Run `vim -Nu /path/to/vimspector/support/minimal_vimrc`
> 2. Open _this project_... > 2. Open _this project_...
> 3. Press _this sequence of keys_ > 3. Press _this sequence of keys_
@ -57,12 +57,6 @@ discussing on Gitter rather than raising an issue.
* Version of Vimspector: (e.g. output of `git rev-parse HEAD` if cloned or the * Version of Vimspector: (e.g. output of `git rev-parse HEAD` if cloned or the
name of the tarball used to install otherwise) name of the tarball used to install otherwise)
* Output of `:VimspectorDebugInfo`
```
paste here
```
* Output of `vim --version` or `nvim --version` * Output of `vim --version` or `nvim --version`
``` ```

View file

@ -1,12 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Questions and support
url: http://gitter.im/vimspector/Lobby
about: Please ask and answer questions here.
- name: Discussions
url: https://github.com/puremourning/vimspector/discussions
about: Please post questions and useful hints here
- name: Support for additional languages
url: https://github.com/puremourning/vimspector/wiki/languages
about: Please see here for information on support for additional languages

View file

@ -13,7 +13,7 @@ defaults:
jobs: jobs:
PythonLint: PythonLint:
runs-on: ubuntu-18.04 runs-on: ubuntu-16.04
container: 'puremourning/vimspector:test' container: 'puremourning/vimspector:test'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -22,7 +22,7 @@ jobs:
- name: 'Run flake8' - name: 'Run flake8'
run: '$HOME/.local/bin/flake8 python3/ *.py' run: '$HOME/.local/bin/flake8 python3/ *.py'
VimscriptLint: VimscriptLint:
runs-on: 'ubuntu-18.04' runs-on: 'ubuntu-16.04'
container: 'puremourning/vimspector:test' container: 'puremourning/vimspector:test'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -32,13 +32,12 @@ jobs:
run: $HOME/.local/bin/vint autoload/ compiler/ plugin/ tests/ syntax/ run: $HOME/.local/bin/vint autoload/ compiler/ plugin/ tests/ syntax/
Linux: Linux:
runs-on: 'ubuntu-18.04' runs-on: 'ubuntu-16.04'
container: container:
image: 'puremourning/vimspector:test' image: 'puremourning/vimspector:test'
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: | - run: |
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
go get -u github.com/go-delve/delve/cmd/dlv go get -u github.com/go-delve/delve/cmd/dlv
@ -80,26 +79,17 @@ jobs:
name: 'package-linux' name: 'package-linux'
path: 'package/linux-${{ github.run_id }}.tar.gz' 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: MacOS:
runs-on: 'macos-10.15' runs-on: 'macos-10.15'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: | - run: |
brew update-reset brew update
brew doctor || true brew doctor || true
for p in python@3.8 tcl-tk llvm lua luajit love; do for p in macvim tcl-tk llvm; do
brew install $p || brew outdated $p || brew upgrade $p brew install $p
brew outdated $p || brew upgrade $p
done done
brew install --cask macvim
brew link --overwrite python@3.8
name: 'Install vim and deps' name: 'Install vim and deps'
- run: go get -u github.com/go-delve/delve/cmd/dlv - run: go get -u github.com/go-delve/delve/cmd/dlv
@ -111,16 +101,6 @@ jobs:
path: gadgets/macos/download path: gadgets/macos/download
name: Cache gadgets name: Cache gadgets
- name: 'Install .NET Core SDK 3.1'
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: 3.1
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ^11
name: "Switch to xcode 11 because of .NET debugging bug"
- run: vim --version - run: vim --version
name: 'Print vim version information' name: 'Print vim version information'
@ -148,15 +128,8 @@ jobs:
name: 'package-macos' name: 'package-macos'
path: 'package/macos-${{ github.run_id }}.tar.gz' 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 }} # [V]imspector
PublishRelease: PublishRelease:
runs-on: 'ubuntu-18.04' runs-on: 'ubuntu-16.04'
needs: needs:
- Linux - Linux
- MacOS - MacOS

View file

@ -1,27 +0,0 @@
name: "Lock Old Issues"
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2
with:
github-token: ${{ github.token }}
issue-lock-inactive-days: '60'
# issue-exclude-created-before: ''
# issue-exclude-labels: ''
# issue-lock-labels: ''
# issue-lock-comment: ''
# issue-lock-reason: 'resolved'
# pr-lock-inactive-days: '365'
# pr-exclude-created-before: ''
# pr-exclude-labels: ''
# pr-lock-labels: ''
# pr-lock-comment: ''
# pr-lock-reason: 'resolved'
process-only: 'issues'

2
.gitignore vendored
View file

@ -6,7 +6,6 @@ tests/*.res
tests/messages tests/messages
tests/debuglog tests/debuglog
test.log test.log
*.testlog
gadgets/ gadgets/
package/ package/
*.pyc *.pyc
@ -20,4 +19,3 @@ support/test/csharp/*.exe*
configurations/ configurations/
venv/ venv/
test-base/ test-base/
tags

View file

@ -9,8 +9,9 @@ pull_request_rules:
# CI https://doc.mergify.io/conditions.html#github-actions # CI https://doc.mergify.io/conditions.html#github-actions
- status-success=PythonLint - status-success=PythonLint
- status-success=VimscriptLint - status-success=VimscriptLint
- status-success=Linux
- status-success=MacOS - status-success=MacOS
actions: &merge-actions actions: &merge-actions
merge: merge:
method: merge method: merge

View file

@ -42,17 +42,7 @@ def Settings( **kwargs ):
return { return {
'sys_path': [ 'sys_path': [
p.join( PATH_TO_THIS_DIR, 'python3' ) p.join( PATH_TO_THIS_DIR, 'python3' )
], ]
'ls': {
'python': {
'analysis': {
'extraPaths': [
p.join( PATH_TO_THIS_DIR, 'python3' ),
],
'useLibraryCodeForTypes': True
}
}
}
} }
if IgnoreExtraConf: if IgnoreExtraConf:

View file

@ -46,23 +46,6 @@ The GitHub issue tracker is for *bug reports* and *features requests* for the
Vimspector project, and on-topic comments and follow-ups to them. It is not for Vimspector project, and on-topic comments and follow-ups to them. It is not for
general discussion, general support or for any other purpose. general discussion, general support or for any other purpose.
Please **search the issue tracker for similar issues** before creating a new
one. There's no point in duplication; if an existing open issue addresses your
problem, please comment there instead of creating a duplicate. However, if the
issue you found is **closed as resolved** (e.g. with a PR or the original user's
problem was resolved), raise a **new issue**, because you've found a new
problem. Reference the original issue if you think that's useful information.
Closed issues which have been inactive for 60 days will be locked, this helps to
keep discussions focussed. If you believe you are still experiencing an issue
which has been closed, please raise a new issue, completing the issue template.
If you do find a similar _open_ issue, **don't just post 'me too' or similar**
responses. This almost never helps resolve the issue, and just causes noise for
the maintainers. Only post if it will aid the maintainers in solving the issue;
if there are existing diagnostics requested in the thread, perform
them and post the results.
Please do not be offended if your Issue or comment is closed or hidden, for any Please do not be offended if your Issue or comment is closed or hidden, for any
of the following reasons: of the following reasons:
@ -70,7 +53,6 @@ of the following reasons:
* The issue or comment is off-topic * The issue or comment is off-topic
* The issue does not represent a Vimspector bug or feature request * The issue does not represent a Vimspector bug or feature request
* The issue cannot be reasonably reproduced using the minimal vimrc * The issue cannot be reasonably reproduced using the minimal vimrc
* The issue is a duplicate of an existing issue
* etc. * etc.
Issue titles are important. It's not usually helpful to write a title like Issue titles are important. It's not usually helpful to write a title like
@ -101,47 +83,11 @@ in the issue report.
The minimal vimrc is in `support/test/minimal_vimrc` and can be used as follows: The minimal vimrc is in `support/test/minimal_vimrc` and can be used as follows:
``` ```
vim --clean -Nu /path/to/vimspector/support/minimal_vimrc vim -Nu /path/to/vimspector/support/minimal_vimrc
``` ```
## Pull Requests ## Pull Requests
Vimspector is open to all contributors with ideas great and small! However,
there is a limit to the intended scope of the plugin and the amount of time the
maintainer has to support and... well... maintain features. It's probably well
understood that the contributor's input typically ends when a PR is megred, but
the maintainers have to keep it working forever.
### Small changes
For bug fixes, documentation changes, gadget versin updates, etc. please just
send a PR, I'm super happy to merge these!
If you are unsure, or looking for some pointers, feel free to ask in Gitter, or
mention is in the PR.
### Larger changes
For larger features that might be in any way controvertial, or increase the
complexity of the overall plugin, please come to Gitter and talk to the
maintainer(s) first. This saves a lot of potential back-and-forth and makes sure
that we're "on the same page" about the idea and the ongoing maintenance.
In addition, if you like hacking, feel free to raise a PR tagged with `[RFC]` in
the title and we can discuss the idea. I still prefer to discuss these things on
Gitter rather than back-and-forth on GitHub, though.
Please don't be offended if the maintainer(s) request significant rework for (or
perhaps even dismiss) a PR that's not gone through this process.
Please also don't be offended if the maintainer(s) ask if you're willing to
provide ongoing support for the feature. As an OSS project manned entirely in
what little spare time the maintainer(s) have, we're always looking for
contributions and contributors who will help with support and maintenance of
larger new features.
### PR Guidelines
When contributing pull requests, I ask that: When contributing pull requests, I ask that:
* You provide a clear and complete summary of the change, the use case and how * You provide a clear and complete summary of the change, the use case and how
@ -149,8 +95,6 @@ When contributing pull requests, I ask that:
* You avoid using APIs that are not available in the versions listed in the * You avoid using APIs that are not available in the versions listed in the
dependencies on README.md dependencies on README.md
* You add tests for your PR. * You add tests for your PR.
* You test your changes in both Vim and Neovim at the supported versions (and
state that in the PR).
* You follow the style of the code as-is; the python code is YCM-stye, it is * You follow the style of the code as-is; the python code is YCM-stye, it is
*not* PEP8, nor should it be. *not* PEP8, nor should it be.
@ -185,10 +129,10 @@ Vimspector creator.
### Code Style ### Code Style
The code style of the Python code is "YCM" style, because that's how I like it. The code style of the Python code is "YCM" style, because that's how I like it.
`flake8` is used to check for certain errors and code style. [`flake8`][] is used to check for certain errors and code style.
The code style of the Vimscript is largely the same, and it is linted by The code style of the Vimscript is largely the same, and it is linted by
`vint`. [`vint`][].
To run them: To run them:
@ -200,31 +144,7 @@ To run them:
They're also run by CI, so please check for lint failures. The canonical They're also run by CI, so please check for lint failures. The canonical
definition of the command to run is the command run in CI, i.e. in definition of the command to run is the command run in CI, i.e. in
`.git/workflows/build.yml`. `azure-pipelines.yml`.
### Debugging Vimspector
You can debug vimspector's python code using vimspector! We can use debugpy,
from within Vim's embedded python and connect to it. Here's how:
1. In one instance of vim, run the following to get debugpy to start listening
for us to connect: `:py3 __import__( 'vimspector', fromlist=[ 'developer' ]
).developer.SetUpDebugpy()`
2. In another instance of Vim, set a breakpoint in the vimspector python code
you want to debug and launch vimspector (e.g. `<F5>`). Select the `Python:
attach to vim` profile. This will attach to the debugpy running in the other
vim.
3. Back in the first vim (the debuggee), trigger the vimspector code in
question, e.g. by starting to debug something else.
4. You'll see it pause, and the 2nd vim (the debugger), you should be able to
step through and inspect as with any other python remote debugging.
NB. It's also possible to debug the vimscript code using vimspector, but this
requires unreleased vim patches and a fair amount of faff. You can always use
`:debug` (see the help) for this though.
# Code of conduct # Code of conduct

1016
README.md

File diff suppressed because it is too large Load diff

View file

@ -13,9 +13,6 @@
" See the License for the specific language governing permissions and " See the License for the specific language governing permissions and
" limitations under the License. " limitations under the License.
if !has( 'python3' )
finish
endif
" Boilerplate {{{ " Boilerplate {{{
let s:save_cpo = &cpoptions let s:save_cpo = &cpoptions
@ -30,62 +27,45 @@ EOF
endfunction endfunction
let s:enabled = v:null let s:enabled = vimspector#internal#state#Reset()
function! s:Initialised() abort function! vimspector#Launch() abort
return s:enabled != v:null if !s:enabled
endfunction
function! s:Enabled() abort
if !s:Initialised()
let s:enabled = vimspector#internal#state#Reset()
endif
return s:enabled
endfunction
function! vimspector#Launch( ... ) abort
if !s:Enabled()
return return
endif endif
py3 _vimspector_session.Start( *vim.eval( 'a:000' ) ) py3 _vimspector_session.Start()
endfunction endfunction
function! vimspector#LaunchWithSettings( settings ) abort function! vimspector#LaunchWithSettings( settings ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.Start( launch_variables = vim.eval( 'a:settings' ) ) py3 _vimspector_session.Start( launch_variables = vim.eval( 'a:settings' ) )
endfunction endfunction
function! vimspector#Reset( ... ) abort function! vimspector#Reset() abort
if !s:Enabled() if !s:enabled
return return
endif endif
if a:0 == 0 py3 _vimspector_session.Reset()
let options = {}
else
let options = a:1
endif
py3 _vimspector_session.Reset( **vim.eval( 'options' ) )
endfunction endfunction
function! vimspector#Restart() abort function! vimspector#Restart() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.Restart() py3 _vimspector_session.Restart()
endfunction endfunction
function! vimspector#ClearBreakpoints() abort function! vimspector#ClearBreakpoints() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.ClearBreakpoints() py3 _vimspector_session.ClearBreakpoints()
endfunction endfunction
function! vimspector#ToggleBreakpoint( ... ) abort function! vimspector#ToggleBreakpoint( ... ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
if a:0 == 0 if a:0 == 0
@ -96,43 +76,8 @@ function! vimspector#ToggleBreakpoint( ... ) abort
py3 _vimspector_session.ToggleBreakpoint( vim.eval( 'options' ) ) py3 _vimspector_session.ToggleBreakpoint( vim.eval( 'options' ) )
endfunction endfunction
function! vimspector#SetLineBreakpoint( file_name, line_num, ... ) abort
if !s:Enabled()
return
endif
if a:0 == 0
let options = {}
else
let options = a:1
endif
py3 _vimspector_session.SetLineBreakpoint(
\ vim.eval( 'a:file_name' ),
\ int( vim.eval( 'a:line_num' ) ),
\ vim.eval( 'options' ) )
endfunction
function! vimspector#ClearLineBreakpoint( file_name, line_num ) abort
if !s:Enabled()
return
endif
py3 _vimspector_session.ClearLineBreakpoint(
\ vim.eval( 'a:file_name' ),
\ int( vim.eval( 'a:line_num' ) ) )
endfunction
function! vimspector#RunToCursor() abort
if !s:Enabled()
return
endif
py3 _vimspector_session.RunTo(
\ vim.eval( "expand( '%' )" ),
\ int( vim.eval( "line( '.' )" ) ) )
endfunction
function! vimspector#AddFunctionBreakpoint( function, ... ) abort function! vimspector#AddFunctionBreakpoint( function, ... ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
if a:0 == 0 if a:0 == 0
@ -145,120 +90,74 @@ function! vimspector#AddFunctionBreakpoint( function, ... ) abort
endfunction endfunction
function! vimspector#StepOver() abort function! vimspector#StepOver() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.StepOver() py3 _vimspector_session.StepOver()
endfunction endfunction
function! vimspector#StepInto() abort function! vimspector#StepInto() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.StepInto() py3 _vimspector_session.StepInto()
endfunction endfunction
function! vimspector#StepOut() abort function! vimspector#StepOut() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.StepOut() py3 _vimspector_session.StepOut()
endfunction endfunction
function! vimspector#Continue() abort function! vimspector#Continue() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.Continue() py3 _vimspector_session.Continue()
endfunction endfunction
function! vimspector#Pause() abort function! vimspector#Pause() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.Pause() py3 _vimspector_session.Pause()
endfunction endfunction
function! vimspector#PauseContinueThread() abort function! vimspector#Stop() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.PauseContinueThread() py3 _vimspector_session.Stop()
endfunction
function! vimspector#SetCurrentThread() abort
if !s:Enabled()
return
endif
py3 _vimspector_session.SetCurrentThread()
endfunction
function! vimspector#Stop( ... ) abort
if !s:Enabled()
return
endif
if a:0 == 0
let options = {}
else
let options = a:1
endif
py3 _vimspector_session.Stop( **vim.eval( 'options' ) )
endfunction endfunction
function! vimspector#ExpandVariable() abort function! vimspector#ExpandVariable() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.ExpandVariable() py3 _vimspector_session.ExpandVariable()
endfunction endfunction
function! vimspector#SetVariableValue( ... ) abort
if !s:Enabled()
return
endif
if a:0 == 0
py3 _vimspector_session.SetVariableValue()
else
py3 _vimspector_session.SetVariableValue( new_value = vim.eval( 'a:1' ) )
endif
endfunction
function! vimspector#DeleteWatch() abort function! vimspector#DeleteWatch() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.DeleteWatch() py3 _vimspector_session.DeleteWatch()
endfunction endfunction
function! vimspector#GoToFrame() abort function! vimspector#GoToFrame() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.ExpandFrameOrThread() py3 _vimspector_session.ExpandFrameOrThread()
endfunction endfunction
function! vimspector#UpFrame() abort
if !s:Enabled()
return
endif
py3 _vimspector_session.UpFrame()
endfunction
function! vimspector#DownFrame() abort
if !s:Enabled()
return
endif
py3 _vimspector_session.DownFrame()
endfunction
function! vimspector#AddWatch( ... ) abort function! vimspector#AddWatch( ... ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
if a:0 == 0 if a:0 == 0
let expr = input( 'Enter watch expression: ', let expr = input( 'Enter watch expression: ' )
\ '',
\ 'custom,vimspector#CompleteExpr' )
else else
let expr = a:1 let expr = a:1
endif endif
@ -271,7 +170,7 @@ function! vimspector#AddWatch( ... ) abort
endfunction endfunction
function! vimspector#AddWatchPrompt( expr ) abort function! vimspector#AddWatchPrompt( expr ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
stopinsert stopinsert
@ -280,24 +179,24 @@ function! vimspector#AddWatchPrompt( expr ) abort
endfunction endfunction
function! vimspector#Evaluate( expr ) abort function! vimspector#Evaluate( expr ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.ShowOutput( 'Console' ) py3 _vimspector_session.ShowOutput( 'Console' )
py3 _vimspector_session.EvaluateConsole( vim.eval( 'a:expr' ), True ) py3 _vimspector_session.EvaluateConsole( vim.eval( 'a:expr' ) )
endfunction endfunction
function! vimspector#EvaluateConsole( expr ) abort function! vimspector#EvaluateConsole( expr ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
stopinsert stopinsert
setlocal nomodified setlocal nomodified
py3 _vimspector_session.EvaluateConsole( vim.eval( 'a:expr' ), False ) py3 _vimspector_session.EvaluateConsole( vim.eval( 'a:expr' ) )
endfunction endfunction
function! vimspector#ShowOutput( ... ) abort function! vimspector#ShowOutput( ... ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
if a:0 == 1 if a:0 == 1
@ -308,7 +207,7 @@ function! vimspector#ShowOutput( ... ) abort
endfunction endfunction
function! vimspector#ShowOutputInWindow( win_id, category ) abort function! vimspector#ShowOutputInWindow( win_id, category ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 __import__( 'vimspector', py3 __import__( 'vimspector',
@ -318,31 +217,21 @@ function! vimspector#ShowOutputInWindow( win_id, category ) abort
endfunction endfunction
function! vimspector#ToggleLog() abort function! vimspector#ToggleLog() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.ToggleLog() py3 _vimspector_session.ToggleLog()
endfunction endfunction
function! vimspector#ListBreakpoints() abort function! vimspector#ListBreakpoints() abort
if !s:Enabled() if !s:enabled
return return
endif endif
py3 _vimspector_session.ListBreakpoints() py3 _vimspector_session.ListBreakpoints()
endfunction endfunction
function! vimspector#GetConfigurations() abort
if !s:Enabled()
return
endif
let configurations = py3eval(
\ 'list( _vimspector_session.GetConfigurations( {} )[ 1 ].keys() )'
\ . ' if _vimspector_session else []' )
return configurations
endfunction
function! vimspector#CompleteOutput( ArgLead, CmdLine, CursorPos ) abort function! vimspector#CompleteOutput( ArgLead, CmdLine, CursorPos ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
let buffers = py3eval( '_vimspector_session.GetOutputBuffers() ' let buffers = py3eval( '_vimspector_session.GetOutputBuffers() '
@ -350,15 +239,37 @@ function! vimspector#CompleteOutput( ArgLead, CmdLine, CursorPos ) abort
return join( buffers, "\n" ) return join( buffers, "\n" )
endfunction endfunction
py3 <<EOF
def _vimspector_GetExprCompletions( ArgLead, prev_non_keyword_char ):
if not _vimspector_session:
return []
items = []
for candidate in _vimspector_session.GetCompletionsSync(
ArgLead,
prev_non_keyword_char ):
label = candidate.get( 'text', candidate[ 'label' ] )
start = prev_non_keyword_char - 1
if 'start' in candidate and 'length' in candidate:
start = candidate[ 'start' ]
items.append( ArgLead[ 0 : start ] + label )
return items
EOF
function! vimspector#CompleteExpr( ArgLead, CmdLine, CursorPos ) abort function! vimspector#CompleteExpr( ArgLead, CmdLine, CursorPos ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
let col = len( a:ArgLead ) let col = len( a:ArgLead )
let prev_non_keyword_char = match( a:ArgLead[ 0 : col - 1 ], '\k*$' ) + 1 let prev_non_keyword_char = match( a:ArgLead[ 0 : col - 1 ], '\k*$' ) + 1
return join( py3eval( '_vimspector_session.GetCommandLineCompletions( ' return join( py3eval( '_vimspector_GetExprCompletions( '
\ . 'vim.eval( "a:ArgLead" ), ' \ . 'vim.eval( "a:ArgLead" ), '
\ . 'int( vim.eval( "prev_non_keyword_char" ) ) )' ), \ . 'int( vim.eval( "prev_non_keyword_char" ) ) )' ),
\ "\n" ) \ "\n" )
@ -479,7 +390,7 @@ function! vimspector#OmniFuncConsole( find_start, query ) abort
endfunction endfunction
function! vimspector#Install( bang, ... ) abort function! vimspector#Install( bang, ... ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
let prefix = vimspector#internal#state#GetAPIPrefix() let prefix = vimspector#internal#state#GetAPIPrefix()
@ -491,7 +402,7 @@ function! vimspector#Install( bang, ... ) abort
endfunction endfunction
function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
return py3eval( '"\n".join(' return py3eval( '"\n".join('
@ -501,7 +412,7 @@ function! vimspector#CompleteInstall( ArgLead, CmdLine, CursorPos ) abort
endfunction endfunction
function! vimspector#Update( bang, ... ) abort function! vimspector#Update( bang, ... ) abort
if !s:Enabled() if !s:enabled
return return
endif endif
@ -514,7 +425,7 @@ function! vimspector#Update( bang, ... ) abort
endfunction endfunction
function! vimspector#AbortInstall() abort function! vimspector#AbortInstall() abort
if !s:Enabled() if !s:enabled
return return
endif endif
@ -523,49 +434,6 @@ function! vimspector#AbortInstall() abort
endfunction endfunction
function! vimspector#OnBufferCreated( file_name ) abort
if len( a:file_name ) == 0
return
endif
" Don't actually load up vimsepctor python in autocommands that trigger
" regularly. We'll only create the session obkect in s:Enabled()
if !s:Initialised()
return
endif
if !s:Enabled()
return
endif
py3 _vimspector_session.RefreshSigns( vim.eval( 'a:file_name' ) )
endfunction
function! vimspector#ShowEvalBalloon( is_visual ) abort
if a:is_visual
let expr = py3eval( '__import__( "vimspector", fromlist = [ "utils" ] )'
\ . '.utils.GetVisualSelection('
\ . ' int( vim.eval( "winbufnr( winnr() )" ) ) )' )
let expr = join( expr, '\n' )
else
let expr = expand( '<cexpr>' )
endif
return py3eval( '_vimspector_session.ShowEvalBalloon('
\ . ' int( vim.eval( "winnr()" ) ), "'
\ . expr
\ . '", 0 )' )
endfunction
function! vimspector#PrintDebugInfo() abort
if !s:Enabled()
return
endif
py3 _vimspector_session.PrintDebugInfo()
endfunction
" Boilerplate {{{ " Boilerplate {{{
let &cpoptions=s:save_cpo let &cpoptions=s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View file

@ -19,323 +19,16 @@ let s:save_cpo = &cpoptions
set cpoptions&vim set cpoptions&vim
" }}} " }}}
scriptencoding utf-8 " Returns: py.ShowBalloon( winnr, expresssion )
function! vimspector#internal#balloon#BalloonExpr() abort
let s:popup_win_id = 0 " winnr + 1 because for *no good reason* winnr is 0 based here unlike
let s:nvim_border_win_id = 0 " everywhere else
" " int() because for *no good reason* winnr is a string.
" tooltip dimensions return py3eval('_vimspector_session.ShowBalloon('
let s:min_width = 1 \ . 'int( vim.eval( "v:beval_winnr" ) ) + 1,'
let s:min_height = 1 \ . 'vim.eval( "v:beval_text" ) )' )
let s:max_width = 80
let s:max_height = 20
let s:is_neovim = has( 'nvim' )
" This is used as the balloonexpr in vim to show the Tooltip at the hover
" position
function! vimspector#internal#balloon#HoverTooltip() abort
return py3eval( '_vimspector_session.ShowEvalBalloon('
\ . ' int( vim.eval( "v:beval_winnr" ) ) + 1,'
\ . ' vim.eval( "v:beval_text"),'
\ . ' 1 )' )
endfunction endfunction
function! vimspector#internal#balloon#CreateTooltip( is_hover, ... ) abort
let body = []
if a:0 > 0
let body = a:1
endif
if s:popup_win_id != 0
call vimspector#internal#balloon#Close()
endif
if s:is_neovim
call s:CreateNeovimTooltip( body )
else
let config = {
\ 'wrap': 0,
\ 'filtermode': 'n',
\ 'maxwidth': s:max_width,
\ 'maxheight': s:max_height,
\ 'minwidth': s:min_width,
\ 'minheight': s:min_height,
\ 'scrollbar': 1,
\ 'border': [],
\ 'padding': [ 0, 1, 0, 1],
\ 'drag': 1,
\ 'resize': 1,
\ 'close': 'button',
\ 'callback': 'vimspector#internal#balloon#CloseCallback',
\ }
let config = vimspector#internal#popup#SetBorderChars( config )
if a:is_hover
let config[ 'filter' ] = 'vimspector#internal#balloon#MouseFilter'
let config[ 'mousemoved' ] = [ 0, 0, 0 ]
let s:popup_win_id = popup_beval( body, config )
else
let config[ 'filter' ] = 'vimspector#internal#balloon#CursorFilter'
let config[ 'moved' ] = 'any'
let config[ 'cursorline' ] = 1
let config[ 'mapping' ] = 0
let s:popup_win_id = popup_atcursor( body, config )
endif
endif
return s:popup_win_id
endfunction
" Filters for vim {{{
function! vimspector#internal#balloon#MouseFilter( winid, key ) abort
if a:key ==# "\<Esc>"
call vimspector#internal#balloon#Close()
return 0
endif
if index( [ "\<leftmouse>", "\<2-leftmouse>" ], a:key ) < 0
return 0
endif
let handled = 0
let mouse_coords = getmousepos()
" close the popup if mouse is clicked outside the window
if mouse_coords[ 'winid' ] != a:winid
call vimspector#internal#balloon#Close()
return 0
endif
" place the cursor according to the click
call win_execute( a:winid,
\ ':call cursor( '
\ . mouse_coords[ 'line' ]
\ . ', '
\ . mouse_coords[ 'column' ]
\ . ' )' )
" expand the variable if we got double click
if a:key ==? "\<2-leftmouse>"
call py3eval( '_vimspector_session.ExpandVariable('
\ . 'buf = vim.buffers[ ' . winbufnr( a:winid ) . ' ],'
\ . 'line_num = ' . line( '.', a:winid )
\ . ')' )
let handled = 1
endif
return handled
endfunction
function! s:MatchKey( key, candidates ) abort
for candidate in a:candidates
" If the mapping string looks like a special character, then try and
" expand it. This is... a hack. The whole thing only works if the mapping
" is a single key (anyway), and so we assume any string starting with < is a
" special key (which will be the common case) and try and map it. If it
" fails... it fails.
if candidate[ 0 ] == '<'
try
execute 'let candidate = "\' . candidate . '"'
endtry
endif
if candidate ==# a:key
return v:true
endif
endfor
return v:false
endfunction
function! vimspector#internal#balloon#CursorFilter( winid, key ) abort
let mappings = py3eval(
\ "__import__( 'vimspector',"
\." fromlist = [ 'settings' ] ).settings.Dict("
\." 'mappings' )[ 'variables' ]" )
if index( [ "\<LeftMouse>", "\<2-LeftMouse>" ], a:key ) >= 0
return vimspector#internal#balloon#MouseFilter( a:winid, a:key )
endif
if s:MatchKey( a:key, mappings.expand_collapse )
call py3eval( '_vimspector_session.ExpandVariable('
\ . 'buf = vim.buffers[ ' . winbufnr( a:winid ) . ' ],'
\ . 'line_num = ' . line( '.', a:winid )
\ . ')' )
return 1
elseif s:MatchKey( a:key, mappings.set_value )
call py3eval( '_vimspector_session.SetVariableValue('
\ . 'buf = vim.buffers[ ' . winbufnr( a:winid ) . ' ],'
\ . 'line_num = ' . line( '.', a:winid )
\ . ')' )
return 1
endif
return popup_filter_menu( a:winid, a:key )
endfunction
" }}}
" Closing {{{
function! vimspector#internal#balloon#CloseCallback( ... ) abort
let s:popup_win_id = 0
let s:nvim_border_win_id = 0
return py3eval( '_vimspector_session.CleanUpTooltip()' )
endfunction
function! vimspector#internal#balloon#Close() abort
if s:popup_win_id == 0
return
endif
if s:is_neovim
call nvim_win_close( s:popup_win_id, v:true )
call nvim_win_close( s:nvim_border_win_id, v:true )
call vimspector#internal#balloon#CloseCallback()
else
call popup_close(s:popup_win_id)
endif
endfunction
" }}}
" Neovim pollyfill {{{
function! vimspector#internal#balloon#ResizeTooltip() abort
if !s:is_neovim
" Vim does this for us
return
endif
if s:popup_win_id <= 0 || s:nvim_border_win_id <= 0
" nothing to resize
return
endif
noautocmd call win_gotoid( s:popup_win_id )
let buf_lines = getline( 1, '$' )
let width = s:min_width
let height = min( [ max( [ s:min_height, len( buf_lines ) ] ),
\ s:max_height ] )
" calculate the longest line
for l in buf_lines
let width = max( [ width, len( l ) ] )
endfor
let width = min( [ width, s:max_width ] )
let opts = {
\ 'width': width,
\ 'height': height,
\ }
" resize the content window
call nvim_win_set_config( s:popup_win_id, opts )
" resize the border window
let opts[ 'width' ] = width + 4
let opts[ 'height' ] = height + 2
call nvim_win_set_config( s:nvim_border_win_id, opts )
call nvim_buf_set_lines( nvim_win_get_buf( s:nvim_border_win_id ),
\ 0,
\ -1,
\ v:true,
\ s:GenerateBorder( width, height ) )
endfunction
" neovim doesn't have the border support, so we have to make our own.
" FIXME: This will likely break if the user has `ambiwidth=2`
function! s:GenerateBorder( width, height ) abort
let top = '╭' . repeat('─',a:width + 2) . '╮'
let mid = '│' . repeat(' ',a:width + 2) . '│'
let bot = '╰' . repeat('─',a:width + 2) . '╯'
let lines = [ top ] + repeat( [ mid ], a:height ) + [ bot ]
return lines
endfunction
function! s:CreateNeovimTooltip( body ) abort
" generate border for the float window by creating a background buffer and
" overlaying the content buffer
" see https://github.com/neovim/neovim/issues/9718#issuecomment-546603628
let buf_id = nvim_create_buf( v:false, v:true )
call nvim_buf_set_lines( buf_id,
\ 0,
\ -1,
\ v:true,
\ s:GenerateBorder( s:max_width, s:max_height ) )
" default the dimensions initially, then we'll calculate the real size and
" resize it.
let opts = {
\ 'relative': 'cursor',
\ 'width': s:max_width + 2,
\ 'height': s:max_height + 2,
\ 'col': 0,
\ 'row': 1,
\ 'anchor': 'NW',
\ 'style': 'minimal'
\ }
" this is the border window
let s:nvim_border_win_id = nvim_open_win( buf_id, 0, opts )
call nvim_win_set_option( s:nvim_border_win_id, 'signcolumn', 'no' )
call nvim_win_set_option( s:nvim_border_win_id, 'relativenumber', v:false )
call nvim_win_set_option( s:nvim_border_win_id, 'number', v:false )
" when calculating where to display the content window, we need to account
" for the border
let opts.row += 1
let opts.height -= 2
let opts.col += 2
let opts.width -= 4
" create the content window
let buf_id = nvim_create_buf( v:false, v:true )
call nvim_buf_set_lines( buf_id, 0, -1, v:true, a:body )
call nvim_buf_set_option( buf_id, 'modifiable', v:false )
let s:popup_win_id = nvim_open_win( buf_id, v:false, opts )
" Apparently none of these work, when 'style' is 'minimal'
call nvim_win_set_option( s:popup_win_id, 'wrap', v:false )
call nvim_win_set_option( s:popup_win_id, 'cursorline', v:true )
call nvim_win_set_option( s:popup_win_id, 'signcolumn', 'no' )
call nvim_win_set_option( s:popup_win_id, 'relativenumber', v:false )
call nvim_win_set_option( s:popup_win_id, 'number', v:false )
" Move the cursor into the popup window, as this is the only way we can
" interract with the popup in neovim
noautocmd call win_gotoid( s:popup_win_id )
nnoremap <silent> <buffer> <Esc> <cmd>quit<CR>
call py3eval( "__import__( 'vimspector', "
\." fromlist = [ 'variables' ] )."
\.' variables.AddExpandMappings()' )
" Close the popup whenever we leave this window
augroup vimspector#internal#balloon#nvim_float
autocmd!
autocmd WinLeave <buffer>
\ :call vimspector#internal#balloon#Close()
\ | autocmd! vimspector#internal#balloon#nvim_float
augroup END
call vimspector#internal#balloon#ResizeTooltip()
endfunction
" }}}
" Boilerplate {{{ " Boilerplate {{{
let &cpoptions=s:save_cpo let &cpoptions=s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View file

@ -62,7 +62,7 @@ function! vimspector#internal#channel#StartDebugSession( config ) abort
\ ) \ )
endif endif
let l:addr = get( a:config, 'host', '127.0.0.1' ) . ':' . a:config[ 'port' ] let l:addr = get( a:config, 'host', 'localhost' ) . ':' . a:config[ 'port' ]
echo 'Connecting to ' . l:addr . '... (waiting fo up to 10 seconds)' echo 'Connecting to ' . l:addr . '... (waiting fo up to 10 seconds)'
let s:ch = ch_open( l:addr, let s:ch = ch_open( l:addr,
@ -94,45 +94,34 @@ _vimspector_session.OnRequestTimeout( vim.eval( 'a:id' ) )
EOF EOF
endfunction endfunction
function! vimspector#internal#channel#StopDebugSession() abort function! s:KillJob() abort
if exists( 's:job' ) if exists( 's:job' )
" We started the job, so we need to kill it and wait to read all the data
" from the socket
if job_status( s:job ) ==# 'run' if job_status( s:job ) ==# 'run'
call job_stop( s:job, 'term' )
endif
while job_status( s:job ) ==# 'run'
call job_stop( s:job, 'kill' ) call job_stop( s:job, 'kill' )
endwhile
unlet s:job
if exists( 's:ch' ) && count( [ 'closed', 'fail' ], ch_status( s:ch ) ) == 0
" We're going to block on this channel reading, then manually call the
" close callback, so remove the automatic close callback to avoid tricky
" re-entrancy
call ch_setoptions( s:ch, { 'close_cb': '' } )
endif endif
unlet s:job
sleep 500m
endif
endfunction
elseif exists( 's:ch' ) && function! vimspector#internal#channel#StopDebugSession() abort
\ count( [ 'closed', 'fail' ], ch_status( s:ch ) ) == 0 if exists( 's:ch' ) && ch_status( s:ch ) ==# 'open'
" channel is open, close it and trigger the callback. The callback is _not_ " channel is open, close it and trigger the callback. The callback is _not_
" triggered when manually calling ch_close. if we get here and the channel " triggered when manually calling ch_close. if we get here and the channel
" is not open, then we there is a _OnClose callback waiting for us, so do " is not open, then we there is a _OnClose callback waiting for us, so do
" nothing. " nothing.
call ch_close( s:ch ) call ch_close( s:ch )
while ch_status( s:ch ) ==# 'buffered'
let data = ch_read( s:ch, {'timeout': 0} )
if data == ''
continue
endif
call s:_OnServerData( s:ch, data )
endwhile
call s:_OnClose( s:ch )
endif endif
" block until we've read all data from the socket and handled it. call s:KillJob()
while count( [ 'open', 'buffered' ], ch_status( s:ch ) ) == 1
let data = ch_read( s:ch, { 'timeout': 10 } )
call s:_OnServerData( s:ch, data )
endwhile
call s:_OnClose( s:ch )
endfunction endfunction
function! vimspector#internal#channel#Reset() abort function! vimspector#internal#channel#Reset() abort

View file

@ -66,7 +66,7 @@ function! vimspector#internal#neochannel#StartDebugSession( config ) abort
endtry endtry
endif endif
let l:addr = get( a:config, 'host', '127.0.0.1' ) . ':' . a:config[ 'port' ] let l:addr = get( a:config, 'host', 'localhost' ) . ':' . a:config[ 'port' ]
let attempt = 1 let attempt = 1
while attempt <= 10 while attempt <= 10

View file

@ -159,16 +159,15 @@ function! s:_OnCommandEvent( category, id, data, event ) abort
call setbufvar( buffer, '&modified', 0 ) call setbufvar( buffer, '&modified', 0 )
endtry endtry
" if the buffer is visible, scroll it, but don't allow autocommands to fire, " if the buffer is visible, scroll it
" as this may close the current window!
let w = bufwinnr( buffer ) let w = bufwinnr( buffer )
if w > 0 if w > 0
let cw = winnr() let cw = winnr()
try try
noautocmd execute w . 'wincmd w' execute w . 'wincmd w'
noautocmd normal! Gz- normal! Gz-
finally finally
noautocmd execute cw . 'wincmd w' execute cw . 'wincmd w'
endtry endtry
endif endif
elseif a:event ==# 'exit' elseif a:event ==# 'exit'

View file

@ -80,56 +80,6 @@ function! vimspector#internal#neopopup#HideSplash( id ) abort
unlet s:db[ a:id ] unlet s:db[ a:id ]
endfunction endfunction
function! vimspector#internal#neopopup#Confirm( confirm_id,
\ text,
\ options,
\ default_value,
\ keys ) abort
" Neovim doesn't have an equivalent of popup_dialog, and it's way too much
" effort to write one, so we just use confirm()...
" Annoyingly we can't use confirm() here because for some reason it doesn't
" render properly in a channel callback. So we use input() and mimic dialog
" behaviour.
let prompt = a:text
for opt in a:options
let prompt .= ' ' . opt
endfor
let prompt .= ': '
try
let result = input( prompt, a:keys[ a:default_value - 1 ] )
catch /.*/
let result = -1
endtry
" Map the results to what the vim popup stuff would return (s:ConfirmCallback
" in popup.vim), i.e.:
" - 1-based index of selected item, or
" - -1 or 0 for cancellation
if result == ''
" User pressed ESC/ctrl-c
let result = -1
else
let index = 1
for k in a:keys
if k ==? result
let result = index
break
endif
let index += 1
endfor
if index > len( a:keys )
let result = -1
endif
endif
py3 __import__( 'vimspector', fromlist = [ 'utils' ] ).utils.ConfirmCallback(
\ int( vim.eval( 'a:confirm_id' ) ),
\ int( vim.eval( 'result' ) ) )
endfunction
" Boilerplate {{{ " Boilerplate {{{
let &cpoptions=s:save_cpo let &cpoptions=s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View file

@ -12,7 +12,6 @@
" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. " WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
" See the License for the specific language governing permissions and " See the License for the specific language governing permissions and
" limitations under the License. " limitations under the License.
scriptencoding utf-8
" Boilerplate {{{ " Boilerplate {{{
@ -33,113 +32,6 @@ function! vimspector#internal#popup#HideSplash( id ) abort
call popup_hide( a:id ) call popup_hide( a:id )
endfunction endfunction
let s:current_selection = 0
let s:selections = []
let s:text = []
function! s:UpdatePopup( id ) abort
let buf = copy( s:text )
call extend( buf, s:DrawButtons() )
call popup_settext( a:id, buf )
endfunction
function! s:ConfirmKeyFilter( keys, id, key ) abort
if a:key ==# "\<CR>"
call popup_close( a:id, s:current_selection + 1 )
return 1
elseif index( [ "\<Tab>", "\<Right>" ], a:key ) >= 0
let s:current_selection = ( s:current_selection + 1 ) % len( s:selections )
call s:UpdatePopup( a:id )
return 1
elseif index( [ "\<S-Tab>", "\<Left>" ], a:key ) >= 0
let s:current_selection = s:current_selection == 0
\ ? len( s:selections ) - 1: s:current_selection - 1
call s:UpdatePopup( a:id )
return 1
elseif a:key ==# "\<Esc>" || a:key ==# "\<C-c>"
call popup_close( a:id, -1 )
return 1
endif
let index = 1
for key in a:keys
if a:key ==? key
call popup_close( a:id, index )
return 1
endif
let index += 1
endfor
endfunction
function! s:ConfirmCallback( confirm_id, id, result ) abort
py3 __import__( 'vimspector', fromlist = [ 'utils' ] ).utils.ConfirmCallback(
\ int( vim.eval( 'a:confirm_id' ) ),
\ int( vim.eval( 'a:result' ) ) )
endfunction
function! s:SelectionPosition( idx ) abort
return a:idx == 0 ? 0 : len( join( s:selections[ : a:idx - 1 ], ' ' ) ) + 1
endfunction
function! s:DrawButtons() abort
return [ {
\ 'text': join( s:selections, ' ' ),
\ 'props': [
\ {
\ 'col': s:SelectionPosition( s:current_selection ) + 1,
\ 'length': len( s:selections[ s:current_selection ] ),
\ 'type': 'VimspectorSelectedItem'
\ },
\ ]
\ } ]
endfunction
function! vimspector#internal#popup#Confirm(
\ confirm_id,
\ text,
\ options,
\ default_value,
\ keys ) abort
silent! call prop_type_add( 'VimspectorSelectedItem', {
\ 'highlight': 'PMenuSel'
\ } )
let lines = split( a:text, "\n", v:true )
let buf = []
for line in lines
call add( buf, { 'text': line, 'props': [] } )
endfor
call add( buf, { 'text': '', 'props': [] } )
let s:selections = a:options
let s:current_selection = ( a:default_value - 1 )
let s:text = copy( buf )
call extend( buf, s:DrawButtons() )
let config = {
\ 'callback': function( 's:ConfirmCallback', [ a:confirm_id ] ),
\ 'filter': function( 's:ConfirmKeyFilter', [ a:keys ] ),
\ 'mapping': v:false,
\ }
let config = vimspector#internal#popup#SetBorderChars( config )
return popup_dialog( buf, config )
endfunction
function! vimspector#internal#popup#SetBorderChars( config ) abort
" When ambiwidth is single, use prettier characters for the border. This
" would look silly when ambiwidth is double.
if &ambiwidth ==# 'single' && &encoding ==? 'utf-8'
let a:config[ 'borderchars' ] = [ '─', '│', '─', '│', '╭', '╮', '┛', '╰' ]
endif
return a:config
endfunction
" Boilerplate {{{ " Boilerplate {{{
let &cpoptions=s:save_cpo let &cpoptions=s:save_cpo
unlet s:save_cpo unlet s:save_cpo

View file

@ -34,7 +34,6 @@ function! vimspector#internal#state#Reset() abort
catch /.*/ catch /.*/
echohl WarningMsg echohl WarningMsg
echom 'Exception while loading vimspector:' v:exception echom 'Exception while loading vimspector:' v:exception
echom 'From:' v:throwpoint
echom 'Vimspector unavailable: Requires Vim compiled with Python 3.6' echom 'Vimspector unavailable: Requires Vim compiled with Python 3.6'
echohl None echohl None
return v:false return v:false

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -28,5 +28,3 @@ gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# Performance-booster for watching directories on Windows # Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform? gem "wdm", "~> 0.1.0" if Gem.win_platform?
gem "webrick", "~> 1.7"

View file

@ -1,13 +1,13 @@
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
activesupport (6.0.3.6) activesupport (6.0.3.2)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
tzinfo (~> 1.1) tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2) zeitwerk (~> 2.2, >= 2.2.2)
addressable (2.8.0) addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (>= 2.0.2, < 5.0)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
@ -16,49 +16,46 @@ GEM
colorator (1.1.0) colorator (1.1.0)
commonmarker (0.17.13) commonmarker (0.17.13)
ruby-enum (~> 0.5) ruby-enum (~> 0.5)
concurrent-ruby (1.1.8) concurrent-ruby (1.1.7)
dnsruby (1.61.5) dnsruby (1.61.4)
simpleidn (~> 0.1) simpleidn (~> 0.1)
em-websocket (0.5.2) em-websocket (0.5.1)
eventmachine (>= 0.12.9) eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0) http_parser.rb (~> 0.6.0)
ethon (0.12.0) ethon (0.12.0)
ffi (>= 1.3.0) ffi (>= 1.3.0)
eventmachine (1.2.7) eventmachine (1.2.7)
execjs (2.7.0) execjs (2.7.0)
faraday (1.3.0) faraday (1.0.1)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
ruby2_keywords ffi (1.13.1)
faraday-net_http (1.0.1)
ffi (1.15.0)
forwardable-extended (2.6.0) forwardable-extended (2.6.0)
gemoji (3.0.1) gemoji (3.0.1)
github-pages (214) github-pages (207)
github-pages-health-check (= 1.17.0) github-pages-health-check (= 1.16.1)
jekyll (= 3.9.0) jekyll (= 3.9.0)
jekyll-avatar (= 0.7.0) jekyll-avatar (= 0.7.0)
jekyll-coffeescript (= 1.1.1) jekyll-coffeescript (= 1.1.1)
jekyll-commonmark-ghpages (= 0.1.6) jekyll-commonmark-ghpages (= 0.1.6)
jekyll-default-layout (= 0.1.4) jekyll-default-layout (= 0.1.4)
jekyll-feed (= 0.15.1) jekyll-feed (= 0.13.0)
jekyll-gist (= 1.5.0) jekyll-gist (= 1.5.0)
jekyll-github-metadata (= 2.13.0) jekyll-github-metadata (= 2.13.0)
jekyll-mentions (= 1.6.0) jekyll-mentions (= 1.5.1)
jekyll-optional-front-matter (= 0.3.2) jekyll-optional-front-matter (= 0.3.2)
jekyll-paginate (= 1.1.0) jekyll-paginate (= 1.1.0)
jekyll-readme-index (= 0.3.0) jekyll-readme-index (= 0.3.0)
jekyll-redirect-from (= 0.16.0) jekyll-redirect-from (= 0.15.0)
jekyll-relative-links (= 0.6.1) jekyll-relative-links (= 0.6.1)
jekyll-remote-theme (= 0.4.3) jekyll-remote-theme (= 0.4.1)
jekyll-sass-converter (= 1.5.2) jekyll-sass-converter (= 1.5.2)
jekyll-seo-tag (= 2.7.1) jekyll-seo-tag (= 2.6.1)
jekyll-sitemap (= 1.4.0) jekyll-sitemap (= 1.4.0)
jekyll-swiss (= 1.0.0) jekyll-swiss (= 1.0.0)
jekyll-theme-architect (= 0.1.1) jekyll-theme-architect (= 0.1.1)
jekyll-theme-cayman (= 0.1.1) jekyll-theme-cayman (= 0.1.1)
jekyll-theme-dinky (= 0.1.1) jekyll-theme-dinky (= 0.1.1)
jekyll-theme-hacker (= 0.1.2) jekyll-theme-hacker (= 0.1.1)
jekyll-theme-leap-day (= 0.1.1) jekyll-theme-leap-day (= 0.1.1)
jekyll-theme-merlot (= 0.1.1) jekyll-theme-merlot (= 0.1.1)
jekyll-theme-midnight (= 0.1.1) jekyll-theme-midnight (= 0.1.1)
@ -69,20 +66,20 @@ GEM
jekyll-theme-tactile (= 0.1.1) jekyll-theme-tactile (= 0.1.1)
jekyll-theme-time-machine (= 0.1.1) jekyll-theme-time-machine (= 0.1.1)
jekyll-titles-from-headings (= 0.5.3) jekyll-titles-from-headings (= 0.5.3)
jemoji (= 0.12.0) jemoji (= 0.11.1)
kramdown (= 2.3.1) kramdown (= 2.3.0)
kramdown-parser-gfm (= 1.1.0) kramdown-parser-gfm (= 1.1.0)
liquid (= 4.0.3) liquid (= 4.0.3)
mercenary (~> 0.3) mercenary (~> 0.3)
minima (= 2.5.1) minima (= 2.5.1)
nokogiri (>= 1.10.4, < 2.0) nokogiri (>= 1.10.4, < 2.0)
rouge (= 3.26.0) rouge (= 3.19.0)
terminal-table (~> 1.4) terminal-table (~> 1.4)
github-pages-health-check (1.17.0) github-pages-health-check (1.16.1)
addressable (~> 2.3) addressable (~> 2.3)
dnsruby (~> 1.60) dnsruby (~> 1.60)
octokit (~> 4.0) octokit (~> 4.0)
public_suffix (>= 2.0.2, < 5.0) public_suffix (~> 3.0)
typhoeus (~> 1.3) typhoeus (~> 1.3)
html-pipeline (2.14.0) html-pipeline (2.14.0)
activesupport (>= 2) activesupport (>= 2)
@ -117,14 +114,14 @@ GEM
rouge (>= 2.0, < 4.0) rouge (>= 2.0, < 4.0)
jekyll-default-layout (0.1.4) jekyll-default-layout (0.1.4)
jekyll (~> 3.0) jekyll (~> 3.0)
jekyll-feed (0.15.1) jekyll-feed (0.13.0)
jekyll (>= 3.7, < 5.0) jekyll (>= 3.7, < 5.0)
jekyll-gist (1.5.0) jekyll-gist (1.5.0)
octokit (~> 4.2) octokit (~> 4.2)
jekyll-github-metadata (2.13.0) jekyll-github-metadata (2.13.0)
jekyll (>= 3.4, < 5.0) jekyll (>= 3.4, < 5.0)
octokit (~> 4.0, != 4.4.0) octokit (~> 4.0, != 4.4.0)
jekyll-mentions (1.6.0) jekyll-mentions (1.5.1)
html-pipeline (~> 2.3) html-pipeline (~> 2.3)
jekyll (>= 3.7, < 5.0) jekyll (>= 3.7, < 5.0)
jekyll-optional-front-matter (0.3.2) jekyll-optional-front-matter (0.3.2)
@ -132,19 +129,18 @@ GEM
jekyll-paginate (1.1.0) jekyll-paginate (1.1.0)
jekyll-readme-index (0.3.0) jekyll-readme-index (0.3.0)
jekyll (>= 3.0, < 5.0) jekyll (>= 3.0, < 5.0)
jekyll-redirect-from (0.16.0) jekyll-redirect-from (0.15.0)
jekyll (>= 3.3, < 5.0) jekyll (>= 3.3, < 5.0)
jekyll-relative-links (0.6.1) jekyll-relative-links (0.6.1)
jekyll (>= 3.3, < 5.0) jekyll (>= 3.3, < 5.0)
jekyll-remote-theme (0.4.3) jekyll-remote-theme (0.4.1)
addressable (~> 2.0) addressable (~> 2.0)
jekyll (>= 3.5, < 5.0) jekyll (>= 3.5, < 5.0)
jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) rubyzip (>= 1.3.0)
rubyzip (>= 1.3.0, < 3.0)
jekyll-sass-converter (1.5.2) jekyll-sass-converter (1.5.2)
sass (~> 3.4) sass (~> 3.4)
jekyll-seo-tag (2.7.1) jekyll-seo-tag (2.6.1)
jekyll (>= 3.8, < 5.0) jekyll (>= 3.3, < 5.0)
jekyll-sitemap (1.4.0) jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0) jekyll (>= 3.7, < 5.0)
jekyll-swiss (1.0.0) jekyll-swiss (1.0.0)
@ -157,8 +153,8 @@ GEM
jekyll-theme-dinky (0.1.1) jekyll-theme-dinky (0.1.1)
jekyll (~> 3.5) jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0) jekyll-seo-tag (~> 2.0)
jekyll-theme-hacker (0.1.2) jekyll-theme-hacker (0.1.1)
jekyll (> 3.5, < 5.0) jekyll (~> 3.5)
jekyll-seo-tag (~> 2.0) jekyll-seo-tag (~> 2.0)
jekyll-theme-leap-day (0.1.1) jekyll-theme-leap-day (0.1.1)
jekyll (~> 3.5) jekyll (~> 3.5)
@ -192,44 +188,41 @@ GEM
jekyll (>= 3.3, < 5.0) jekyll (>= 3.3, < 5.0)
jekyll-watch (2.2.1) jekyll-watch (2.2.1)
listen (~> 3.0) listen (~> 3.0)
jemoji (0.12.0) jemoji (0.11.1)
gemoji (~> 3.0) gemoji (~> 3.0)
html-pipeline (~> 2.2) html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0) jekyll (>= 3.0, < 5.0)
kramdown (2.3.1) kramdown (2.3.0)
rexml rexml
kramdown-parser-gfm (1.1.0) kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0) kramdown (~> 2.0)
liquid (4.0.3) liquid (4.0.3)
listen (3.5.1) listen (3.2.1)
rb-fsevent (~> 0.10, >= 0.10.3) rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10) rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6) mercenary (0.3.6)
mini_portile2 (2.5.1) mini_portile2 (2.4.0)
minima (2.5.1) minima (2.5.1)
jekyll (>= 3.5, < 5.0) jekyll (>= 3.5, < 5.0)
jekyll-feed (~> 0.9) jekyll-feed (~> 0.9)
jekyll-seo-tag (~> 2.1) jekyll-seo-tag (~> 2.1)
minitest (5.14.4) minitest (5.14.1)
multipart-post (2.1.1) multipart-post (2.1.1)
nokogiri (1.11.5) nokogiri (1.10.10)
mini_portile2 (~> 2.5.0) mini_portile2 (~> 2.4.0)
racc (~> 1.4) octokit (4.18.0)
octokit (4.20.0)
faraday (>= 0.9) faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3) sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.2) pathutil (0.16.2)
forwardable-extended (~> 2.6) forwardable-extended (~> 2.6)
public_suffix (4.0.6) public_suffix (3.1.1)
racc (1.5.2)
rb-fsevent (0.10.4) rb-fsevent (0.10.4)
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
rexml (3.2.5) rexml (3.2.4)
rouge (3.26.0) rouge (3.19.0)
ruby-enum (0.9.0) ruby-enum (0.8.0)
i18n i18n
ruby2_keywords (0.0.4)
rubyzip (2.3.0) rubyzip (2.3.0)
safe_yaml (1.0.5) safe_yaml (1.0.5)
sass (3.7.4) sass (3.7.4)
@ -240,21 +233,20 @@ GEM
sawyer (0.8.2) sawyer (0.8.2)
addressable (>= 2.3.5) addressable (>= 2.3.5)
faraday (> 0.8, < 2.0) faraday (> 0.8, < 2.0)
simpleidn (0.2.1) simpleidn (0.1.1)
unf (~> 0.1.4) unf (~> 0.1.4)
terminal-table (1.8.0) terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1) unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6) thread_safe (0.3.6)
typhoeus (1.4.0) typhoeus (1.4.0)
ethon (>= 0.9.0) ethon (>= 0.9.0)
tzinfo (1.2.9) tzinfo (1.2.7)
thread_safe (~> 0.1) thread_safe (~> 0.1)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.7) unf_ext (0.0.7.7)
unicode-display_width (1.7.0) unicode-display_width (1.7.0)
webrick (1.7.0) zeitwerk (2.4.0)
zeitwerk (2.4.2)
PLATFORMS PLATFORMS
ruby ruby
@ -264,7 +256,6 @@ DEPENDENCIES
jekyll-feed (~> 0.6) jekyll-feed (~> 0.6)
minima (~> 2.0) minima (~> 2.0)
tzinfo-data tzinfo-data
webrick (~> 1.7)
BUNDLED WITH BUNDLED WITH
2.2.3 2.0.2

View file

@ -1,7 +1,7 @@
To update/install: To update/install:
gem install bundler gem install bundler
bundle install --path vendor/bundle bundle install
To run a local server/test the build To run a local server/test the build

View file

@ -12,8 +12,7 @@ for Vimspector.
* [Debug profile configuration](#debug-profile-configuration) * [Debug profile configuration](#debug-profile-configuration)
* [Replacements and variables](#replacements-and-variables) * [Replacements and variables](#replacements-and-variables)
* [The splat operator](#the-splat-operator) * [The splat operator](#the-splat-operator)
* [Default values](#default-values) * [Default values](#default-values)
* [Coercing Types](#coercing-types)
* [Configuration Format](#configuration-format) * [Configuration Format](#configuration-format)
* [Files and locations](#files-and-locations) * [Files and locations](#files-and-locations)
* [Adapter configurations](#adapter-configurations) * [Adapter configurations](#adapter-configurations)
@ -21,7 +20,7 @@ for Vimspector.
* [Configuration selection](#configuration-selection) * [Configuration selection](#configuration-selection)
* [Specifying a default configuration](#specifying-a-default-configuration) * [Specifying a default configuration](#specifying-a-default-configuration)
* [Preventing automatic selection](#preventing-automatic-selection) * [Preventing automatic selection](#preventing-automatic-selection)
* [Exception Breakpoints](#exception-breakpoints) * [Exception breakpionts](#exception-breakpionts)
* [Predefined Variables](#predefined-variables) * [Predefined Variables](#predefined-variables)
* [Remote Debugging Support](#remote-debugging-support) * [Remote Debugging Support](#remote-debugging-support)
* [Python (debugpy) Example](#python-debugpy-example) * [Python (debugpy) Example](#python-debugpy-example)
@ -30,7 +29,7 @@ for Vimspector.
* [Appendix: Configuration file format](#appendix-configuration-file-format) * [Appendix: Configuration file format](#appendix-configuration-file-format)
* [Appendix: Editor configuration](#appendix-editor-configuration) * [Appendix: Editor configuration](#appendix-editor-configuration)
<!-- Added by: ben, at: Thu 13 Aug 2020 17:42:11 BST --> <!-- Added by: ben, at: Fri 31 Jul 2020 22:13:39 BST -->
<!--te--> <!--te-->
@ -165,7 +164,7 @@ the following variable substitutions:
the shell command. Note these variables can be supplied by both the debug and the shell command. Note these variables can be supplied by both the debug and
adapter configurations and can be either static strings or shell commands. adapter configurations and can be either static strings or shell commands.
#### The splat operator ### The splat operator
Often we want to create a single `.vimspector.json` entry which encompasses many Often we want to create a single `.vimspector.json` entry which encompasses many
use cases, as it is tedious to write every use case/start up option in JSON. use cases, as it is tedious to write every use case/start up option in JSON.
@ -206,7 +205,7 @@ You can also combine with static values:
This would yield the intuitive result: This would yield the intuitive result:
`[ "First", "one", "two three", "four", "Last" ]` `[ "First", "one", "two three", "four", "Last" ]`
#### Default values ### Default values
You can specify replacements with default values. In this case if the user has You can specify replacements with default values. In this case if the user has
not specified a value, they are prompted but with the default value not specified a value, they are prompted but with the default value
@ -237,7 +236,7 @@ the closing `}`. For example, the is a common and useful case:
This will prompt the user to specify `script`, but it will default to the path This will prompt the user to specify `script`, but it will default to the path
to the current file. to the current file.
#### Coercing Types ### Coercing Types
Sometimes, you want to provide an option for a boolean parameter, or want to Sometimes, you want to provide an option for a boolean parameter, or want to
allow the user to specify more than just strings. Vimspector allows you to do allow the user to specify more than just strings. Vimspector allows you to do
@ -271,7 +270,7 @@ JSON value `true`, and the suffix is stripped fom the key, resulting in the
following: following:
```json ```json
"stopOnEntry": true "stopOnEntry#json": true
``` ```
Which is what we need. Which is what we need.
@ -283,7 +282,7 @@ can force Vimspector to treat the value as a string by appending `#s`, as in:
"unlikelyKeyName#json#s": "this is a string, not JSON data" "unlikelyKeyName#json#s": "this is a string, not JSON data"
``` ```
***Advanced usage:*** #### Advanced usage
The most common usage for this is for number and bool types, but it works for The most common usage for this is for number and bool types, but it works for
objects too. If you want to be able to specify a whole object (e.g. a whole objects too. If you want to be able to specify a whole object (e.g. a whole
@ -633,26 +632,19 @@ Vimspector then orchestrates the various tools to set you up.
// Command to launch the debugee and attach the debugger; // Command to launch the debugee and attach the debugger;
// %CMD% replaced with the remote-cmdLine configured in the launch // %CMD% replaced with the remote-cmdLine configured in the launch
// configuration. (mandatory) // configuration. (mandatory)
"runCommand": [ "launchCommmand": [
"python", "-m", "debugpy", "python", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"--listen", "0.0.0.0:${port}",
"--wait-for-client",
"%CMD%" "%CMD%"
] ]
// Optional alternative to runCommand (if you need to run multiple // Optional alternative to launchCommmand (if you need to run multiple
// commands) // commands)
// "runCommands": [ // "launchCommmands": [
// [ /* first command */ ], // [ /* first command */ ],
// [ /* second command */ ] // [ /* second command */ ]
// ] // ]
} }
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP, or if you're using some
// wrapper (e.g. to start the JVM)
// "delay": "1000m" // format as per :help sleep
}, },
"attach": { "attach": {
"remote": { "remote": {
@ -692,10 +684,6 @@ Vimspector then orchestrates the various tools to set you up.
// "args": [ "-o", "StrictHostKeyChecking=no" ] // "args": [ "-o", "StrictHostKeyChecking=no" ]
// }, // },
} }
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP, or if you're using some
// wrapper (e.g. to start the JVM)
// "delay": "1000m" // format as per :help sleep
} }
} }
}, },
@ -722,7 +710,7 @@ Vimspector then orchestrates the various tools to set you up.
"variables": { "variables": {
// Just an example of how to specify a variable manually rather than // Just an example of how to specify a variable manually rather than
// vimspector asking for input from the user // vimspector asking for input from the user
"ServiceName": "${fileBasenameNoExtension}" "ServiceName": "${fileBasenameNoExtention}"
}, },
"adapter": "python-remote", "adapter": "python-remote",
@ -765,7 +753,7 @@ and have to tell cpptools a few more options.
"remote": { "remote": {
"host": "${host}", "host": "${host}",
"account": "${account}", "account": "${account}",
"runCommand": [ "launchCommmand": [
"gdbserver", "gdbserver",
"--once", "--once",
"--no-startup-with-shell", "--no-startup-with-shell",
@ -849,25 +837,19 @@ port.
// Command to launch the debugee and attach the debugger; // Command to launch the debugee and attach the debugger;
// %CMD% replaced with the remote-cmdLine configured in the launch // %CMD% replaced with the remote-cmdLine configured in the launch
// configuration. (mandatory) // configuration. (mandatory)
"runCommand": [ "launchCommmand": [
"python", "-m", "debugpy", "python", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"--listen", "0.0.0.0:${port}",
"--wait-for-client",
"%CMD%" "%CMD%"
] ]
// Optional alternative to runCommand (if you need to run multiple // Optional alternative to launchCommmand (if you need to run multiple
// commands) // commands)
// "runCommands": [ // "launchCommmands": [
// [ /* first command */ ], // [ /* first command */ ],
// [ /* second command */ ] // [ /* second command */ ]
// ] // ]
} }
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP
"delay": "1000m" // format as per :help sleep
}, },
"attach": { "attach": {
"remote": { "remote": {
@ -903,11 +885,6 @@ port.
// ] // ]
} }
// optional delay to wait after running runCommand(s). This is often
// needed because of the way docker handles TCP, or if you're using some
// wrapper (e.g. to start the JVM)
"delay": "1000m" // format as per :help sleep
} }
} }
}, },

View file

@ -38,144 +38,11 @@
] ]
} }
}, },
"adapter-launchattach": { "adapter-common": {
"properties": {
"launch": {
"allOf": [
{ "$ref": "#/definitions/adapter-remote" },
{
"properties": {
"delay": {
"type": "string",
"description": "A time in the format understood by :help :sleep to wait after running the attachCommand(s)"
}
}
}
]
},
"attach": {
"allOf": [
{ "$ref": "#/definitions/adapter-remote" },
{
"type": "object",
"required": [ "pidSelect" ],
"properties": {
"pidSelect": {
"enum": [ "ask", "none" ]
},
"pidProperty": {
"type": "string",
"description": "The launch config property which the PID should be injected into. Required when 'pidSelect' is 'ask'."
},
"delay": {
"type": "string",
"description": "A time in the format understood by :help :sleep to wait after running the attachCommand(s)"
}
}
}
]
}
}
},
"adapter-remote": {
"type": "object",
"properties": {
"remote": {
"type": "object",
"description": "Configures how Vimspector will marshal remote debugging requests. When remote debugging, Vimspector will either ssh to 'account'@'host' or docker exec -it to 'container' and run 'pidCommand', 'attachCommands', 'runCommands', etc. based on the 'remote-command' option in the debug configuration. If 'remote-command' is 'launch', it runs 'runCommand(s)', otherwise (it's 'attach') vimspector runs 'pidCommand', followed by 'attachCommand(s)'.Then it starts up the debug adapter with the debug configuration as normal. Usually this is configured with an 'attach' request (whether we remotely 'launched' or not). Once the initialization exchange is complete, Vimspector runs the optional 'initCompleteCommand' which can be used to force the application to break, e.g. by sending it SIGINT. This is required on some platforms which have buggy gdbservers (for example)",
"allOf": [
{
"oneOf": [
{ "required": [ "host" ] },
{ "required": [ "container" ] }
]
},
{
"properties": {
"account": {
"type": "string",
"description": "Remote account name used when ssh'ing. Defaults to the current user account."
},
"host": {
"type": "string",
"description": "Name of the remote host to connect to (via passwordless SSH)."
},
"container": {
"type": "string",
"description": "Name or container id of the docker run container to connect to (via docker exec). Note the container must already be running (Vimspector will not start it) and it must have the port forwarded to the host if subsequently connecting via a port (for example <tt>docker run -p 8765:8765 -it simple_python</tt>)."
}
}
},
{
"oneOf": [
{
"allOf": [
{
"oneOf": [
{ "required": [ "attachCommand" ] },
{ "required": [ "attachCommands" ] }
]
},
{
"properties": {
"initCompleteCommand": {
"type": "array",
"items": { "type": "string" },
"description": "For remote-attach. Remote command to execute after initialization of the debug adapter. Can be used to work around buggy attach behaviour on certain platforms (advanced usage). Can contain the special token %PID% which is replaced with the PID returned by 'pidCommand'"
},
"pidCommand": {
"type": "array",
"items": { "type": "string" },
"description": "Required for remote-attach. Remote command to execute to return the PID to attach to."
},
"attachCommands": {
"type": [ "array" ],
"items": { "type": "array", "items": { "type": "string" } },
"description": "For remote-attach. List of commands to execute remotely to set up the attach. Can contain the special token %PID% which is replaced with the PID returned by the remote 'pidCommand'."
},
"attachCommand": {
"type": "array",
"items": { "type": "string" },
"description": "A single command to execute for remote-attach. Like attachCommands but for a single command. If attachCommands is supplied, this is not used."
}
}
}
]
},
{
"allOf": [
{
"oneOf": [
{ "required": [ "runCommand" ] },
{ "required": [ "runCommands" ] }
]
},
{
"properties": {
"runCommands": {
"type": [ "array" ],
"items": { "type": "array", "items": { "type": "string" } },
"description": "For remote-launch. List of commands to execute remotely to set up the launch. An entry in the array can be the special token '%CMD%' which is replaced with the evaluated 'remote-cmdLine' value in the debug configuration. This is useful to parameterize launcging remotely under something like gdbserver."
},
"runCommand": {
"type": "array",
"items": { "type": "string" },
"description": "A single command to execute for remote-launch. Like runCommands but for a single command."
}
}
}
]
}
]
}
]
}
}
},
"adapter": {
"allOf": [ "allOf": [
{ "type": "object" },
{ "$ref": "#/definitions/variables" }, { "$ref": "#/definitions/variables" },
{ "$ref": "#/definitions/adapter-remote" },
{ "$ref": "#/definitions/adapter-attach" },
{ {
"properties": { "properties": {
"name": { "name": {
@ -187,30 +54,136 @@
"description": "Base debug configuration. Can be used to set default values for all debug configurations. When reading individual debug configurations from 'configurations', those configurations are merged with this object. Definitions in the debug configuration override anything in this object. Typical usage for this is to set the 'type' parameter, which some debug adapters are very picky about, or to set e.g. the path to an underlying debugger." "description": "Base debug configuration. Can be used to set default values for all debug configurations. When reading individual debug configurations from 'configurations', those configurations are merged with this object. Definitions in the debug configuration override anything in this object. Typical usage for this is to set the 'type' parameter, which some debug adapters are very picky about, or to set e.g. the path to an underlying debugger."
} }
} }
}, }
{ "$ref": "#/definitions/adapter-launchattach" }, ]
},
"adapter-attach": {
"properties": {
"attach": {
"type": "object",
"required": [ "pidSelect" ],
"properties": {
"pidSelect": {
"enum": [ "ask", "none" ]
},
"pidProperty": {
"type": "string",
"description": "The launch config property which the PID should be injected into. Required when 'pidSelect' is 'ask'."
}
}
}
}
},
"adapter-remote": {
"properties": {
"remote": {
"type": "object",
"oneOf": [
{
"required": [
"host"
]
},
{
"required": [
"container"
]
}
],
"description": "Configures how Vimspector will marshal remote debugging requests. When remote debugging, Vimspector will either ssh to 'account'@'host' or docker exec -it to 'container' and run 'pidCommand', 'attachCommands', 'runCommands', etc. based on the 'remote-command' option in the debug configuration. If 'remote-command' is 'launch', it runs 'runCommand(s)', otherwise (it's 'attach') vimspector runs 'pidCommand', followed by 'attachCommand(s)'.Then it starts up the debug adapter with the debug configuration as normal. Usually this is configured with an 'attach' request (whether we remotely 'launched' or not). Once the initialization exchange is complete, Vimspector runs the optional 'initCompleteCommand' which can be used to force the application to break, e.g. by sending it SIGINT. This is required on some platforms which have buggy gdbservers (for example)",
"properties": {
"account": {
"type": "string",
"description": "Remote account name used when ssh'ing. Defaults to the current user account."
},
"host": {
"type": "string",
"description": "Name of the remote host to connect to (via passwordless SSH)."
},
"container": {
"type": "string",
"description": "Name or container id of the docker run container to connect to (via docker exec -it)."
},
"pidCommand": {
"type": "array",
"items": { "type": "string" },
"description": "Required for remote-attach. Remote command to execute to return the PID to attach to."
},
"initCompleteCommand": {
"type": "array",
"items": { "type": "string" },
"description": "For remote-attach. Remote command to execute after initialization of the debug adapter. Can be used to work around buggy attach behaviour on certain platforms (advanced usage). Can contain the special token %PID% which is replaced with the PID returned by 'pidCommand'"
},
"attachCommands": {
"type": [ "array" ],
"items": { "type": "array", "items": { "type": "string" } },
"description": "For remote-attach. List of commands to execute remotely to set up the attach. Can contain the special token %PID% which is replaced with the PID returned by the remote 'pidCommand'."
},
"attachCommand": {
"type": "array",
"items": { "type": "string" },
"description": "A single command to execute for remote-attach. Like attachCommands but for a single command. If attachCommands is supplied, this is not used."
},
"runCommands": {
"type": [ "array" ],
"items": { "type": "array", "items": { "type": "string" } },
"description": "For remote-launch. List of commands to execute remotely to set up the launch. An entry in the array can be the special token '%CMD%' which is replaced with the evaluated 'remote-cmdLine' value in the debug configuration. This is useful to parameterize launcging remotely under something like gdbserver."
},
"runCommand": {
"type": "array",
"items": { "type": "string" },
"description": "A single command to execute for remote-launch. Like runCommands but for a single command."
}
}
}
}
},
"adapter": {
"oneOf": [
{ {
"anyOf": [ "allOf": [
{ "required": [ "command" ] }, { "$ref": "#/definitions/adapter-common" },
{ "required": [ "port" ] }, {
{ "required": [ "command", "port" ] } "required": [ "port" ],
"properties": {
"port": {
"oneOf": [
{
"type": "string",
"enum": [ "ask" ]
},
{
"type": "integer"
}
],
"description": "If supplied, indicates that a socket connection should be made to this port on 'localhost'. If the value is 'ask', then the user is asked to enter the port number to connect to."
}
}
}
] ]
}, },
{ {
"properties": { "allOf": [
"host": { { "$ref": "#/definitions/adapter-common" },
"type": "string", {
"default": "127.0.0.1", "required": [ "command" ],
"description": "Connect to this host in multi-session mode" "properties": {
}, "command": {
"port": { "type": [ "string", "array" ],
"oneOf": [ "description": "Command line to execute the debug adapter.",
{ "type": "string" }, "items": { "type": "string" }
{ "type": "integer" } },
], "env": {
"description": "If supplied, indicates that a socket connection should be made to this port on 'host'. If the value is 'ask', then the user is asked to enter the port number to connect to." "type": "object",
"description": "Name/value pairs to set in the environment when starting the adapter."
},
"cwd": {
"type": "string",
"description": "Directory from which to start the adapter. Defaults to the working directory of the window on launch"
}
}
} }
} ]
} }
] ]
} }

View file

@ -114,35 +114,32 @@ parser.add_argument( '--sudo',
done_languages = set() done_languages = set()
for name, gadget in gadgets.GADGETS.items(): for name, gadget in gadgets.GADGETS.items():
langs = gadget[ 'language' ] lang = gadget[ 'language' ]
if not isinstance( langs, list ): if lang in done_languages:
langs = [ langs ] continue
for lang in langs:
if lang in done_languages:
continue
done_languages.add( lang )
if not gadget.get( 'enabled', True ):
parser.add_argument(
'--force-enable-' + lang,
action = 'store_true',
help = 'Install the unsupported {} debug adapter for {} support'.format(
name,
lang ) )
continue
done_languages.add( lang )
if not gadget.get( 'enabled', True ):
parser.add_argument( parser.add_argument(
'--enable-' + lang, '--force-enable-' + lang,
action = 'store_true', action = 'store_true',
help = 'Install the {} debug adapter for {} support'.format( help = 'Install the unsupported {} debug adapter for {} support'.format(
name, name,
lang ) ) lang ) )
continue
parser.add_argument( parser.add_argument(
'--disable-' + lang, '--enable-' + lang,
action = 'store_true', action = 'store_true',
help = "Don't install the {} debug adapter for {} support " help = 'Install the {} debug adapter for {} support'.format(
'(when supplying --all)'.format( name, lang ) ) name,
lang ) )
parser.add_argument(
'--disable-' + lang,
action = 'store_true',
help = "Don't install the {} debug adapter for {} support "
'(when supplying --all)'.format( name, lang ) )
parser.add_argument( parser.add_argument(
"--no-check-certificate", "--no-check-certificate",
@ -185,25 +182,15 @@ all_adapters = installer.ReadAdapters(
manifest = installer.Manifest() manifest = installer.Manifest()
for name, gadget in gadgets.GADGETS.items(): for name, gadget in gadgets.GADGETS.items():
langs = gadget[ 'language' ] if not gadget.get( 'enabled', True ):
if not isinstance( langs, list ): if ( not args.force_all
langs = [ langs ] and not getattr( args, 'force_enable_' + gadget[ 'language' ] ) ):
skip = 0 continue
for lang in langs: else:
if not gadget.get( 'enabled', True ): if not args.all and not getattr( args, 'enable_' + gadget[ 'language' ] ):
if ( not args.force_all continue
and not getattr( args, 'force_enable_' + lang ) ): if getattr( args, 'disable_' + gadget[ 'language' ] ):
skip = skip + 1 continue
continue
else:
if not args.all and not getattr( args, 'enable_' + lang ):
skip = skip + 1
continue
if getattr( args, 'disable_' + lang ):
skip = skip + 1
continue
if skip == len( langs ):
continue
if not args.upgrade: if not args.upgrade:
manifest.Clear( name ) manifest.Clear( name )

View file

@ -13,13 +13,6 @@
" See the License for the specific language governing permissions and " See the License for the specific language governing permissions and
" limitations under the License. " limitations under the License.
if !has( 'python3' )
echohl WarningMsg
echom 'Vimspector unavailable: Requires Vim compiled with +python3'
echohl None
finish
endif
" Boilerplate {{{ " Boilerplate {{{
let s:save_cpo = &cpoptions let s:save_cpo = &cpoptions
set cpoptions&vim set cpoptions&vim
@ -35,6 +28,11 @@ if exists( 'g:loaded_vimpector' )
endif endif
"}}} "}}}
" TODO:
" - Check Vim version (for jobs)
" - Check python support
" - Add commands/mappings/menus?
let g:loaded_vimpector = 1 let g:loaded_vimpector = 1
let g:vimspector_home = expand( '<sfile>:p:h:h' ) let g:vimspector_home = expand( '<sfile>:p:h:h' )
@ -42,8 +40,6 @@ let s:mappings = get( g:, 'vimspector_enable_mappings', '' )
nnoremap <silent> <Plug>VimspectorContinue nnoremap <silent> <Plug>VimspectorContinue
\ :<c-u>call vimspector#Continue()<CR> \ :<c-u>call vimspector#Continue()<CR>
nnoremap <silent> <Plug>VimspectorLaunch
\ :<c-u>call vimspector#Launch( v:true )<CR>
nnoremap <silent> <Plug>VimspectorStop nnoremap <silent> <Plug>VimspectorStop
\ :<c-u>call vimspector#Stop()<CR> \ :<c-u>call vimspector#Stop()<CR>
nnoremap <silent> <Plug>VimspectorRestart nnoremap <silent> <Plug>VimspectorRestart
@ -66,21 +62,6 @@ nnoremap <silent> <Plug>VimspectorStepInto
nnoremap <silent> <Plug>VimspectorStepOut nnoremap <silent> <Plug>VimspectorStepOut
\ :<c-u>call vimspector#StepOut()<CR> \ :<c-u>call vimspector#StepOut()<CR>
nnoremap <silent> <Plug>VimspectorRunToCursor
\ :<c-u>call vimspector#RunToCursor()<CR>
" Eval for normal mode
nnoremap <silent> <Plug>VimspectorBalloonEval
\ :<c-u>call vimspector#ShowEvalBalloon( 0 )<CR>
" And for visual modes
xnoremap <silent> <Plug>VimspectorBalloonEval
\ :<c-u>call vimspector#ShowEvalBalloon( 1 )<CR>
nnoremap <silent> <Plug>VimspectorUpFrame
\ :<c-u>call vimspector#UpFrame()<CR>
nnoremap <silent> <Plug>VimspectorDownFrame
\ :<c-u>call vimspector#DownFrame()<CR>
if s:mappings ==# 'VISUAL_STUDIO' if s:mappings ==# 'VISUAL_STUDIO'
nmap <F5> <Plug>VimspectorContinue nmap <F5> <Plug>VimspectorContinue
nmap <S-F5> <Plug>VimspectorStop nmap <S-F5> <Plug>VimspectorStop
@ -93,14 +74,12 @@ if s:mappings ==# 'VISUAL_STUDIO'
nmap <S-F11> <Plug>VimspectorStepOut nmap <S-F11> <Plug>VimspectorStepOut
elseif s:mappings ==# 'HUMAN' elseif s:mappings ==# 'HUMAN'
nmap <F5> <Plug>VimspectorContinue nmap <F5> <Plug>VimspectorContinue
nmap <leader><F5> <Plug>VimspectorLaunch
nmap <F3> <Plug>VimspectorStop nmap <F3> <Plug>VimspectorStop
nmap <F4> <Plug>VimspectorRestart nmap <F4> <Plug>VimspectorRestart
nmap <F6> <Plug>VimspectorPause nmap <F6> <Plug>VimspectorPause
nmap <F9> <Plug>VimspectorToggleBreakpoint nmap <F9> <Plug>VimspectorToggleBreakpoint
nmap <leader><F9> <Plug>VimspectorToggleConditionalBreakpoint nmap <leader><F9> <Plug>VimspectorToggleConditionalBreakpoint
nmap <F8> <Plug>VimspectorAddFunctionBreakpoint nmap <F8> <Plug>VimspectorAddFunctionBreakpoint
nmap <leader><F8> <Plug>VimspectorRunToCursor
nmap <F10> <Plug>VimspectorStepOver nmap <F10> <Plug>VimspectorStepOver
nmap <F11> <Plug>VimspectorStepInto nmap <F11> <Plug>VimspectorStepInto
nmap <F12> <Plug>VimspectorStepOut nmap <F12> <Plug>VimspectorStepOut
@ -115,15 +94,12 @@ command! -bar -nargs=? -complete=custom,vimspector#CompleteOutput
command! -bar command! -bar
\ VimspectorToggleLog \ VimspectorToggleLog
\ call vimspector#ToggleLog() \ call vimspector#ToggleLog()
command! -bar command! -bar -nargs=1 -complete=custom,vimspector#CompleteExpr
\ VimspectorDebugInfo
\ call vimspector#PrintDebugInfo()
command! -nargs=1 -complete=custom,vimspector#CompleteExpr
\ VimspectorEval \ VimspectorEval
\ call vimspector#Evaluate( <f-args> ) \ call vimspector#Evaluate( <f-args> )
command! -bar command! -bar
\ VimspectorReset \ VimspectorReset
\ call vimspector#Reset( { 'interactive': v:true } ) \ call vimspector#Reset()
" Installer commands " Installer commands
command! -bar -bang -nargs=* -complete=custom,vimspector#CompleteInstall command! -bar -bang -nargs=* -complete=custom,vimspector#CompleteInstall
@ -140,17 +116,9 @@ command! -bar -nargs=0
" Dummy autocommands so that we can call this whenever " Dummy autocommands so that we can call this whenever
augroup VimspectorUserAutoCmds augroup VimspectorUserAutoCmds
autocmd! au!
autocmd User VimspectorUICreated silent au User VimspectorUICreated silent
autocmd User VimspectorTerminalOpened silent au User VimspectorTerminalOpened silent
autocmd user VimspectorJumpedToFrame silent
autocmd user VimspectorDebugEnded silent
augroup END
" FIXME: Only register this _while_ debugging is active
augroup Vimspector
autocmd!
autocmd BufNew * call vimspector#OnBufferCreated( expand( '<afile>' ) )
augroup END augroup END
" boilerplate {{{ " boilerplate {{{

View file

@ -141,123 +141,50 @@ class ProjectBreakpoints( object ):
self.UpdateUI() self.UpdateUI()
def _FindLineBreakpoint( self, file_name, line ):
file_name = os.path.abspath( file_name )
for index, bp in enumerate( self._line_breakpoints[ file_name ] ):
self._SignToLine( file_name, bp )
if bp[ 'line' ] == line:
return bp, index
return None, None
def _PutLineBreakpoint( self, file_name, line, options ):
self._line_breakpoints[ os.path.abspath( file_name ) ].append( {
'state': 'ENABLED',
'line': line,
'options': options,
# 'sign_id': <filled in when placed>,
#
# Used by other breakpoint types (specified in options):
# 'condition': ...,
# 'hitCondition': ...,
# 'logMessage': ...
} )
def _DeleteLineBreakpoint( self, bp, file_name, index ):
if 'sign_id' in bp:
signs.UnplaceSign( bp[ 'sign_id' ], 'VimspectorBP' )
del self._line_breakpoints[ os.path.abspath( file_name ) ][ index ]
def ToggleBreakpoint( self, options ): def ToggleBreakpoint( self, options ):
line, _ = vim.current.window.cursor line, column = vim.current.window.cursor
file_name = vim.current.buffer.name file_name = vim.current.buffer.name
if not file_name: if not file_name:
return return
bp, index = self._FindLineBreakpoint( file_name, line ) found_bp = False
if bp is None: action = 'New'
# ADD for index, bp in enumerate( self._line_breakpoints[ file_name ] ):
self._PutLineBreakpoint( file_name, line, options ) self._SignToLine( file_name, bp )
elif bp[ 'state' ] == 'ENABLED' and not self._connection: if bp[ 'line' ] == line:
# DISABLE found_bp = True
bp[ 'state' ] = 'DISABLED' if bp[ 'state' ] == 'ENABLED' and not self._connection:
else: bp[ 'state' ] = 'DISABLED'
# DELETE action = 'Disable'
self._DeleteLineBreakpoint( bp, file_name, index ) else:
if 'sign_id' in bp:
signs.UnplaceSign( bp[ 'sign_id' ], 'VimspectorBP' )
del self._line_breakpoints[ file_name ][ index ]
action = 'Delete'
break
self._logger.debug( "Toggle found bp at {}:{} ? {} ({})".format(
file_name,
line,
found_bp,
action ) )
if not found_bp:
self._line_breakpoints[ file_name ].append( {
'state': 'ENABLED',
'line': line,
'options': options,
# 'sign_id': <filled in when placed>,
#
# Used by other breakpoint types (specified in options):
# 'condition': ...,
# 'hitCondition': ...,
# 'logMessage': ...
} )
self.UpdateUI() self.UpdateUI()
def SetLineBreakpoint( self, file_name, line_num, options, then = None ):
bp, _ = self._FindLineBreakpoint( file_name, line_num )
if bp is not None:
bp[ 'options' ] = options
return
self._PutLineBreakpoint( file_name, line_num, options )
self.UpdateUI( then )
def ClearLineBreakpoint( self, file_name, line_num ):
bp, index = self._FindLineBreakpoint( file_name, line_num )
if bp is None:
return
self._DeleteLineBreakpoint( bp, file_name, index )
self.UpdateUI()
def ClearTemporaryBreakpoint( self, file_name, line_num ):
bp, index = self._FindLineBreakpoint( file_name, line_num )
if bp is None:
return
if bp[ 'options' ].get( 'temporary' ):
self._DeleteLineBreakpoint( bp, file_name, index )
self.UpdateUI()
def ClearTemporaryBreakpoints( self ):
to_delete = []
for file_name, breakpoints in self._line_breakpoints.items():
for index, bp in enumerate( breakpoints ):
if bp[ 'options' ].get( 'temporary' ):
to_delete.append( ( bp, file_name, index ) )
for entry in to_delete:
self._DeleteLineBreakpoint( *entry )
def _UpdateTemporaryBreakpoints( self, breakpoints, temp_idxs ):
# adjust any temporary breakpoints to match the server result
# TODO: Maybe now is the time to ditch the split breakpoints nonesense
for temp_idx, user_bp in temp_idxs:
if temp_idx >= len( breakpoints ):
# Just can't trust servers ?
self._logger.debug( "Server Error - invalid breakpoints list did not "
"contain entry for temporary breakpoint at index "
f"{ temp_idx } i.e. { user_bp }" )
continue
bp = breakpoints[ temp_idx ]
if 'line' not in bp or not bp[ 'verified' ]:
utils.UserMessage(
"Unable to set temporary breakpoint at line "
f"{ user_bp[ 'line' ] } execution will continue...",
persist = True,
error = True )
self._logger.debug( f"Updating temporary breakpoint { user_bp } line "
f"{ user_bp[ 'line' ] } to { bp[ 'line' ] }" )
# if it was moved, update the user-breakpoint so that we unset it
# again properly
user_bp[ 'line' ] = bp[ 'line' ]
def AddFunctionBreakpoint( self, function, options ): def AddFunctionBreakpoint( self, function, options ):
self._func_breakpoints.append( { self._func_breakpoints.append( {
'state': 'ENABLED', 'state': 'ENABLED',
@ -273,13 +200,11 @@ class ProjectBreakpoints( object ):
self.UpdateUI() self.UpdateUI()
def UpdateUI( self, then = None ): def UpdateUI( self ):
if self._connection: if self._connection:
self.SendBreakpoints( then ) self.SendBreakpoints()
else: else:
self._ShowBreakpoints() self._ShowBreakpoints()
if then:
then()
def SetBreakpointsHandler( self, handler ): def SetBreakpointsHandler( self, handler ):
@ -299,25 +224,15 @@ class ProjectBreakpoints( object ):
awaiting = 0 awaiting = 0
def response_received( *failure_args ): def response_received():
nonlocal awaiting nonlocal awaiting
awaiting = awaiting - 1 awaiting = awaiting - 1
if failure_args and self._connection:
reason, msg = failure_args
utils.UserMessage( 'Unable to set breakpoint: {0}'.format( reason ),
persist = True,
error = True )
if awaiting == 0 and doneHandler: if awaiting == 0 and doneHandler:
doneHandler() doneHandler()
def response_handler( source, msg, temp_idxs = [] ): def response_handler( source, msg ):
if msg: if msg:
self._breakpoints_handler.AddBreakpoints( source, msg ) self._breakpoints_handler.AddBreakpoints( source, msg )
breakpoints = ( msg.get( 'body' ) or {} ).get( 'breakpoints' ) or []
self._UpdateTemporaryBreakpoints( breakpoints, temp_idxs )
response_received() response_received()
@ -328,9 +243,9 @@ class ProjectBreakpoints( object ):
# TODO: add the _configured_breakpoints to line_breakpoints # TODO: add the _configured_breakpoints to line_breakpoints
# TODO: the line numbers might have changed since pressing the F9 key!
for file_name, line_breakpoints in self._line_breakpoints.items(): for file_name, line_breakpoints in self._line_breakpoints.items():
temp_idxs = []
breakpoints = [] breakpoints = []
for bp in line_breakpoints: for bp in line_breakpoints:
self._SignToLine( file_name, bp ) self._SignToLine( file_name, bp )
@ -344,15 +259,8 @@ class ProjectBreakpoints( object ):
dap_bp = {} dap_bp = {}
dap_bp.update( bp[ 'options' ] ) dap_bp.update( bp[ 'options' ] )
dap_bp.update( { 'line': bp[ 'line' ] } ) dap_bp.update( { 'line': bp[ 'line' ] } )
dap_bp.pop( 'temporary', None )
if bp[ 'options' ].get( 'temporary' ):
temp_idxs.append( [ len( breakpoints ), bp ] )
breakpoints.append( dap_bp ) breakpoints.append( dap_bp )
source = { source = {
'name': os.path.basename( file_name ), 'name': os.path.basename( file_name ),
'path': file_name, 'path': file_name,
@ -360,13 +268,7 @@ class ProjectBreakpoints( object ):
awaiting = awaiting + 1 awaiting = awaiting + 1
self._connection.DoRequest( self._connection.DoRequest(
# The source=source here is critical to ensure that we capture each lambda msg: response_handler( source, msg ),
# source in the iteration, rather than ending up passing the same source
# to each callback.
lambda msg, source=source, temp_idxs=temp_idxs: response_handler(
source,
msg,
temp_idxs = temp_idxs ),
{ {
'command': 'setBreakpoints', 'command': 'setBreakpoints',
'arguments': { 'arguments': {
@ -375,7 +277,7 @@ class ProjectBreakpoints( object ):
}, },
'sourceModified': False, # TODO: We can actually check this 'sourceModified': False, # TODO: We can actually check this
}, },
failure_handler = response_received failure_handler = lambda *_: response_received()
) )
# TODO: Add the _configured_breakpoints to function breakpoints # TODO: Add the _configured_breakpoints to function breakpoints
@ -399,7 +301,7 @@ class ProjectBreakpoints( object ):
'breakpoints': breakpoints, 'breakpoints': breakpoints,
} }
}, },
failure_handler = response_received failure_handler = lambda *_: response_received()
) )
if self._exception_breakpoints: if self._exception_breakpoints:
@ -410,7 +312,7 @@ class ProjectBreakpoints( object ):
'command': 'setExceptionBreakpoints', 'command': 'setExceptionBreakpoints',
'arguments': self._exception_breakpoints 'arguments': self._exception_breakpoints
}, },
failure_handler = response_received failure_handler = lambda *_: response_received()
) )
if awaiting == 0 and doneHandler: if awaiting == 0 and doneHandler:
@ -467,12 +369,6 @@ class ProjectBreakpoints( object ):
# pay any attention to them anyway. # pay any attention to them anyway.
self._exception_breakpoints[ 'exceptionOptions' ] = [] self._exception_breakpoints[ 'exceptionOptions' ] = []
def Refresh( self, file_name ):
# TODO: Just this file ?
self._ShowBreakpoints()
def _ShowBreakpoints( self ): def _ShowBreakpoints( self ):
for file_name, line_breakpoints in self._line_breakpoints.items(): for file_name, line_breakpoints in self._line_breakpoints.items():
for bp in line_breakpoints: for bp in line_breakpoints:
@ -487,21 +383,17 @@ class ProjectBreakpoints( object ):
else 'vimspectorBPCond' if 'condition' in bp[ 'options' ] else 'vimspectorBPCond' if 'condition' in bp[ 'options' ]
else 'vimspectorBP' ) else 'vimspectorBP' )
if utils.BufferExists( file_name ): signs.PlaceSign( bp[ 'sign_id' ],
signs.PlaceSign( bp[ 'sign_id' ], 'VimspectorBP',
'VimspectorBP', sign,
sign, file_name,
file_name, bp[ 'line' ] )
bp[ 'line' ] )
def _SignToLine( self, file_name, bp ): def _SignToLine( self, file_name, bp ):
if 'sign_id' not in bp: if 'sign_id' not in bp:
return bp[ 'line' ] return bp[ 'line' ]
if not utils.BufferExists( file_name ):
return bp[ 'line' ]
signs = vim.eval( "sign_getplaced( '{}', {} )".format( signs = vim.eval( "sign_getplaced( '{}', {} )".format(
utils.Escape( file_name ), utils.Escape( file_name ),
json.dumps( { 'id': bp[ 'sign_id' ], 'group': 'VimspectorBP', } ) ) ) json.dumps( { 'id': bp[ 'sign_id' ], 'group': 'VimspectorBP', } ) ) )

View file

@ -32,7 +32,6 @@ class CodeView( object ):
self._logger = logging.getLogger( __name__ ) self._logger = logging.getLogger( __name__ )
utils.SetUpLogging( self._logger ) utils.SetUpLogging( self._logger )
# FIXME: This ID is by group, so should be module scope
self._next_sign_id = 1 self._next_sign_id = 1
self._breakpoints = defaultdict( list ) self._breakpoints = defaultdict( list )
self._signs = { self._signs = {
@ -42,25 +41,14 @@ class CodeView( object ):
self._current_frame = None self._current_frame = None
with utils.LetCurrentWindow( self._window ): with utils.LetCurrentWindow( self._window ):
if utils.UseWinBar(): vim.command( 'nnoremenu WinBar.■\\ Stop :call vimspector#Stop()<CR>' )
# Buggy neovim doesn't render correctly when the WinBar is defined: vim.command( 'nnoremenu WinBar.▶\\ Cont :call vimspector#Continue()<CR>' )
# https://github.com/neovim/neovim/issues/12689 vim.command( 'nnoremenu WinBar.▷\\ Pause :call vimspector#Pause()<CR>' )
vim.command( 'nnoremenu WinBar.■\\ Stop ' vim.command( 'nnoremenu WinBar.↷\\ Next :call vimspector#StepOver()<CR>' )
':call vimspector#Stop()<CR>' ) vim.command( 'nnoremenu WinBar.→\\ Step :call vimspector#StepInto()<CR>' )
vim.command( 'nnoremenu WinBar.▶\\ Cont ' vim.command( 'nnoremenu WinBar.←\\ Out :call vimspector#StepOut()<CR>' )
':call vimspector#Continue()<CR>' ) vim.command( 'nnoremenu WinBar.⟲: :call vimspector#Restart()<CR>' )
vim.command( 'nnoremenu WinBar.▷\\ Pause ' vim.command( 'nnoremenu WinBar.✕ :call vimspector#Reset()<CR>' )
':call vimspector#Pause()<CR>' )
vim.command( 'nnoremenu WinBar.↷\\ Next '
':call vimspector#StepOver()<CR>' )
vim.command( 'nnoremenu WinBar.→\\ Step '
':call vimspector#StepInto()<CR>' )
vim.command( 'nnoremenu WinBar.←\\ Out '
':call vimspector#StepOut()<CR>' )
vim.command( 'nnoremenu WinBar.⟲: '
':call vimspector#Restart()<CR>' )
vim.command( 'nnoremenu WinBar.✕ '
':call vimspector#Reset()<CR>' )
if not signs.SignDefined( 'vimspectorPC' ): if not signs.SignDefined( 'vimspectorPC' ):
signs.DefineSign( 'vimspectorPC', signs.DefineSign( 'vimspectorPC',
@ -105,12 +93,16 @@ class CodeView( object ):
sign = 'vimspectorPCBP' sign = 'vimspectorPCBP'
break break
if utils.BufferExists( frame[ 'source' ][ 'path' ] ): try:
signs.PlaceSign( self._signs[ 'vimspectorPC' ], signs.PlaceSign( self._signs[ 'vimspectorPC' ],
'VimspectorCode', 'VimspectorCode',
sign, sign,
frame[ 'source' ][ 'path' ], frame[ 'source' ][ 'path' ],
frame[ 'line' ] ) frame[ 'line' ] )
except vim.error as e:
# Ignore 'invalid buffer name'
if 'E158' not in str( e ):
raise
def SetCurrentFrame( self, frame ): def SetCurrentFrame( self, frame ):
@ -127,6 +119,7 @@ class CodeView( object ):
return False return False
self._current_frame = frame self._current_frame = frame
self._DisplayPC()
if not self._window.valid: if not self._window.valid:
return False return False
@ -134,7 +127,6 @@ class CodeView( object ):
utils.JumpToWindow( self._window ) utils.JumpToWindow( self._window )
try: try:
utils.OpenFileInCurrentWindow( frame[ 'source' ][ 'path' ] ) utils.OpenFileInCurrentWindow( frame[ 'source' ][ 'path' ] )
vim.command( 'doautocmd <nomodeline> User VimspectorJumpedToFrame' )
except vim.error: except vim.error:
self._logger.exception( 'Unexpected vim error opening file {}'.format( self._logger.exception( 'Unexpected vim error opening file {}'.format(
frame[ 'source' ][ 'path' ] ) ) frame[ 'source' ][ 'path' ] ) )
@ -156,8 +148,6 @@ class CodeView( object ):
self.current_syntax = utils.ToUnicode( self.current_syntax = utils.ToUnicode(
vim.current.buffer.options[ 'syntax' ] ) vim.current.buffer.options[ 'syntax' ] )
self.ShowBreakpoints()
return True return True
def Clear( self ): def Clear( self ):
@ -175,29 +165,25 @@ class CodeView( object ):
def AddBreakpoints( self, source, breakpoints ): def AddBreakpoints( self, source, breakpoints ):
for breakpoint in breakpoints: for breakpoint in breakpoints:
source = breakpoint.get( 'source' ) or source if 'source' not in breakpoint:
if not source or 'path' not in source: if source:
self._logger.warn( 'missing source/path in breakpoint {0}'.format( breakpoint[ 'source' ] = source
json.dumps( breakpoint ) ) ) else:
continue self._logger.warn( 'missing source in breakpoint {0}'.format(
json.dumps( breakpoint ) ) )
continue
breakpoint[ 'source' ] = source self._breakpoints[ breakpoint[ 'source' ][ 'path' ] ].append(
self._breakpoints[ source[ 'path' ] ].append( breakpoint ) breakpoint )
self._logger.debug( 'Breakpoints at this point: {0}'.format( self._logger.debug( 'Breakpoints at this point: {0}'.format(
json.dumps( self._breakpoints, indent = 2 ) ) ) json.dumps( self._breakpoints, indent = 2 ) ) )
self.ShowBreakpoints() self.ShowBreakpoints()
def AddBreakpoint( self, breakpoint ):
self.AddBreakpoints( None, [ breakpoint ] )
def UpdateBreakpoint( self, bp ): def UpdateBreakpoint( self, bp ):
if 'id' not in bp: if 'id' not in bp:
self.AddBreakpoint( bp ) self.AddBreakpoints( None, [ bp ] )
return
for _, breakpoint_list in self._breakpoints.items(): for _, breakpoint_list in self._breakpoints.items():
for index, breakpoint in enumerate( breakpoint_list ): for index, breakpoint in enumerate( breakpoint_list ):
@ -207,27 +193,7 @@ class CodeView( object ):
return return
# Not found. Assume new # Not found. Assume new
self.AddBreakpoint( bp ) self.AddBreakpoints( None, [ bp ] )
def RemoveBreakpoint( self, bp ):
for _, breakpoint_list in self._breakpoints.items():
found_index = None
for index, breakpoint in enumerate( breakpoint_list ):
if 'id' in breakpoint and breakpoint[ 'id' ] == bp[ 'id' ]:
found_index = index
break
if found_index is not None:
del breakpoint_list[ found_index ]
self.ShowBreakpoints()
return
def Refresh( self, file_name ):
# TODO: jsut the file ?
self.ShowBreakpoints()
def _UndisplaySigns( self ): def _UndisplaySigns( self ):
for sign_id in self._signs[ 'breakpoints' ]: for sign_id in self._signs[ 'breakpoints' ]:
@ -250,13 +216,12 @@ class CodeView( object ):
sign_id = self._next_sign_id sign_id = self._next_sign_id
self._next_sign_id += 1 self._next_sign_id += 1
self._signs[ 'breakpoints' ].append( sign_id ) self._signs[ 'breakpoints' ].append( sign_id )
if utils.BufferExists( file_name ): signs.PlaceSign( sign_id,
signs.PlaceSign( sign_id, 'VimspectorCode',
'VimspectorCode', 'vimspectorBP' if breakpoint[ 'verified' ]
'vimspectorBP' if breakpoint[ 'verified' ] else 'vimspectorBPDisabled',
else 'vimspectorBPDisabled', file_name,
file_name, breakpoint[ 'line' ] )
breakpoint[ 'line' ] )
# We need to also check if there's a breakpoint on this PC line and chnge # We need to also check if there's a breakpoint on this PC line and chnge
# the PC # the PC

View file

@ -1,51 +0,0 @@
# vimspector - A multi-language debugging system for Vim
# Copyright 2021 Ben Jackson
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from vimspector.debug_session import DebugSession
from vimspector import utils, settings
class JavaDebugAdapter( object ):
def __init__( self, debug_session: DebugSession ):
self.debug_session = debug_session
def OnEvent_hotcodereplace( self, message ):
# Hack for java debug server hot-code-replace
body = message.get( 'body' ) or {}
if body.get( 'type' ) != 'hotcodereplace':
return
if body.get( 'changeType' ) == 'BUILD_COMPLETE':
def handler( result ):
if result == 1:
self.debug_session._connection.DoRequest( None, {
'command': 'redefineClasses',
'arguments': {},
} )
mode = settings.Get( 'java_hotcodereplace_mode' )
if mode == 'ask':
utils.Confirm( self.debug_session._api_prefix,
'Code has changed, hot reload?',
handler,
default_value = 1 )
elif mode == 'always':
self.debug_session._connection.DoRequest( None, {
'command': 'redefineClasses',
'arguments': {},
} )
elif body.get( 'message' ):
utils.UserMessage( 'Hot code replace: ' + body[ 'message' ] )

View file

@ -29,14 +29,14 @@ class PendingRequest( object ):
class DebugAdapterConnection( object ): class DebugAdapterConnection( object ):
def __init__( self, handlers, send_func ): def __init__( self, handler, send_func ):
self._logger = logging.getLogger( __name__ ) self._logger = logging.getLogger( __name__ )
utils.SetUpLogging( self._logger ) utils.SetUpLogging( self._logger )
self._Write = send_func self._Write = send_func
self._SetState( 'READ_HEADER' ) self._SetState( 'READ_HEADER' )
self._buffer = bytes() self._buffer = bytes()
self._handlers = handlers self._handler = handler
self._next_message_id = 0 self._next_message_id = 0
self._outstanding_requests = {} self._outstanding_requests = {}
@ -124,7 +124,7 @@ class DebugAdapterConnection( object ):
def Reset( self ): def Reset( self ):
self._Write = None self._Write = None
self._handlers = None self._handler = None
while self._outstanding_requests: while self._outstanding_requests:
_, request = self._outstanding_requests.popitem() _, request = self._outstanding_requests.popitem()
@ -169,10 +169,6 @@ class DebugAdapterConnection( object ):
self._headers = {} self._headers = {}
def _SendMessage( self, msg ): def _SendMessage( self, msg ):
if not self._Write:
# Connection was destroyed
return False
msg = json.dumps( msg ) msg = json.dumps( msg )
self._logger.debug( 'Sending Message: {0}'.format( msg ) ) self._logger.debug( 'Sending Message: {0}'.format( msg ) )
@ -226,12 +222,7 @@ class DebugAdapterConnection( object ):
# self._logger.debug( 'Message received (raw): %s', payload ) # self._logger.debug( 'Message received (raw): %s', payload )
try: message = json.loads( payload )
message = json.loads( payload, strict = False )
except Exception:
self._logger.exception( "Invalid message received: %s", payload )
self._SetState( 'READ_HEADER' )
raise
self._logger.debug( 'Message received: {0}'.format( message ) ) self._logger.debug( 'Message received: {0}'.format( message ) )
@ -242,7 +233,7 @@ class DebugAdapterConnection( object ):
def _OnMessageReceived( self, message ): def _OnMessageReceived( self, message ):
if not self._handlers: if not self._handler:
return return
if message[ 'type' ] == 'response': if message[ 'type' ] == 'response':
@ -275,21 +266,25 @@ class DebugAdapterConnection( object ):
self._logger.error( 'Request failed: {0}'.format( reason ) ) self._logger.error( 'Request failed: {0}'.format( reason ) )
if request.failure_handler: if request.failure_handler:
request.failure_handler( reason, message ) request.failure_handler( reason, message )
elif 'OnFailure' in dir( self._handler ):
self._handler.OnFailure( reason, request.msg, message )
else: else:
for h in self._handlers: utils.UserMessage( 'Request failed: {0}'.format( reason ) )
if 'OnFailure' in dir( h ):
h.OnFailure( reason, request.msg, message )
elif message[ 'type' ] == 'event': elif message[ 'type' ] == 'event':
method = 'OnEvent_' + message[ 'event' ] method = 'OnEvent_' + message[ 'event' ]
for h in self._handlers: if method in dir( self._handler ):
if method in dir( h ): getattr( self._handler, method )( message )
getattr( h, method )( message ) else:
utils.UserMessage( 'Unhandled event: {0}'.format( message[ 'event' ] ),
persist = True )
elif message[ 'type' ] == 'request': elif message[ 'type' ] == 'request':
method = 'OnRequest_' + message[ 'command' ] method = 'OnRequest_' + message[ 'command' ]
for h in self._handlers: if method in dir( self._handler ):
if method in dir( h ): getattr( self._handler, method )( message )
getattr( h, method )( message ) else:
utils.UserMessage(
'Unhandled request: {0}'.format( message[ 'command' ] ),
persist = True )
def _KillTimer( request ): def _KillTimer( request ):

View file

@ -21,7 +21,6 @@ import shlex
import subprocess import subprocess
import functools import functools
import vim import vim
import importlib
from vimspector import ( breakpoints, from vimspector import ( breakpoints,
code, code,
@ -69,7 +68,6 @@ class DebugSession( object ):
self._configuration = None self._configuration = None
self._adapter = None self._adapter = None
self._launch_config = None
self._ResetServerState() self._ResetServerState()
@ -79,28 +77,8 @@ class DebugSession( object ):
self._launch_complete = False self._launch_complete = False
self._on_init_complete_handlers = [] self._on_init_complete_handlers = []
self._server_capabilities = {} self._server_capabilities = {}
self.ClearTemporaryBreakpoints()
def GetConfigurations( self, adapters ): def Start( self, launch_variables = None ):
current_file = utils.GetBufferFilepath( vim.current.buffer )
filetypes = utils.GetBufferFiletypes( vim.current.buffer )
configurations = {}
for launch_config_file in PathsToAllConfigFiles( VIMSPECTOR_HOME,
current_file,
filetypes ):
self._logger.debug( f'Reading configurations from: {launch_config_file}' )
if not launch_config_file or not os.path.exists( launch_config_file ):
continue
with open( launch_config_file, 'r' ) as f:
database = json.loads( minify( f.read() ) )
configurations.update( database.get( 'configurations' ) or {} )
adapters.update( database.get( 'adapters' ) or {} )
return launch_config_file, configurations
def Start( self, force_choose=False, launch_variables = None ):
# We mutate launch_variables, so don't mutate the default argument. # We mutate launch_variables, so don't mutate the default argument.
# https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments # https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments
if launch_variables is None: if launch_variables is None:
@ -110,17 +88,11 @@ class DebugSession( object ):
launch_variables ) launch_variables )
self._configuration = None self._configuration = None
self._adapter = None self._adapter = None
self._launch_config = None
current_file = utils.GetBufferFilepath( vim.current.buffer ) current_file = utils.GetBufferFilepath( vim.current.buffer )
filetypes = utils.GetBufferFiletypes( vim.current.buffer )
configurations = {}
adapters = {} adapters = {}
launch_config_file, configurations = self.GetConfigurations( adapters )
if not configurations:
utils.UserMessage( 'Unable to find any debug configurations. '
'You need to tell vimspector how to launch your '
'application.' )
return
glob.glob( install.GetGadgetDir( VIMSPECTOR_HOME ) ) glob.glob( install.GetGadgetDir( VIMSPECTOR_HOME ) )
for gadget_config_file in PathsToAllGadgetConfigs( VIMSPECTOR_HOME, for gadget_config_file in PathsToAllGadgetConfigs( VIMSPECTOR_HOME,
@ -133,13 +105,26 @@ class DebugSession( object ):
a = json.loads( minify( f.read() ) ).get( 'adapters' ) or {} a = json.loads( minify( f.read() ) ).get( 'adapters' ) or {}
adapters.update( a ) adapters.update( a )
for launch_config_file in PathsToAllConfigFiles( VIMSPECTOR_HOME,
current_file,
filetypes ):
self._logger.debug( f'Reading configurations from: {launch_config_file}' )
if not launch_config_file or not os.path.exists( launch_config_file ):
continue
with open( launch_config_file, 'r' ) as f:
database = json.loads( minify( f.read() ) )
adapters.update( database.get( 'adapters' ) or {} )
configurations.update( database.get( 'configurations' or {} ) )
if not configurations:
utils.UserMessage( 'Unable to find any debug configurations. '
'You need to tell vimspector how to launch your '
'application.' )
return
if 'configuration' in launch_variables: if 'configuration' in launch_variables:
configuration_name = launch_variables.pop( 'configuration' ) configuration_name = launch_variables.pop( 'configuration' )
elif force_choose:
# Always display the menu
configuration_name = utils.SelectFromList(
'Which launch configuration?',
sorted( configurations.keys() ) )
elif ( len( configurations ) == 1 and elif ( len( configurations ) == 1 and
next( iter( configurations.values() ) ).get( "autoselect", True ) ): next( iter( configurations.values() ) ).get( "autoselect", True ) ):
configuration_name = next( iter( configurations.keys() ) ) configuration_name = next( iter( configurations.keys() ) )
@ -288,7 +273,6 @@ class DebugSession( object ):
def start(): def start():
self._configuration = configuration self._configuration = configuration
self._adapter = adapter self._adapter = adapter
self._launch_config = None
self._logger.info( 'Configuration: %s', self._logger.info( 'Configuration: %s',
json.dumps( self._configuration ) ) json.dumps( self._configuration ) )
@ -300,7 +284,6 @@ class DebugSession( object ):
else: else:
vim.current.tabpage = self._uiTab vim.current.tabpage = self._uiTab
self._Prepare()
self._StartDebugAdapter() self._StartDebugAdapter()
self._Initialise() self._Initialise()
@ -326,7 +309,7 @@ class DebugSession( object ):
if self._connection: if self._connection:
self._logger.debug( "_StopDebugAdapter with callback: start" ) self._logger.debug( "_StopDebugAdapter with callback: start" )
self._StopDebugAdapter( interactive = False, callback = start ) self._StopDebugAdapter( start )
return return
start() start()
@ -391,15 +374,14 @@ class DebugSession( object ):
self._connection = None self._connection = None
@IfConnected() @IfConnected()
def Stop( self, interactive = False ): def Stop( self ):
self._logger.debug( "Stop debug adapter with no callback" ) self._logger.debug( "Stop debug adapter with no callback" )
self._StopDebugAdapter( interactive = interactive ) self._StopDebugAdapter()
def Reset( self, interactive = False ): def Reset( self ):
if self._connection: if self._connection:
self._logger.debug( "Stop debug adapter with callback : self._Reset()" ) self._logger.debug( "Stop debug adapter with callback : self._Reset()" )
self._StopDebugAdapter( interactive = interactive, self._StopDebugAdapter( lambda: self._Reset() )
callback = lambda: self._Reset() )
else: else:
self._Reset() self._Reset()
@ -419,7 +401,6 @@ class DebugSession( object ):
self._outputView.Reset() self._outputView.Reset()
self._codeView.Reset() self._codeView.Reset()
vim.command( 'tabclose!' ) vim.command( 'tabclose!' )
vim.command( 'doautocmd <nomodeline> User VimspectorDebugEnded' )
self._stackTraceView = None self._stackTraceView = None
self._variablesView = None self._variablesView = None
self._outputView = None self._outputView = None
@ -442,98 +423,43 @@ class DebugSession( object ):
}, },
} ) } )
self._stackTraceView.OnContinued()
self._codeView.SetCurrentFrame( None )
@IfConnected() @IfConnected()
def StepInto( self ): def StepInto( self ):
threadId = self._stackTraceView.GetCurrentThreadId() if self._stackTraceView.GetCurrentThreadId() is None:
if threadId is None:
return return
def handler( *_ ): self._connection.DoRequest( None, {
self._stackTraceView.OnContinued( { 'threadId': threadId } )
self._codeView.SetCurrentFrame( None )
self._connection.DoRequest( handler, {
'command': 'stepIn', 'command': 'stepIn',
'arguments': { 'arguments': {
'threadId': threadId 'threadId': self._stackTraceView.GetCurrentThreadId()
}, },
} ) } )
@IfConnected() @IfConnected()
def StepOut( self ): def StepOut( self ):
threadId = self._stackTraceView.GetCurrentThreadId()
if threadId is None:
return
def handler( *_ ):
self._stackTraceView.OnContinued( { 'threadId': threadId } )
self._codeView.SetCurrentFrame( None )
self._connection.DoRequest( handler, {
'command': 'stepOut',
'arguments': {
'threadId': threadId
},
} )
def Continue( self ):
if not self._connection:
self.Start()
return
threadId = self._stackTraceView.GetCurrentThreadId()
if threadId is None:
utils.UserMessage( 'No current thread', persist = True )
return
def handler( msg ):
self._stackTraceView.OnContinued( {
'threadId': threadId,
'allThreadsContinued': ( msg.get( 'body' ) or {} ).get(
'allThreadsContinued',
True )
} )
self._codeView.SetCurrentFrame( None )
self._connection.DoRequest( handler, {
'command': 'continue',
'arguments': {
'threadId': threadId,
},
} )
@IfConnected()
def Pause( self ):
if self._stackTraceView.GetCurrentThreadId() is None: if self._stackTraceView.GetCurrentThreadId() is None:
utils.UserMessage( 'No current thread', persist = True )
return return
self._connection.DoRequest( None, { self._connection.DoRequest( None, {
'command': 'pause', 'command': 'stepOut',
'arguments': { 'arguments': {
'threadId': self._stackTraceView.GetCurrentThreadId(), 'threadId': self._stackTraceView.GetCurrentThreadId()
}, },
} ) } )
@IfConnected() def Continue( self ):
def PauseContinueThread( self ): if self._connection:
self._stackTraceView.PauseContinueThread() self._stackTraceView.Continue()
else:
self.Start()
@IfConnected() @IfConnected()
def SetCurrentThread( self ): def Pause( self ):
self._stackTraceView.SetCurrentThread() self._stackTraceView.Pause()
@IfConnected() @IfConnected()
def ExpandVariable( self, buf = None, line_num = None ): def ExpandVariable( self ):
self._variablesView.ExpandVariable( buf, line_num ) self._variablesView.ExpandVariable()
@IfConnected()
def SetVariableValue( self, new_value = None, buf = None, line_num = None ):
self._variablesView.SetVariableValue( new_value, buf, line_num )
@IfConnected() @IfConnected()
def AddWatch( self, expression ): def AddWatch( self, expression ):
@ -541,22 +467,21 @@ class DebugSession( object ):
expression ) expression )
@IfConnected() @IfConnected()
def EvaluateConsole( self, expression, verbose ): def EvaluateConsole( self, expression ):
self._outputView.Evaluate( self._stackTraceView.GetCurrentFrame(), self._outputView.Evaluate( self._stackTraceView.GetCurrentFrame(),
expression, expression )
verbose )
@IfConnected() @IfConnected()
def DeleteWatch( self ): def DeleteWatch( self ):
self._variablesView.DeleteWatch() self._variablesView.DeleteWatch()
@IfConnected() @IfConnected()
def ShowEvalBalloon( self, winnr, expression, is_hover ): def ShowBalloon( self, winnr, expression ):
"""Proxy: ballonexpr -> variables.ShowBallon"""
frame = self._stackTraceView.GetCurrentFrame() frame = self._stackTraceView.GetCurrentFrame()
# Check if RIP is in a frame # Check if RIP is in a frame
if frame is None: if frame is None:
self._logger.debug( 'Tooltip: Not in a stack frame' ) self._logger.debug( 'Balloon: Not in a stack frame' )
return '' return ''
# Check if cursor in code window # Check if cursor in code window
@ -567,24 +492,12 @@ class DebugSession( object ):
return '' return ''
# Return variable aware function # Return variable aware function
return self._variablesView.VariableEval( frame, expression, is_hover ) return self._variablesView.ShowBalloon( frame, expression )
def CleanUpTooltip( self ):
return self._variablesView.CleanUpTooltip()
@IfConnected() @IfConnected()
def ExpandFrameOrThread( self ): def ExpandFrameOrThread( self ):
self._stackTraceView.ExpandFrameOrThread() self._stackTraceView.ExpandFrameOrThread()
@IfConnected()
def UpFrame( self ):
self._stackTraceView.UpFrame()
@IfConnected()
def DownFrame( self ):
self._stackTraceView.DownFrame()
def ToggleLog( self ): def ToggleLog( self ):
if self._HasUI(): if self._HasUI():
return self.ShowOutput( 'Vimspector' ) return self.ShowOutput( 'Vimspector' )
@ -646,68 +559,10 @@ class DebugSession( object ):
return response[ 'body' ][ 'targets' ] return response[ 'body' ][ 'targets' ]
@IfConnected( otherwise=[] )
def GetCommandLineCompletions( self, ArgLead, prev_non_keyword_char ):
items = []
for candidate in self.GetCompletionsSync( ArgLead, prev_non_keyword_char ):
label = candidate.get( 'text', candidate[ 'label' ] )
start = prev_non_keyword_char - 1
if 'start' in candidate and 'length' in candidate:
start = candidate[ 'start' ]
items.append( ArgLead[ 0 : start ] + label )
return items
def RefreshSigns( self, file_name ):
if self._connection:
self._codeView.Refresh( file_name )
else:
self._breakpoints.Refresh( file_name )
def _SetUpUI( self ): def _SetUpUI( self ):
vim.command( 'tab split' ) vim.command( 'tab split' )
self._uiTab = vim.current.tabpage self._uiTab = vim.current.tabpage
mode = settings.Get( 'ui_mode' )
if mode == 'auto':
# Go vertical if there isn't enough horizontal space for at least:
# the left bar width
# + the code min width
# + the terminal min width
# + enough space for a sign column and number column?
min_width = ( settings.Int( 'sidebar_width' )
+ 1 + 2 + 3
+ settings.Int( 'code_minwidth' )
+ 1 + settings.Int( 'terminal_minwidth' ) )
min_height = ( settings.Int( 'code_minheight' ) + 1 +
settings.Int( 'topbar_height' ) + 1 +
settings.Int( 'bottombar_height' ) + 1 +
2 )
mode = ( 'vertical'
if vim.options[ 'columns' ] < min_width
else 'horizontal' )
if vim.options[ 'lines' ] < min_height:
mode = 'horizontal'
self._logger.debug( 'min_width/height: %s/%s, actual: %s/%s - result: %s',
min_width,
min_height,
vim.options[ 'columns' ],
vim.options[ 'lines' ],
mode )
if mode == 'vertical':
self._SetUpUIVertical()
else:
self._SetUpUIHorizontal()
def _SetUpUIHorizontal( self ):
# Code window # Code window
code_window = vim.current.window code_window = vim.current.window
self._codeView = code.CodeView( code_window, self._api_prefix ) self._codeView = code.CodeView( code_window, self._api_prefix )
@ -748,73 +603,12 @@ class DebugSession( object ):
# TODO: If/when we support multiple sessions, we'll need some way to # TODO: If/when we support multiple sessions, we'll need some way to
# indicate which tab was created and store all the tabs # indicate which tab was created and store all the tabs
vim.vars[ 'vimspector_session_windows' ] = { vim.vars[ 'vimspector_session_windows' ] = {
'mode': 'horizontal',
'tabpage': self._uiTab.number, 'tabpage': self._uiTab.number,
'code': utils.WindowID( code_window, self._uiTab ), 'code': utils.WindowID( code_window, self._uiTab ),
'stack_trace': utils.WindowID( stack_trace_window, self._uiTab ), 'stack_trace': utils.WindowID( stack_trace_window, self._uiTab ),
'variables': utils.WindowID( vars_window, self._uiTab ), 'variables': utils.WindowID( vars_window, self._uiTab ),
'watches': utils.WindowID( watch_window, self._uiTab ), 'watches': utils.WindowID( watch_window, self._uiTab ),
'output': utils.WindowID( output_window, self._uiTab ), 'output': utils.WindowID( output_window, self._uiTab ),
'eval': None # this is going to be updated every time eval popup is opened
}
with utils.RestoreCursorPosition():
with utils.RestoreCurrentWindow():
with utils.RestoreCurrentBuffer( vim.current.window ):
vim.command( 'doautocmd User VimspectorUICreated' )
def _SetUpUIVertical( self ):
# Code window
code_window = vim.current.window
self._codeView = code.CodeView( code_window, self._api_prefix )
# Call stack
vim.command(
f'topleft { settings.Int( "topbar_height" ) }new' )
stack_trace_window = vim.current.window
one_third = int( vim.eval( 'winwidth( 0 )' ) ) / 3
self._stackTraceView = stack_trace.StackTraceView( self,
stack_trace_window )
# Watches
vim.command( 'leftabove vertical new' )
watch_window = vim.current.window
# Variables
vim.command( 'leftabove vertical new' )
vars_window = vim.current.window
with utils.LetCurrentWindow( vars_window ):
vim.command( f'{ one_third }wincmd |' )
with utils.LetCurrentWindow( watch_window ):
vim.command( f'{ one_third }wincmd |' )
with utils.LetCurrentWindow( stack_trace_window ):
vim.command( f'{ one_third }wincmd |' )
self._variablesView = variables.VariablesView( vars_window,
watch_window )
# Output/logging
vim.current.window = code_window
vim.command( f'rightbelow { settings.Int( "bottombar_height" ) }new' )
output_window = vim.current.window
self._outputView = output.DAPOutputView( output_window,
self._api_prefix )
# TODO: If/when we support multiple sessions, we'll need some way to
# indicate which tab was created and store all the tabs
vim.vars[ 'vimspector_session_windows' ] = {
'mode': 'vertical',
'tabpage': self._uiTab.number,
'code': utils.WindowID( code_window, self._uiTab ),
'stack_trace': utils.WindowID( stack_trace_window, self._uiTab ),
'variables': utils.WindowID( vars_window, self._uiTab ),
'watches': utils.WindowID( watch_window, self._uiTab ),
'output': utils.WindowID( output_window, self._uiTab ),
'eval': None # this is going to be updated every time eval popup is opened
} }
with utils.RestoreCursorPosition(): with utils.RestoreCursorPosition():
with utils.RestoreCurrentWindow(): with utils.RestoreCurrentWindow():
@ -827,7 +621,7 @@ class DebugSession( object ):
self.SetCurrentFrame( None ) self.SetCurrentFrame( None )
@RequiresUI() @RequiresUI()
def SetCurrentFrame( self, frame, reason = '' ): def SetCurrentFrame( self, frame ):
if not frame: if not frame:
self._stackTraceView.Clear() self._stackTraceView.Clear()
self._variablesView.Clear() self._variablesView.Clear()
@ -835,16 +629,11 @@ class DebugSession( object ):
if not self._codeView.SetCurrentFrame( frame ): if not self._codeView.SetCurrentFrame( frame ):
return False return False
# the codeView.SetCurrentFrame already checked the frame was valid and if frame:
# countained a valid source self._variablesView.SetSyntax( self._codeView.current_syntax )
self._variablesView.SetSyntax( self._codeView.current_syntax ) self._stackTraceView.SetSyntax( self._codeView.current_syntax )
self._stackTraceView.SetSyntax( self._codeView.current_syntax ) self._variablesView.LoadScopes( frame )
self._variablesView.LoadScopes( frame ) self._variablesView.EvaluateWatches()
self._variablesView.EvaluateWatches()
if reason == 'stopped':
self._breakpoints.ClearTemporaryBreakpoint( frame[ 'source' ][ 'path' ],
frame[ 'line' ] )
return True return True
@ -863,6 +652,7 @@ class DebugSession( object ):
json.dumps( self._adapter ) ) json.dumps( self._adapter ) )
self._init_complete = False self._init_complete = False
self._on_init_complete_handlers = []
self._launch_complete = False self._launch_complete = False
self._run_on_server_exit = None self._run_on_server_exit = None
@ -878,9 +668,12 @@ class DebugSession( object ):
self._adapter[ 'port' ] = port self._adapter[ 'port' ] = port
self._connection_type = self._api_prefix + self._connection_type self._connection_type = self._api_prefix + self._connection_type
self._logger.debug( f"Connection Type: { self._connection_type }" )
self._adapter[ 'env' ] = self._adapter.get( 'env', {} ) # TODO: Do we actually need to copy and update or does Vim do that?
env = os.environ.copy()
if 'env' in self._adapter:
env.update( self._adapter[ 'env' ] )
self._adapter[ 'env' ] = env
if 'cwd' not in self._adapter: if 'cwd' not in self._adapter:
self._adapter[ 'cwd' ] = os.getcwd() self._adapter[ 'cwd' ] = os.getcwd()
@ -894,93 +687,56 @@ class DebugSession( object ):
self._splash_screen, self._splash_screen,
"Unable to start adapter" ) "Unable to start adapter" )
else: else:
if 'custom_handler' in self._adapter:
spec = self._adapter[ 'custom_handler' ]
if isinstance( spec, dict ):
module = spec[ 'module' ]
cls = spec[ 'class' ]
else:
module, cls = spec.rsplit( '.', 1 )
CustomHandler = getattr( importlib.import_module( module ), cls )
handlers = [ CustomHandler( self ), self ]
else:
handlers = [ self ]
self._connection = debug_adapter_connection.DebugAdapterConnection( self._connection = debug_adapter_connection.DebugAdapterConnection(
handlers, self,
lambda msg: utils.Call( lambda msg: utils.Call(
"vimspector#internal#{}#Send".format( self._connection_type ), "vimspector#internal#{}#Send".format( self._connection_type ),
msg ) ) msg ) )
self._logger.info( 'Debug Adapter Started' ) self._logger.info( 'Debug Adapter Started' )
def _StopDebugAdapter( self, interactive = False, callback = None ): def _StopDebugAdapter( self, callback = None ):
self._splash_screen = utils.DisplaySplash(
self._api_prefix,
self._splash_screen,
"Shutting down debug adapter..." )
def handler( *args ):
self._splash_screen = utils.HideSplash( self._api_prefix,
self._splash_screen )
if callback:
self._logger.debug( "Setting server exit handler before disconnect" )
assert not self._run_on_server_exit
self._run_on_server_exit = callback
vim.eval( 'vimspector#internal#{}#StopDebugSession()'.format(
self._connection_type ) )
arguments = {} arguments = {}
if self._server_capabilities.get( 'supportTerminateDebuggee' ):
# If we attached, we should _not_ terminate the debuggee
arguments[ 'terminateDebuggee' ] = False
def disconnect(): self._connection.DoRequest( handler, {
self._splash_screen = utils.DisplaySplash( 'command': 'disconnect',
self._api_prefix, 'arguments': arguments,
self._splash_screen, }, failure_handler = handler, timeout = 5000 )
"Shutting down debug adapter..." )
def handler( *args ): # TODO: Use the 'tarminate' request if supportsTerminateRequest set
self._splash_screen = utils.HideSplash( self._api_prefix,
self._splash_screen )
if callback:
self._logger.debug( "Setting server exit handler before disconnect" )
assert not self._run_on_server_exit
self._run_on_server_exit = callback
vim.eval( 'vimspector#internal#{}#StopDebugSession()'.format(
self._connection_type ) )
self._connection.DoRequest( handler, {
'command': 'disconnect',
'arguments': arguments,
}, failure_handler = handler, timeout = 5000 )
if not interactive:
disconnect()
elif not self._server_capabilities.get( 'supportTerminateDebuggee' ):
disconnect()
elif not self._stackTraceView.AnyThreadsRunning():
disconnect()
else:
def handle_choice( choice ):
if choice == 1:
# yes
arguments[ 'terminateDebuggee' ] = True
elif choice == 2:
# no
arguments[ 'terminateDebuggee' ] = False
elif choice <= 0:
# Abort
return
# Else, use server default
disconnect()
utils.Confirm( self._api_prefix,
"Terminate debuggee?",
handle_choice,
default_value = 3,
options = [ '(Y)es', '(N)o', '(D)efault' ],
keys = [ 'y', 'n', 'd' ] )
def _PrepareAttach( self, adapter_config, launch_config ): def _PrepareAttach( self, adapter_config, launch_config ):
attach_config = adapter_config.get( 'attach' ) atttach_config = adapter_config.get( 'attach' )
if not attach_config: if not atttach_config:
return return
if 'remote' in attach_config: if 'remote' in atttach_config:
# FIXME: We almost want this to feed-back variables to be expanded later, # FIXME: We almost want this to feed-back variables to be expanded later,
# e.g. expand variables when we use them, not all at once. This would # e.g. expand variables when we use them, not all at once. This would
# remove the whole %PID% hack. # remove the whole %PID% hack.
remote = attach_config[ 'remote' ] remote = atttach_config[ 'remote' ]
remote_exec_cmd = self._GetRemoteExecCommand( remote ) remote_exec_cmd = self._GetRemoteExecCommand( remote )
# FIXME: Why does this not use self._GetCommands ? # FIXME: Why does this not use self._GetCommands ?
@ -1021,23 +777,20 @@ class DebugSession( object ):
self._codeView._window, self._codeView._window,
self._remote_term ) self._remote_term )
else: else:
if attach_config[ 'pidSelect' ] == 'ask': if atttach_config[ 'pidSelect' ] == 'ask':
prop = attach_config[ 'pidProperty' ] prop = atttach_config[ 'pidProperty' ]
if prop not in launch_config: if prop not in launch_config:
pid = utils.AskForInput( 'Enter PID to attach to: ' ) pid = utils.AskForInput( 'Enter PID to attach to: ' )
if pid is None: if pid is None:
return return
launch_config[ prop ] = pid launch_config[ prop ] = pid
return return
elif attach_config[ 'pidSelect' ] == 'none': elif atttach_config[ 'pidSelect' ] == 'none':
return return
raise ValueError( 'Unrecognised pidSelect {0}'.format( raise ValueError( 'Unrecognised pidSelect {0}'.format(
attach_config[ 'pidSelect' ] ) ) atttach_config[ 'pidSelect' ] ) )
if 'delay' in attach_config:
utils.UserMessage( f"Waiting ( { attach_config[ 'delay' ] } )..." )
vim.command( f'sleep { attach_config[ "delay" ] }' )
def _PrepareLaunch( self, command_line, adapter_config, launch_config ): def _PrepareLaunch( self, command_line, adapter_config, launch_config ):
@ -1070,11 +823,6 @@ class DebugSession( object ):
self._codeView._window, self._codeView._window,
self._remote_term ) self._remote_term )
if 'delay' in run_config:
utils.UserMessage( f"Waiting ( {run_config[ 'delay' ]} )..." )
vim.command( f'sleep { run_config[ "delay" ] }' )
def _GetSSHCommand( self, remote ): def _GetSSHCommand( self, remote ):
ssh = [ 'ssh' ] + remote.get( 'ssh', {} ).get( 'args', [] ) ssh = [ 'ssh' ] + remote.get( 'ssh', {} ).get( 'args', [] )
@ -1148,7 +896,6 @@ class DebugSession( object ):
def handle_initialize_response( msg ): def handle_initialize_response( msg ):
self._server_capabilities = msg.get( 'body' ) or {} self._server_capabilities = msg.get( 'body' ) or {}
self._breakpoints.SetServerCapabilities( self._server_capabilities ) self._breakpoints.SetServerCapabilities( self._server_capabilities )
self._variablesView.SetServerCapabilities( self._server_capabilities )
self._Launch() self._Launch()
self._connection.DoRequest( handle_initialize_response, { self._connection.DoRequest( handle_initialize_response, {
@ -1174,44 +921,40 @@ class DebugSession( object ):
message ) message )
self._outputView.Print( 'server', msg ) self._outputView.Print( 'server', msg )
def _Launch( self ):
def _Prepare( self ):
self._on_init_complete_handlers = []
self._logger.debug( "LAUNCH!" ) self._logger.debug( "LAUNCH!" )
self._launch_config = {} adapter_config = self._adapter
self._launch_config.update( self._adapter.get( 'configuration', {} ) ) launch_config = {}
self._launch_config.update( self._configuration[ 'configuration' ] ) launch_config.update( self._adapter.get( 'configuration', {} ) )
launch_config.update( self._configuration[ 'configuration' ] )
request = self._configuration.get( request = self._configuration.get(
'remote-request', 'remote-request',
self._launch_config.get( 'request', 'launch' ) ) launch_config.get( 'request', 'launch' ) )
if request == "attach": if request == "attach":
self._splash_screen = utils.DisplaySplash( self._splash_screen = utils.DisplaySplash(
self._api_prefix, self._api_prefix,
self._splash_screen, self._splash_screen,
"Attaching to debuggee..." ) "Attaching to debugee..." )
self._PrepareAttach( self._adapter, self._launch_config ) self._PrepareAttach( adapter_config, launch_config )
elif request == "launch": elif request == "launch":
self._splash_screen = utils.DisplaySplash( self._splash_screen = utils.DisplaySplash(
self._api_prefix, self._api_prefix,
self._splash_screen, self._splash_screen,
"Launching debuggee..." ) "Launching debugee..." )
# FIXME: This cmdLine hack is not fun. # FIXME: This cmdLine hack is not fun.
self._PrepareLaunch( self._configuration.get( 'remote-cmdLine', [] ), self._PrepareLaunch( self._configuration.get( 'remote-cmdLine', [] ),
self._adapter, adapter_config,
self._launch_config ) launch_config )
# FIXME: name is mandatory. Forcefully add it (we should really use the # FIXME: name is mandatory. Forcefully add it (we should really use the
# _actual_ name, but that isn't actually remembered at this point) # _actual_ name, but that isn't actually remembered at this point)
if 'name' not in self._launch_config: if 'name' not in launch_config:
self._launch_config[ 'name' ] = 'test' launch_config[ 'name' ] = 'test'
def _Launch( self ):
def failure_handler( reason, msg ): def failure_handler( reason, msg ):
text = [ text = [
'Launch Failed', 'Launch Failed',
@ -1224,11 +967,12 @@ class DebugSession( object ):
self._splash_screen, self._splash_screen,
text ) text )
self._connection.DoRequest( self._connection.DoRequest(
lambda msg: self._OnLaunchComplete(), lambda msg: self._OnLaunchComplete(),
{ {
'command': self._launch_config[ 'request' ], 'command': launch_config[ 'request' ],
'arguments': self._launch_config 'arguments': launch_config
}, },
failure_handler ) failure_handler )
@ -1270,37 +1014,6 @@ class DebugSession( object ):
self._stackTraceView.LoadThreads( True ) self._stackTraceView.LoadThreads( True )
@IfConnected()
@RequiresUI()
def PrintDebugInfo( self ):
def Line():
return ( "--------------------------------------------------------------"
"------------------" )
def Pretty( obj ):
if obj is None:
return [ "None" ]
return [ Line() ] + json.dumps( obj, indent=2 ).splitlines() + [ Line() ]
debugInfo = [
"Vimspector Debug Info",
Line(),
f"ConnectionType: { self._connection_type }",
"Adapter: " ] + Pretty( self._adapter ) + [
"Configuration: " ] + Pretty( self._configuration ) + [
f"API Prefix: { self._api_prefix }",
f"Launch/Init: { self._launch_complete } / { self._init_complete }",
f"Workspace Root: { self._workspace_root }",
"Launch Config: " ] + Pretty( self._launch_config ) + [
"Server Capabilities: " ] + Pretty( self._server_capabilities ) + [
]
self._outputView.ClearCategory( 'DebugInfo' )
self._outputView.Print( "DebugInfo", debugInfo )
self.ShowOutput( "DebugInfo" )
def OnEvent_loadedSource( self, msg ): def OnEvent_loadedSource( self, msg ):
pass pass
@ -1337,9 +1050,7 @@ class DebugSession( object ):
if reason == 'changed': if reason == 'changed':
self._codeView.UpdateBreakpoint( bp ) self._codeView.UpdateBreakpoint( bp )
elif reason == 'new': elif reason == 'new':
self._codeView.AddBreakpoint( bp ) self._codeView.AddBreakpoints( None, bp )
elif reason == 'removed':
self._codeView.RemoveBreakpoint( bp )
else: else:
utils.UserMessage( utils.UserMessage(
'Unrecognised breakpoint event (undocumented): {0}'.format( reason ), 'Unrecognised breakpoint event (undocumented): {0}'.format( reason ),
@ -1363,33 +1074,19 @@ class DebugSession( object ):
self._connection.DoResponse( message, None, response ) self._connection.DoResponse( message, None, response )
def OnEvent_terminated( self, message ):
# The debugging _session_ has terminated. This does not mean that the
# debuggee has terminated (that's the exited event).
#
# We will handle this when the server actually exists.
#
# FIXME we should always wait for this event before disconnecting closing
# any socket connection
self.SetCurrentFrame( None )
def OnEvent_exited( self, message ): def OnEvent_exited( self, message ):
utils.UserMessage( 'The debuggee exited with status code: {}'.format( utils.UserMessage( 'The debugee exited with status code: {}'.format(
message[ 'body' ][ 'exitCode' ] ) ) message[ 'body' ][ 'exitCode' ] ) )
self._stackTraceView.OnExited( message )
self._codeView.SetCurrentFrame( None )
def OnEvent_process( self, message ): def OnEvent_process( self, message ):
utils.UserMessage( 'The debuggee was started: {}'.format( utils.UserMessage( 'The debugee was started: {}'.format(
message[ 'body' ][ 'name' ] ) ) message[ 'body' ][ 'name' ] ) )
def OnEvent_module( self, message ): def OnEvent_module( self, message ):
pass pass
def OnEvent_continued( self, message ): def OnEvent_continued( self, message ):
self._stackTraceView.OnContinued( message[ 'body' ] ) pass
self._codeView.SetCurrentFrame( None )
def Clear( self ): def Clear( self ):
self._codeView.Clear() self._codeView.Clear()
@ -1421,6 +1118,10 @@ class DebugSession( object ):
else: else:
self._logger.debug( "No server exit handler" ) self._logger.debug( "No server exit handler" )
def OnEvent_terminated( self, message ):
# We will handle this when the server actually exists
utils.UserMessage( "Debugging was terminated by the server." )
def OnEvent_output( self, message ): def OnEvent_output( self, message ):
if self._outputView: if self._outputView:
self._outputView.OnOutput( message[ 'body' ] ) self._outputView.OnOutput( message[ 'body' ] )
@ -1461,26 +1162,6 @@ class DebugSession( object ):
def ToggleBreakpoint( self, options ): def ToggleBreakpoint( self, options ):
return self._breakpoints.ToggleBreakpoint( options ) return self._breakpoints.ToggleBreakpoint( options )
def RunTo( self, file_name, line ):
self.ClearTemporaryBreakpoints()
self.SetLineBreakpoint( file_name,
line,
{ 'temporary': True },
lambda: self.Continue() )
def ClearTemporaryBreakpoints( self ):
return self._breakpoints.ClearTemporaryBreakpoints()
def SetLineBreakpoint( self, file_name, line_num, options, then = None ):
return self._breakpoints.SetLineBreakpoint( file_name,
line_num,
options,
then )
def ClearLineBreakpoint( self, file_name, line_num ):
return self._breakpoints.ClearLineBreakpoint( file_name, line_num )
def ClearBreakpoints( self ): def ClearBreakpoints( self ):
if self._connection: if self._connection:
self._codeView.ClearBreakpoints() self._codeView.ClearBreakpoints()

View file

@ -21,7 +21,7 @@ import os
GADGETS = { GADGETS = {
'vscode-cpptools': { 'vscode-cpptools': {
'language': [ 'c', 'cpp', 'rust' ], 'language': 'c',
'download': { 'download': {
'url': 'https://github.com/Microsoft/vscode-cpptools/releases/download/' 'url': 'https://github.com/Microsoft/vscode-cpptools/releases/download/'
'${version}/${file_name}', '${version}/${file_name}',
@ -30,12 +30,12 @@ GADGETS = {
root, root,
gadget ), gadget ),
'all': { 'all': {
'version': '1.6.0', 'version': '0.27.0',
"adapters": { "adapters": {
"vscode-cpptools": { "vscode-cpptools": {
"name": "cppdbg", "name": "cppdbg",
"command": [ "command": [
"${gadgetDir}/vscode-cpptools/debugAdapters/bin/OpenDebugAD7" "${gadgetDir}/vscode-cpptools/debugAdapters/OpenDebugAD7"
], ],
"attach": { "attach": {
"pidProperty": "processId", "pidProperty": "processId",
@ -53,17 +53,17 @@ GADGETS = {
'linux': { 'linux': {
'file_name': 'cpptools-linux.vsix', 'file_name': 'cpptools-linux.vsix',
'checksum': 'checksum':
'c25299bcfb46b22d41aa3f125df7184e6282a35ff9fb69c47def744cb4778f55', '3695202e1e75a03de18049323b66d868165123f26151f8c974a480eaf0205435',
}, },
'macos': { 'macos': {
'file_name': 'cpptools-osx-arm64.vsix', 'file_name': 'cpptools-osx.vsix',
'checksum': 'checksum':
'ceb3e8cdaa2b5bb45af50913ddd8402089969748af8d70f5d46480408287ba6f', 'cb061e3acd7559a539e5586f8d3f535101c4ec4e8a48195856d1d39380b5cf3c',
}, },
'windows': { 'windows': {
'file_name': 'cpptools-win32.vsix', 'file_name': 'cpptools-win32.vsix',
'checksum': 'checksum':
'ef7ac5831874a3c7dbf0feb826bfda2be579aff9b6d990622fff1d0d4ede00d1', 'aa294368ed16d48c59e49c8000e146eae5a19ad07b654efed5db8ec93b24229e',
"adapters": { "adapters": {
"vscode-cpptools": { "vscode-cpptools": {
"name": "cppdbg", "name": "cppdbg",
@ -86,16 +86,39 @@ GADGETS = {
}, },
}, },
}, },
'vscode-python': {
'language': 'python.legacy',
'enabled': False,
'download': {
'url': 'https://github.com/Microsoft/vscode-python/releases/download/'
'${version}/${file_name}',
},
'all': {
'version': '2019.11.50794',
'file_name': 'ms-python-release.vsix',
'checksum':
'6a9edf9ecabed14aac424e6007858068204a3638bf3bb4f235bd6035d823acc6',
},
'adapters': {
"vscode-python": {
"name": "vscode-python",
"command": [
"node",
"${gadgetDir}/vscode-python/out/client/debugger/debugAdapter/main.js",
],
}
},
},
'debugpy': { 'debugpy': {
'language': 'python', 'language': 'python',
'download': { 'download': {
'url': 'https://github.com/microsoft/debugpy/archive/${file_name}' 'url': 'https://github.com/microsoft/debugpy/archive/${file_name}'
}, },
'all': { 'all': {
'version': '1.2.1', 'version': '1.0.0b12',
'file_name': 'v1.2.1.zip', 'file_name': 'v1.0.0b12.zip',
'checksum': 'checksum':
'29a6c5d1053d2b6f3b1a63e1a8ecff93f951d3cc0b7548431592e9e3007239e6' '210632bba2221fbb841c9785a615258819ceec401d1abdbeb5f2326f12cc72a1'
}, },
'do': lambda name, root, gadget: installer.InstallDebugpy( name, 'do': lambda name, root, gadget: installer.InstallDebugpy( name,
root, root,
@ -134,10 +157,6 @@ GADGETS = {
"vscode-java": { "vscode-java": {
"name": "vscode-java", "name": "vscode-java",
"port": "${DAPPort}", "port": "${DAPPort}",
"configuration": {
"cwd": "${workspaceRoot}"
},
'custom_handler': 'vimspector.custom.java.JavaDebugAdapter'
} }
}, },
}, },
@ -174,7 +193,7 @@ GADGETS = {
'language': 'tcl', 'language': 'tcl',
'repo': { 'repo': {
'url': 'https://github.com/puremourning/TclProDebug', 'url': 'https://github.com/puremourning/TclProDebug',
'ref': 'v1.0.0' 'ref': 'master'
}, },
'do': lambda name, root, gadget: installer.InstallTclProDebug( name, 'do': lambda name, root, gadget: installer.InstallTclProDebug( name,
root, root,
@ -203,27 +222,26 @@ GADGETS = {
}, },
}, },
'netcoredbg': { 'netcoredbg': {
'language': [ 'csharp', 'fsharp', 'vbnet' ], 'language': 'csharp',
'enabled': False, 'enabled': False,
'download': { 'download': {
'url': ( 'https://github.com/Samsung/netcoredbg/releases/download/' 'url': 'https://github.com/Samsung/netcoredbg/releases/download/latest/'
'${version}/${file_name}' ), '${file_name}',
'format': 'tar', 'format': 'tar',
}, },
'all': { 'all': {
'version': '1.2.0-782' 'version': 'master'
}, },
'macos': { 'macos': {
'file_name': 'netcoredbg-osx.tar.gz', 'file_name': 'netcoredbg-osx-master.tar.gz',
'checksum': 'checksum': '',
'',
}, },
'linux': { 'linux': {
'file_name': 'netcoredbg-linux-bionic-amd64.tar.gz', 'file_name': 'netcoredbg-linux-master.tar.gz',
'checksum': '', 'checksum': '',
}, },
'windows': { 'windows': {
'file_name': 'netcoredbg-win64.zip', 'file_name': 'netcoredbg-win64-master.zip',
'checksum': '', 'checksum': '',
}, },
'do': lambda name, root, gadget: installer.MakeSymlink( 'do': lambda name, root, gadget: installer.MakeSymlink(
@ -240,9 +258,35 @@ GADGETS = {
"pidProperty": "processId", "pidProperty": "processId",
"pidSelect": "ask" "pidSelect": "ask"
}, },
"configuration": { },
"cwd": "${workspaceRoot}" }
} },
'vscode-mono-debug': {
'language': 'csharp',
'enabled': False,
'download': {
'url': 'https://marketplace.visualstudio.com/_apis/public/gallery/'
'publishers/ms-vscode/vsextensions/mono-debug/${version}/'
'vspackage',
'target': 'vscode-mono-debug.vsix.gz',
'format': 'zip.gz',
},
'all': {
'file_name': 'vscode-mono-debug.vsix',
'version': '0.15.8',
'checksum':
'723eb2b621b99d65a24f215cb64b45f5fe694105613a900a03c859a62a810470',
},
'adapters': {
'vscode-mono-debug': {
"name": "mono-debug",
"command": [
"mono",
"${gadgetDir}/vscode-mono-debug/bin/Release/mono-debug.exe"
],
"attach": {
"pidSelect": "none"
},
}, },
} }
}, },
@ -292,25 +336,22 @@ GADGETS = {
'vscode-go': { 'vscode-go': {
'language': 'go', 'language': 'go',
'download': { 'download': {
'url': 'https://github.com/golang/vscode-go/releases/download/' 'url': 'https://github.com/microsoft/vscode-go/releases/download/'
'v${version}/${file_name}' '${version}/${file_name}'
}, },
'all': { 'all': {
'version': '0.19.1', 'version': '0.11.4',
'file_name': 'go-0.19.1.vsix', 'file_name': 'Go-0.11.4.vsix',
'checksum': 'checksum':
'7f9dc014245b030d9f562b28f3ea9b1fd6e2708fac996c53ff6a707f8204ec64', 'ff7d7b944da5448974cb3a0086f4a2fd48e2086742d9c013d6964283d416027e'
}, },
'adapters': { 'adapters': {
'vscode-go': { 'vscode-go': {
'name': 'delve', 'name': 'delve',
'command': [ 'command': [
'node', 'node',
'${gadgetDir}/vscode-go/dist/debugAdapter.js' '${gadgetDir}/vscode-go/out/src/debugAdapter/goDebug.js'
], ],
"configuration": {
"cwd": "${workspaceRoot}",
}
}, },
}, },
}, },
@ -319,14 +360,14 @@ GADGETS = {
'enabled': False, 'enabled': False,
'download': { 'download': {
'url': 'url':
'https://github.com/xdebug/vscode-php-debug/releases/download/' 'https://github.com/felixfbecker/vscode-php-debug/releases/download/'
'${version}/${file_name}', '${version}/${file_name}',
}, },
'all': { 'all': {
'version': 'v1.17.0', 'version': 'v1.13.0',
'file_name': 'php-debug-1.17.0.vsix', 'file_name': 'php-debug.vsix',
'checksum': 'checksum':
'd0fff272503414b6696cc737bc2e18e060fdd5e5dc4bcaf38ae7373afd8d8bc9', '8a51e593458fd14623c1c89ebab87347b087d67087717f18bcf77bb788052718',
}, },
'adapters': { 'adapters': {
'vscode-php-debug': { 'vscode-php-debug': {
@ -388,18 +429,18 @@ GADGETS = {
}, },
'CodeLLDB': { 'CodeLLDB': {
'language': 'rust', 'language': 'rust',
'enabled': True, 'enabled': False,
'download': { 'download': {
'url': 'https://github.com/vadimcn/vscode-lldb/releases/download/' 'url': 'https://github.com/vadimcn/vscode-lldb/releases/download/'
'${version}/${file_name}', '${version}/${file_name}',
}, },
'all': { 'all': {
'version': 'v1.6.6', 'version': 'v1.5.3',
}, },
'macos': { 'macos': {
'file_name': 'codelldb-aarch64-darwin.vsix', 'file_name': 'codelldb-x86_64-darwin.vsix',
'checksum': 'checksum':
'5adc3b9139eabdafd825bd5efc55df4424a203fb2b6087b425cd434956e7ec58', '7505bc1cdfcfd1cb981e2996aec62d63577440709bac31dcadb41a3b4b44631a',
'make_executable': [ 'make_executable': [
'adapter/codelldb', 'adapter/codelldb',
'lldb/bin/debugserver', 'lldb/bin/debugserver',
@ -410,7 +451,7 @@ GADGETS = {
'linux': { 'linux': {
'file_name': 'codelldb-x86_64-linux.vsix', 'file_name': 'codelldb-x86_64-linux.vsix',
'checksum': 'checksum':
'eda2cd9b3089dcc0524c273e91ffb5875fe08c930bf643739a2cd1846e1f98d6', 'ce7efc3e94d775368e5942a02bf5c326b6809a0b4c389f79ffa6a8f6f6b72139',
'make_executable': [ 'make_executable': [
'adapter/codelldb', 'adapter/codelldb',
'lldb/bin/lldb', 'lldb/bin/lldb',
@ -421,7 +462,7 @@ GADGETS = {
'windows': { 'windows': {
'file_name': 'codelldb-x86_64-windows.vsix', 'file_name': 'codelldb-x86_64-windows.vsix',
'checksum': 'checksum':
'8ddebe8381a3d22dc3d95139c3797fda06b5cc34aadf300e13b1c516b9da95fe', '',
'make_executable': [] 'make_executable': []
}, },
'adapters': { 'adapters': {
@ -445,31 +486,4 @@ GADGETS = {
}, },
}, },
}, },
'local-lua-debugger-vscode': {
'language': 'lua',
'enabled': True,
'repo': {
'url': 'https://github.com/tomblind/local-lua-debugger-vscode.git',
'ref': 'release-${version}'
},
'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'
}
}
},
},
} }

View file

@ -229,14 +229,10 @@ def GadgetListToInstallerArgs( *gadget_list ):
except KeyError: except KeyError:
continue continue
lang = gadget[ "language" ]
if isinstance( lang, list ):
lang = lang[ 0 ]
if not gadget.get( 'enabled', True ): if not gadget.get( 'enabled', True ):
installer_args.append( f'--force-enable-{lang}' ) installer_args.append( f'--force-enable-{ gadget[ "language" ] }' )
else: else:
installer_args.append( f'--enable-{lang}' ) installer_args.append( f'--enable-{ gadget[ "language" ] }' )
return installer_args return installer_args
@ -344,12 +340,11 @@ def WriteAdapters( all_adapters, to_file=None ):
def InstallGeneric( name, root, gadget ): def InstallGeneric( name, root, gadget ):
extension_path = gadget.get( 'extension_path', 'extension' ) extension = os.path.join( root, 'extension' )
extension = os.path.join( root, extension_path )
for f in gadget.get( 'make_executable', [] ): for f in gadget.get( 'make_executable', [] ):
MakeExecutable( os.path.join( extension, f ) ) MakeExecutable( os.path.join( extension, f ) )
MakeExtensionSymlink( name, root, extension_path ) MakeExtensionSymlink( name, root )
def InstallCppTools( name, root, gadget ): def InstallCppTools( name, root, gadget ):
@ -358,8 +353,7 @@ def InstallCppTools( name, root, gadget ):
# It's hilarious, but the execute bits aren't set in the vsix. So they # It's hilarious, but the execute bits aren't set in the vsix. So they
# actually have javascript code which does this. It's just a horrible horrible # actually have javascript code which does this. It's just a horrible horrible
# hack that really is not funny. # hack that really is not funny.
MakeExecutable( MakeExecutable( os.path.join( extension, 'debugAdapters', 'OpenDebugAD7' ) )
os.path.join( extension, 'debugAdapters', 'bin', 'OpenDebugAD7' ) )
with open( os.path.join( extension, 'package.json' ) ) as f: with open( os.path.join( extension, 'package.json' ) ) as f:
package = json.load( f ) package = json.load( f )
runtime_dependencies = package[ 'runtimeDependencies' ] runtime_dependencies = package[ 'runtimeDependencies' ]
@ -431,13 +425,6 @@ 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,
@ -494,7 +481,7 @@ def InstallGagdet( name: str,
url = string.Template( gadget[ 'repo' ][ 'url' ] ).substitute( spec ) url = string.Template( gadget[ 'repo' ][ 'url' ] ).substitute( spec )
ref = string.Template( gadget[ 'repo' ][ 'ref' ] ).substitute( spec ) ref = string.Template( gadget[ 'repo' ][ 'ref' ] ).substitute( spec )
print( f"Installing {name}@{ref}..." ) print( f"Installing {name}@{gadget[ 'repo' ][ 'ref' ]}..." )
spec[ 'repo' ] = gadget[ 'repo' ] spec[ 'repo' ] = gadget[ 'repo' ]
if not manifest.RequiresUpdate( name, spec ): if not manifest.RequiresUpdate( name, spec ):
save_adapters() save_adapters()
@ -705,8 +692,8 @@ def ExtractZipTo( file_path, destination, format ):
CheckCall( [ 'tar', 'zxvf', file_path ] ) CheckCall( [ 'tar', 'zxvf', file_path ] )
def MakeExtensionSymlink( name, root, extension_path = 'extension' ): def MakeExtensionSymlink( name, root ):
MakeSymlink( name, os.path.join( root, extension_path ) ), MakeSymlink( name, os.path.join( root, 'extension' ) ),
def MakeSymlink( link, pointing_to, in_folder = None ): def MakeSymlink( link, pointing_to, in_folder = None ):

View file

@ -32,9 +32,8 @@ class TabBuffer( object ):
BUFFER_MAP = { BUFFER_MAP = {
'console': 'Console', 'console': 'Console',
'stdout': 'Console', 'stdout': 'Console',
'output': 'Console',
'stderr': 'stderr', 'stderr': 'stderr',
'telemetry': None, 'telemetry': 'Telemetry',
} }
@ -65,11 +64,8 @@ class OutputView( object ):
self._api_prefix = api_prefix self._api_prefix = api_prefix
VIEWS.add( self ) VIEWS.add( self )
def Print( self, category, text: typing.Union[ str, list ] ): def Print( self, categroy, text ):
if not isinstance( text, list ): self._Print( 'server', text.splitlines() )
text = text.splitlines()
self._Print( category, text )
def OnOutput( self, event ): def OnOutput( self, event ):
category = CategoryToBuffer( event.get( 'category' ) or 'output' ) category = CategoryToBuffer( event.get( 'category' ) or 'output' )
@ -81,10 +77,6 @@ class OutputView( object ):
self._Print( category, text_lines ) self._Print( category, text_lines )
def _Print( self, category, text_lines ): def _Print( self, category, text_lines ):
if category is None:
# This category is supressed
return
if category not in self._buffers: if category not in self._buffers:
self._CreateBuffer( category ) self._CreateBuffer( category )
@ -108,26 +100,13 @@ class OutputView( object ):
def Clear( self ): def Clear( self ):
for category, tab_buffer in self._buffers.items(): for category, tab_buffer in self._buffers.items():
self._CleanUpBuffer( category, tab_buffer ) if tab_buffer.is_job:
utils.CleanUpCommand( category, self._api_prefix )
utils.CleanUpHiddenBuffer( tab_buffer.buf )
# FIXME: nunmenu the WinBar ? # FIXME: nunmenu the WinBar ?
self._buffers = {} self._buffers = {}
def ClearCategory( self, category: str ):
if category not in self._buffers:
return
self._CleanUpBuffer( category, self._buffers[ category ] )
def _CleanUpBuffer( self, category: str, tab_buffer: TabBuffer ):
if tab_buffer.is_job:
utils.CleanUpCommand( category, self._api_prefix )
utils.CleanUpHiddenBuffer( tab_buffer.buf )
def WindowIsValid( self ): def WindowIsValid( self ):
return self._window.valid return self._window.valid
@ -231,9 +210,6 @@ class OutputView( object ):
utils.CleanUpHiddenBuffer( buf_to_delete ) utils.CleanUpHiddenBuffer( buf_to_delete )
def _RenderWinBar( self, category ): def _RenderWinBar( self, category ):
if not utils.UseWinBar():
return
if not self._window.valid: if not self._window.valid:
return return
@ -251,7 +227,7 @@ class OutputView( object ):
raise raise
vim.command( vim.command(
"nnoremenu <silent> 1.{0} WinBar.{1}{2} " "nnoremenu 1.{0} WinBar.{1}{2} "
":call vimspector#ShowOutputInWindow( {3}, '{1}' )<CR>".format( ":call vimspector#ShowOutputInWindow( {3}, '{1}' )<CR>".format(
tab_buffer.index, tab_buffer.index,
utils.Escape( category ), utils.Escape( category ),
@ -272,8 +248,7 @@ class DAPOutputView( OutputView ):
self._connection = None self._connection = None
for b in set( BUFFER_MAP.values() ): for b in set( BUFFER_MAP.values() ):
if b is not None: self._CreateBuffer( b )
self._CreateBuffer( b )
self.AddLogFileView() self.AddLogFileView()
self._ShowOutput( 'Console' ) self._ShowOutput( 'Console' )
@ -285,18 +260,14 @@ class DAPOutputView( OutputView ):
# Don't clear because output is probably still useful # Don't clear because output is probably still useful
self._connection = None self._connection = None
def Evaluate( self, frame, expression, verbose ): def Evaluate( self, frame, expression ):
if verbose: self._Print( 'Console', [ 'Evaluating: ' + expression ] )
self._Print( 'Console', f"Evaluating: { expression }" )
def print_result( message ): def print_result( message ):
result = message[ 'body' ][ 'result' ] result = message[ 'body' ][ 'result' ]
if result is None: if result is None:
result = '<no result>' result = '<no result>'
self._Print( 'Console', result.splitlines() ) self._Print( 'Console', f' Result: { result }' )
def print_failure( reason, msg ):
self._Print( 'Console', reason.splitlines() )
request = { request = {
'command': 'evaluate', 'command': 'evaluate',
@ -309,6 +280,4 @@ class DAPOutputView( OutputView ):
if frame: if frame:
request[ 'arguments' ][ 'frameId' ] = frame[ 'id' ] request[ 'arguments' ][ 'frameId' ] = frame[ 'id' ]
self._connection.DoRequest( print_result, self._connection.DoRequest( print_result, request )
request,
print_failure )

View file

@ -20,50 +20,23 @@ from vimspector import utils
DEFAULTS = { DEFAULTS = {
# UI # UI
'ui_mode': 'auto', 'bottombar_height': 10,
'bottombar_height': 10, 'sidebar_width': 50,
'code_minwidth': 82,
# For ui_mode = 'horizontal': 'terminal_maxwidth': 80,
'sidebar_width': 50, 'terminal_minwidth': 10,
'code_minwidth': 82,
'terminal_maxwidth': 80,
'terminal_minwidth': 10,
# For ui_mode = 'vertical':
'topbar_height': 15,
'code_minheight': 20,
'terminal_maxheight': 15,
'terminal_minheight': 5,
# Signs # Signs
'sign_priority': { 'sign_priority': {
'vimspectorPC': 200, 'vimspectorPC': 200,
'vimspectorPCBP': 200, 'vimspectorPCBP': 200,
'vimspectorBP': 9, 'vimspectorBP': 9,
'vimspectorBPCond': 9, 'vimspectorBPCond': 9,
'vimspectorBPDisabled': 9, 'vimspectorBPDisabled': 9,
'vimspectorCurrentThread': 200,
'vimspectorCurrentFrame': 200,
}, },
# Installer # Installer
'install_gadgets': [], 'install_gadgets': [],
# Mappings
'mappings': {
'variables': {
'expand_collapse': [ '<CR>', '<2-LeftMouse>' ],
'delete': [ '<Del>' ],
'set_value': [ '<C-CR>', '<leader><CR>' ]
},
'stack_trace': {
'expand_or_jump': [ '<CR>', '<2-LeftMouse>' ],
'focus_thread': [ '<leader><CR>' ],
}
},
# Custom
'java_hotcodereplace_mode': 'ask',
} }
@ -95,44 +68,9 @@ if hasattr( vim, 'Dictionary' ):
DICT_TYPE = vim.Dictionary DICT_TYPE = vim.Dictionary
def Dict( option ): def Dict( option: str ):
return _UpdateDict( DICT_TYPE( DEFAULTS.get( option, {} ) ), d = DICT_TYPE( DEFAULTS.get( option, {} ) )
vim.vars.get( f'vimspector_{ option }', DICT_TYPE() ) ) d.update( utils.GetVimValue( vim.vars,
f'vimspector_{ option }',
{} ) )
def _UpdateDict( target, override ): return d
"""Apply the updates in |override| to the dict |target|. This is like
dict.update, but recursive. i.e. if the existing element is a dict, then
override elements of the sub-dict rather than wholesale replacing.
e.g.
UpdateDict(
{
'outer': { 'inner': { 'key': 'oldValue', 'existingKey': True } }
},
{
'outer': { 'inner': { 'key': 'newValue' } },
'newKey': { 'newDict': True },
}
)
yields:
{
'outer': {
'inner': {
'key': 'newValue',
'existingKey': True
}
},
'newKey': { newDict: True }
}
"""
for key, value in override.items():
current_value = target.get( key )
if not isinstance( current_value, DICT_TYPE ):
target[ key ] = value
elif isinstance( value, DICT_TYPE ):
target[ key ] = _UpdateDict( current_value, value )
else:
target[ key ] = value
return target

View file

@ -29,7 +29,7 @@ def DefineSign( name, text, double_text, texthl, col = 'right', **kwargs ):
vim.command( cmd ) vim.command( cmd )
def PlaceSign( sign_id, group, name, file_name, line ): def PlaceSign( sign_id, group, name, file, line ):
priority = settings.Dict( 'sign_priority' )[ name ] priority = settings.Dict( 'sign_priority' )[ name ]
cmd = ( f'sign place { sign_id } ' cmd = ( f'sign place { sign_id } '
@ -37,7 +37,7 @@ def PlaceSign( sign_id, group, name, file_name, line ):
f'name={ name } ' f'name={ name } '
f'priority={ priority } ' f'priority={ priority } '
f'line={ line } ' f'line={ line } '
f'file={ file_name }' ) f'file={ file }' )
vim.command( cmd ) vim.command( cmd )

View file

@ -16,75 +16,11 @@
import vim import vim
import os import os
import logging import logging
import typing
from vimspector import utils, signs, settings from vimspector import utils
class Thread:
"""The state of a single thread."""
PAUSED = 0
RUNNING = 1
TERMINATED = 3
state = RUNNING
stopped_event: typing.Dict
thread: typing.Dict
stacktrace: typing.List[ typing.Dict ]
id: str
def __init__( self, thread ):
self.id = thread[ 'id' ]
self.stopped_event = None
self.Update( thread )
def Update( self, thread ):
self.thread = thread
self.stacktrace = None
def Paused( self, event ):
self.state = Thread.PAUSED
self.stopped_event = event
def Continued( self ):
self.state = Thread.RUNNING
self.stopped_event = None
self.Collapse()
def Exited( self ):
self.state = Thread.TERMINATED
self.stopped_event = None
def State( self ):
if self.state == Thread.PAUSED:
return self.stopped_event.get( 'description' ) or 'paused'
elif self.state == Thread.RUNNING:
return 'running'
return 'terminated'
def Expand( self, stack_trace ):
self.stacktrace = stack_trace
def Collapse( self ):
self.stacktrace = None
def IsExpanded( self ):
return self.stacktrace is not None
def CanExpand( self ):
return self.state == Thread.PAUSED
class StackTraceView( object ): class StackTraceView( object ):
class ThreadRequestState:
NO = 0
REQUESTING = 1
PENDING = 2
# FIXME: Make into a dict by id ?
_threads: typing.List[ Thread ]
_line_to_thread = typing.Dict[ int, Thread ]
def __init__( self, session, win ): def __init__( self, session, win ):
self._logger = logging.getLogger( __name__ ) self._logger = logging.getLogger( __name__ )
utils.SetUpLogging( self._logger ) utils.SetUpLogging( self._logger )
@ -101,55 +37,25 @@ class StackTraceView( object ):
self._sources = {} self._sources = {}
self._scratch_buffers = [] self._scratch_buffers = []
# FIXME: This ID is by group, so should be module scope
self._current_thread_sign_id = 0 # 1 when used
self._current_frame_sign_id = 0 # 2 when used
utils.SetUpHiddenBuffer( self._buf, 'vimspector.StackTrace' ) utils.SetUpHiddenBuffer( self._buf, 'vimspector.StackTrace' )
utils.SetUpUIWindow( win ) utils.SetUpUIWindow( win )
mappings = settings.Dict( 'mappings' )[ 'stack_trace' ] vim.command( 'nnoremap <silent> <buffer> <CR> '
':<C-U>call vimspector#GoToFrame()<CR>' )
with utils.LetCurrentWindow( win ): vim.command( 'nnoremap <silent> <buffer> <2-LeftMouse> '
for mapping in utils.GetVimList( mappings, 'expand_or_jump' ): ':<C-U>call vimspector#GoToFrame()<CR>' )
vim.command( f'nnoremap <silent> <buffer> { mapping } '
':<C-U>call vimspector#GoToFrame()<CR>' )
for mapping in utils.GetVimList( mappings, 'focus_thread' ):
vim.command( f'nnoremap <silent> <buffer> { mapping } '
':<C-U>call vimspector#SetCurrentThread()<CR>' )
if utils.UseWinBar():
vim.command( 'nnoremenu <silent> 1.1 WinBar.Pause/Continue '
':call vimspector#PauseContinueThread()<CR>' )
vim.command( 'nnoremenu <silent> 1.2 WinBar.Expand/Collapse '
':call vimspector#GoToFrame()<CR>' )
vim.command( 'nnoremenu <silent> 1.3 WinBar.Focus '
':call vimspector#SetCurrentThread()<CR>' )
win.options[ 'cursorline' ] = False
win.options[ 'signcolumn' ] = 'auto'
if not signs.SignDefined( 'vimspectorCurrentThread' ):
signs.DefineSign( 'vimspectorCurrentThread',
text = '',
double_text = '',
texthl = 'MatchParen',
linehl = 'CursorLine' )
if not signs.SignDefined( 'vimspectorCurrentFrame' ):
signs.DefineSign( 'vimspectorCurrentFrame',
text = '',
double_text = '',
texthl = 'Special',
linehl = 'CursorLine' )
self._line_to_frame = {} self._line_to_frame = {}
self._line_to_thread = {} self._line_to_thread = {}
self._requesting_threads = StackTraceView.ThreadRequestState.NO # TODO: We really need a proper state model
self._pending_thread_request = None #
# AWAIT_CONNECTION -- OnServerReady / RequestThreads --> REQUESTING_THREADS
# REQUESTING -- OnGotThreads / RequestScopes --> REQUESTING_SCOPES
#
# When we attach using gdbserver, this whole thing breaks because we request
# the threads over and over and get duff data back on later threads.
self._requesting_threads = False
def GetCurrentThreadId( self ): def GetCurrentThreadId( self ):
@ -162,22 +68,14 @@ class StackTraceView( object ):
self._current_frame = None self._current_frame = None
self._current_thread = None self._current_thread = None
self._current_syntax = "" self._current_syntax = ""
self._threads.clear() self._threads = []
self._sources = {} self._sources = {}
self._requesting_threads = StackTraceView.ThreadRequestState.NO
self._pending_thread_request = None
if self._current_thread_sign_id:
signs.UnplaceSign( self._current_thread_sign_id, 'VimspectorStackTrace' )
self._current_thread_sign_id = 0
if self._current_frame_sign_id:
signs.UnplaceSign( self._current_frame_sign_id, 'VimspectorStackTrace' )
self._current_frame_sign_id = 0
with utils.ModifiableScratchBuffer( self._buf ): with utils.ModifiableScratchBuffer( self._buf ):
utils.ClearBuffer( self._buf ) utils.ClearBuffer( self._buf )
def ConnectionUp( self, connection ): def ConnectionUp( self, connection ):
self._connection = connection self._connection = connection
self._requesting_threads = False
def ConnectionClosed( self ): def ConnectionClosed( self ):
self.Clear() self.Clear()
@ -188,95 +86,47 @@ class StackTraceView( object ):
utils.CleanUpHiddenBuffer( self._buf ) utils.CleanUpHiddenBuffer( self._buf )
for b in self._scratch_buffers: for b in self._scratch_buffers:
utils.CleanUpHiddenBuffer( b ) utils.CleanUpHiddenBuffer( b )
self._scratch_buffers = [] self._scratch_buffers = []
self._buf = None self._buf = None
def LoadThreads( self, def LoadThreads( self, infer_current_frame ):
infer_current_frame, pending_request = False
reason = '', if self._requesting_threads:
stopEvent = None ): pending_request = True
if self._requesting_threads != StackTraceView.ThreadRequestState.NO:
self._requesting_threads = StackTraceView.ThreadRequestState.PENDING
self._pending_thread_request = ( infer_current_frame,
reason,
stopEvent )
return return
def consume_threads( message ): def consume_threads( message ):
requesting = False self._requesting_threads = False
if self._requesting_threads == StackTraceView.ThreadRequestState.PENDING:
# We may have hit a thread event, so try again.
self._requesting_threads = StackTraceView.ThreadRequestState.NO
self.LoadThreads( *self._pending_thread_request )
requesting = True
self._requesting_threads = StackTraceView.ThreadRequestState.NO if not message[ 'body' ][ 'threads' ]:
self._pending_thread_request = None if pending_request:
# We may have hit a thread event, so try again.
self.LoadThreads( infer_current_frame )
return
else:
# This is a protocol error. It is required to return at least one!
utils.UserMessage( 'Server returned no threads. Is it running?',
persist = True )
if not ( message.get( 'body' ) or {} ).get( 'threads' ):
# This is a protocol error. It is required to return at least one!
utils.UserMessage( 'Protocol error: Server returned no threads',
persist = False,
error = True )
return
existing_threads = self._threads[ : ]
self._threads.clear() self._threads.clear()
if stopEvent is not None: for thread in message[ 'body' ][ 'threads' ]:
stoppedThreadId = stopEvent.get( 'threadId' )
allThreadsStopped = stopEvent.get( 'allThreadsStopped', False )
# FIXME: This is horribly inefficient
for t in message[ 'body' ][ 'threads' ]:
thread = None
for existing_thread in existing_threads:
if existing_thread.id == t[ 'id' ]:
thread = existing_thread
thread.Update( t )
break
if not thread:
thread = Thread( t )
self._threads.append( thread ) self._threads.append( thread )
# If the threads were requested due to a stopped event, update any if infer_current_frame and thread[ 'id' ] == self._current_thread:
# stopped thread state. Note we have to do this here (rather than in the self._LoadStackTrace( thread, True )
# stopped event handler) because we must apply this event to any new elif infer_current_frame and self._current_thread is None:
# threads that are received here. self._current_thread = thread[ 'id' ]
if stopEvent: self._LoadStackTrace( thread, True )
if allThreadsStopped:
thread.Paused( stopEvent )
elif stoppedThreadId is not None and thread.id == stoppedThreadId:
thread.Paused( stopEvent )
# If this is a stopped event, load the stack trace for the "current" self._DrawThreads()
# thread. Don't do this on other thrads requests because some servers
# just break when that happens.
#
# Don't do this if we're also satisfying a cached request already (we'll
# do it then)
if infer_current_frame and not requesting:
if thread.id == self._current_thread:
if thread.CanExpand():
self._LoadStackTrace( thread, True, reason )
requesting = True
elif self._current_thread is None:
self._current_thread = thread.id
if thread.CanExpand():
self._LoadStackTrace( thread, True, reason )
requesting = True
if not requesting:
self._DrawThreads()
def failure_handler( reason, msg ): def failure_handler( reason, msg ):
# Make sure we request them again if the request fails # Make sure we request them again if the request fails
self._requesting_threads = StackTraceView.ThreadRequestState.NO self._requesting_threads = False
self._pending_thread_request = None
self._requesting_threads = StackTraceView.ThreadRequestState.REQUESTING self._requesting_threads = True
self._connection.DoRequest( consume_threads, { self._connection.DoRequest( consume_threads, {
'command': 'threads', 'command': 'threads',
}, failure_handler ) }, failure_handler )
@ -285,42 +135,26 @@ class StackTraceView( object ):
self._line_to_frame.clear() self._line_to_frame.clear()
self._line_to_thread.clear() self._line_to_thread.clear()
if self._current_thread_sign_id:
signs.UnplaceSign( self._current_thread_sign_id, 'VimspectorStackTrace' )
else:
self._current_thread_sign_id = 1
with utils.ModifiableScratchBuffer( self._buf ): with utils.ModifiableScratchBuffer( self._buf ):
with utils.RestoreCursorPosition(): utils.ClearBuffer( self._buf )
utils.ClearBuffer( self._buf )
for thread in self._threads: for thread in self._threads:
icon = '+' if not thread.IsExpanded() else '-' icon = '+' if '_frames' not in thread else '-'
line = utils.AppendToBuffer(
self._buf,
f'{icon} Thread {thread.id}: {thread.thread["name"]} '
f'({thread.State()})' )
if self._current_thread == thread.id: line = utils.AppendToBuffer(
signs.PlaceSign( self._current_thread_sign_id, self._buf,
'VimspectorStackTrace', '{0} Thread: {1}'.format( icon, thread[ 'name' ] ) )
'vimspectorCurrentThread',
self._buf.name,
line )
self._line_to_thread[ line ] = thread self._line_to_thread[ line ] = thread
self._DrawStackTrace( thread )
def _LoadStackTrace( self, self._DrawStackTrace( thread )
thread: Thread,
infer_current_frame,
reason = '' ):
def _LoadStackTrace( self, thread, infer_current_frame ):
def consume_stacktrace( message ): def consume_stacktrace( message ):
thread.Expand( message[ 'body' ][ 'stackFrames' ] ) thread[ '_frames' ] = message[ 'body' ][ 'stackFrames' ]
if infer_current_frame: if infer_current_frame:
for frame in thread.stacktrace: for frame in thread[ '_frames' ]:
if self._JumpToFrame( frame, reason ): if self._JumpToFrame( frame ):
break break
self._DrawThreads() self._DrawThreads()
@ -328,113 +162,32 @@ class StackTraceView( object ):
self._connection.DoRequest( consume_stacktrace, { self._connection.DoRequest( consume_stacktrace, {
'command': 'stackTrace', 'command': 'stackTrace',
'arguments': { 'arguments': {
'threadId': thread.id, 'threadId': thread[ 'id' ],
} }
} ) } )
def _GetSelectedThread( self ) -> Thread:
if vim.current.buffer != self._buf:
return None
return self._line_to_thread.get( vim.current.window.cursor[ 0 ] )
def GetSelectedThreadId( self ):
thread = self._GetSelectedThread()
return thread.id if thread else thread
def _SetCurrentThread( self, thread: Thread ):
self._current_thread = thread.id
self._DrawThreads()
def SetCurrentThread( self ):
thread = self._GetSelectedThread()
if thread:
self._SetCurrentThread( thread )
elif vim.current.buffer != self._buf:
return
elif vim.current.window.cursor[ 0 ] in self._line_to_frame:
thread, frame = self._line_to_frame[ vim.current.window.cursor[ 0 ] ]
self._SetCurrentThread( thread )
self._JumpToFrame( frame )
else:
utils.UserMessage( "No thread selected" )
def ExpandFrameOrThread( self ): def ExpandFrameOrThread( self ):
thread = self._GetSelectedThread() if vim.current.buffer != self._buf:
if thread:
if thread.IsExpanded():
thread.Collapse()
self._DrawThreads()
elif thread.CanExpand():
self._LoadStackTrace( thread, False )
else:
utils.UserMessage( "Thread is not stopped" )
elif vim.current.buffer != self._buf:
return return
elif vim.current.window.cursor[ 0 ] in self._line_to_frame:
thread, frame = self._line_to_frame[ vim.current.window.cursor[ 0 ] ]
self._JumpToFrame( frame )
current_line = vim.current.window.cursor[ 0 ]
if current_line in self._line_to_frame:
self._JumpToFrame( self._line_to_frame[ current_line ] )
elif current_line in self._line_to_thread:
thread = self._line_to_thread[ current_line ]
if '_frames' in thread:
del thread[ '_frames' ]
with utils.RestoreCursorPosition():
self._DrawThreads()
else:
self._LoadStackTrace( thread, False )
def _GetFrameOffset( self, delta ): def _JumpToFrame( self, frame ):
thread: Thread
for thread in self._threads:
if thread.id != self._current_thread:
continue
if not thread.stacktrace:
return
frame_idx = None
for index, frame in enumerate( thread.stacktrace ):
if frame == self._current_frame:
frame_idx = index
break
if frame_idx is not None:
target_idx = frame_idx + delta
if target_idx >= 0 and target_idx < len( thread.stacktrace ):
return thread.stacktrace[ target_idx ]
break
def UpFrame( self ):
frame = self._GetFrameOffset( 1 )
if not frame:
utils.UserMessage( 'Top of stack' )
else:
self._JumpToFrame( frame, 'up' )
def DownFrame( self ):
frame = self._GetFrameOffset( -1 )
if not frame:
utils.UserMessage( 'Bottom of stack' )
else:
self._JumpToFrame( frame, 'down' )
def AnyThreadsRunning( self ):
for thread in self._threads:
if thread.state != Thread.TERMINATED:
return True
return False
def _JumpToFrame( self, frame, reason = '' ):
def do_jump(): def do_jump():
if 'line' in frame and frame[ 'line' ] > 0: if 'line' in frame and frame[ 'line' ] > 0:
# Should this set the current _Thread_ too ? If i jump to a frame in
# Thread 2, should that become the focussed thread ?
self._current_frame = frame self._current_frame = frame
self._DrawThreads() return self._session.SetCurrentFrame( self._current_frame )
return self._session.SetCurrentFrame( self._current_frame, reason )
return False return False
source = frame.get( 'source' ) or {} source = frame.get( 'source' ) or {}
@ -449,94 +202,59 @@ class StackTraceView( object ):
else: else:
return do_jump() return do_jump()
def PauseContinueThread( self ):
thread = self._GetSelectedThread()
if thread is None:
utils.UserMessage( 'No thread selected' )
elif thread.state == Thread.PAUSED:
self._session._connection.DoRequest(
lambda msg: self.OnContinued( {
'threadId': thread.id,
'allThreadsContinued': ( msg.get( 'body' ) or {} ).get(
'allThreadsContinued',
True )
} ),
{
'command': 'continue',
'arguments': {
'threadId': thread.id,
},
} )
elif thread.state == Thread.RUNNING:
self._session._connection.DoRequest( None, {
'command': 'pause',
'arguments': {
'threadId': thread.id,
},
} )
else:
utils.UserMessage(
f'Thread cannot be modified in state {thread.State()}' )
def OnContinued( self, event = None ):
threadId = None
allThreadsContinued = True
if event is not None:
threadId = event[ 'threadId' ]
allThreadsContinued = event.get( 'allThreadsContinued', False )
for thread in self._threads:
if allThreadsContinued:
thread.Continued()
elif thread.id == threadId:
thread.Continued()
break
self._DrawThreads()
def OnStopped( self, event ): def OnStopped( self, event ):
threadId = event.get( 'threadId' ) if 'threadId' in event:
allThreadsStopped = event.get( 'allThreadsStopped', False ) self._current_thread = event[ 'threadId' ]
elif event.get( 'allThreadsStopped', False ) and self._threads:
self._current_thread = self._threads[ 0 ][ 'id' ]
# Work out if we should change the current thread if self._current_thread is not None:
if threadId is not None: for thread in self._threads:
self._current_thread = threadId if thread[ 'id' ] == self._current_thread:
elif self._current_thread is None and allThreadsStopped and self._threads: self._LoadStackTrace( thread, True )
self._current_thread = self._threads[ 0 ].id return
self.LoadThreads( True, 'stopped', event ) self.LoadThreads( True )
def OnThreadEvent( self, event ): def OnThreadEvent( self, event ):
infer_current_frame = False
if event[ 'reason' ] == 'started' and self._current_thread is None: if event[ 'reason' ] == 'started' and self._current_thread is None:
self._current_thread = event[ 'threadId' ] self._current_thread = event[ 'threadId' ]
infer_current_frame = True self.LoadThreads( True )
if event[ 'reason' ] == 'exited': def Continue( self ):
for thread in self._threads: if self._current_thread is None:
if thread.id == event[ 'threadId' ]: utils.UserMessage( 'No current thread', persist = True )
thread.Exited()
break
self.LoadThreads( infer_current_frame )
def OnExited( self, event ):
for thread in self._threads:
thread.Exited()
def _DrawStackTrace( self, thread: Thread ):
if not thread.IsExpanded():
return return
if self._current_frame_sign_id: self._session._connection.DoRequest( None, {
signs.UnplaceSign( self._current_frame_sign_id, 'VimspectorStackTrace' ) 'command': 'continue',
else: 'arguments': {
self._current_frame_sign_id = 2 'threadId': self._current_thread,
},
} )
for frame in thread.stacktrace: self._session.ClearCurrentFrame()
self.LoadThreads( True )
def Pause( self ):
if self._current_thread is None:
utils.UserMessage( 'No current thread', persist = True )
return
self._session._connection.DoRequest( None, {
'command': 'pause',
'arguments': {
'threadId': self._current_thread,
},
} )
def _DrawStackTrace( self, thread ):
if '_frames' not in thread:
return
stackFrames = thread[ '_frames' ]
for frame in stackFrames:
if frame.get( 'source' ): if frame.get( 'source' ):
source = frame[ 'source' ] source = frame[ 'source' ]
else: else:
@ -560,15 +278,7 @@ class StackTraceView( object ):
source[ 'name' ], source[ 'name' ],
frame[ 'line' ] ) ) frame[ 'line' ] ) )
if ( self._current_frame is not None and self._line_to_frame[ line ] = frame
self._current_frame[ 'id' ] == frame[ 'id' ] ):
signs.PlaceSign( self._current_frame_sign_id,
'VimspectorStackTrace',
'vimspectorCurrentFrame',
self._buf.name,
line )
self._line_to_frame[ line ] = ( thread, frame )
def _ResolveSource( self, source, and_then ): def _ResolveSource( self, source, and_then ):
source_reference = int( source[ 'sourceReference' ] ) source_reference = int( source[ 'sourceReference' ] )

View file

@ -1,6 +1,5 @@
from vimspector import utils, settings from vimspector import utils, settings
import os
import vim import vim
@ -18,58 +17,17 @@ def LaunchTerminal( api_prefix,
else: else:
term = existing_term term = existing_term
cwd = params[ 'cwd' ] or os.getcwd() cwd = params[ 'cwd' ]
args = params[ 'args' ] or [] args = params[ 'args' ]
env = params.get( 'env' ) or {} env = params.get( 'env', {} )
term_options = { term_options = {
'vertical': 1,
'norestore': 1, 'norestore': 1,
'cwd': cwd, 'cwd': cwd,
'env': env, 'env': env,
} }
if settings.Get( 'ui_mode' ) == 'horizontal':
# force-horizontal
term_options[ 'vertical' ] = 1
elif utils.GetVimValue( vim.vars[ 'vimspector_session_windows' ],
'mode' ) == 'horizontal':
# horizontal, which means that we should have enough space for:
# - sidebar
# - code min
# - term min width
# - + 2 vertical spaders
# - + 3 columns for signs
term_options[ 'vertical' ] = 1
# if we don't have enough space for terminal_maxwidth, then see if we have
# enough vertically for terminal_maxheight, in which case,
# that seems a better fit
term_horiz_max = ( settings.Int( 'sidebar_width' ) +
1 + 2 + 3 +
settings.Int( 'code_minwidth' ) +
1 + settings.Int( 'terminal_maxwidth' ) )
term_vert_max = ( settings.Int( 'bottombar_height' ) + 1 +
settings.Int( 'code_minheight' ) + 1 +
settings.Int( 'terminal_minheight' ) )
if ( vim.options[ 'columns' ] < term_horiz_max and
vim.options[ 'lines' ] >= term_vert_max ):
# Looks like it, let's try that layout
term_options[ 'vertical' ] = 0
else:
# vertical - we need enough space horizontally for the code+terminal, but we
# may fit better with code above terminal
term_options[ 'vertical' ] = 0
term_horiz_max = ( settings.Int( 'code_minwidth' ) + 3 +
settings.Int( 'terminal_maxwidth' ) + 1 )
if vim.options[ 'columns' ] > term_horiz_max:
term_options[ 'vertical' ] = 1
if not window_for_start or not window_for_start.valid: if not window_for_start or not window_for_start.valid:
# TOOD: Where? Maybe we should just use botright vertical ... # TOOD: Where? Maybe we should just use botright vertical ...
window_for_start = vim.current.window window_for_start = vim.current.window
@ -91,23 +49,13 @@ def LaunchTerminal( api_prefix,
# If we're making a vertical split from the code window, make it no more # If we're making a vertical split from the code window, make it no more
# than 80 columns and no fewer than 10. Also try and keep the code window # than 80 columns and no fewer than 10. Also try and keep the code window
# at least 82 columns # at least 82 columns
if term_options.get( 'curwin', 0 ): if term_options[ 'vertical' ] and not term_options.get( 'curwin', 0 ):
pass
elif term_options[ 'vertical' ]:
term_options[ 'term_cols' ] = max( term_options[ 'term_cols' ] = max(
min ( int( vim.eval( 'winwidth( 0 )' ) ) min ( int( vim.eval( 'winwidth( 0 )' ) )
- settings.Int( 'code_minwidth' ), - settings.Int( 'code_minwidth' ),
settings.Int( 'terminal_maxwidth' ) ), settings.Int( 'terminal_maxwidth' ) ),
settings.Int( 'terminal_minwidth' ) settings.Int( 'terminal_minwidth' )
) )
else:
term_options[ 'term_rows' ] = max(
min ( int( vim.eval( 'winheight( 0 )' ) )
- settings.Int( 'code_minheight' ),
settings.Int( 'terminal_maxheight' ) ),
settings.Int( 'terminal_minheight' )
)
buffer_number = int( buffer_number = int(
utils.Call( utils.Call(

View file

@ -45,20 +45,14 @@ _logger = logging.getLogger( __name__ )
SetUpLogging( _logger ) SetUpLogging( _logger )
def BufferNumberForFile( file_name, create = True ): def BufferNumberForFile( file_name ):
return int( vim.eval( "bufnr( '{0}', {1} )".format( return int( vim.eval( "bufnr( '{0}', 1 )".format( Escape( file_name ) ) ) )
Escape( file_name ),
int( create ) ) ) )
def BufferForFile( file_name ): def BufferForFile( file_name ):
return vim.buffers[ BufferNumberForFile( file_name ) ] return vim.buffers[ BufferNumberForFile( file_name ) ]
def BufferExists( file_name ):
return bool( int ( vim.eval( f"bufexists( '{ Escape( file_name ) }' )" ) ) )
def NewEmptyBuffer(): def NewEmptyBuffer():
bufnr = int( vim.eval( 'bufadd("")' ) ) bufnr = int( vim.eval( 'bufadd("")' ) )
Call( 'bufload', bufnr ) Call( 'bufload', bufnr )
@ -356,63 +350,20 @@ def SelectFromList( prompt, options ):
return None return None
def AskForInput( prompt, default_value = None, completion = None ): def AskForInput( prompt, default_value = None ):
if default_value is None: if default_value is None:
default_value = '' default_option = ''
else:
args = [ prompt, default_value ] default_option = ", '{}'".format( Escape( default_value ) )
if completion is not None:
if completion == 'expr':
args.append( 'custom,vimspector#CompleteExpr' )
else:
args.append( completion )
with InputSave(): with InputSave():
try: try:
return Call( 'input', *args ) return vim.eval( "input( '{}' {} )".format( Escape( prompt ),
default_option ) )
except ( KeyboardInterrupt, vim.error ): except ( KeyboardInterrupt, vim.error ):
return None return None
CONFIRM = {}
CONFIRM_ID = 0
def ConfirmCallback( confirm_id, result ):
try:
handler = CONFIRM.pop( confirm_id )
except KeyError:
UserMessage( f"Internal error: unexpected callback id { confirm_id }",
persist = True,
error = True )
return
handler( result )
def Confirm( api_prefix,
prompt,
handler,
default_value = 2,
options: list = None,
keys: list = None ):
if not options:
options = [ '(Y)es', '(N)o' ]
if not keys:
keys = [ 'y', 'n' ]
global CONFIRM_ID
CONFIRM_ID += 1
CONFIRM[ CONFIRM_ID ] = handler
Call( f'vimspector#internal#{ api_prefix }popup#Confirm',
CONFIRM_ID,
prompt,
options,
default_value,
keys )
def AppendToBuffer( buf, line_or_lines, modified=False ): def AppendToBuffer( buf, line_or_lines, modified=False ):
line = 1 line = 1
try: try:
@ -441,10 +392,8 @@ def AppendToBuffer( buf, line_or_lines, modified=False ):
def ClearBuffer( buf, modified = False ): def ClearBuffer( buf ):
buf[ : ] = None buf[ : ] = None
if not modified:
buf.options[ 'modified' ] = False
def SetBufferContents( buf, lines, modified=False ): def SetBufferContents( buf, lines, modified=False ):
@ -505,8 +454,8 @@ VAR_MATCH = re.compile(
{(?P<braceddefault> # or An {id:default} - default param, as {(?P<braceddefault> # or An {id:default} - default param, as
(?P<defname>[_a-z][_a-z0-9]*) # an ID (?P<defname>[_a-z][_a-z0-9]*) # an ID
: # then a colon : # then a colon
(?P<default>(?:\\}|[^}])*) # then anything up to }, or a \} (?P<default>(?:[^}]|\})*) # then anything up to }, or a \}
)} | # then a } )} | #
(?P<invalid>) # or Something else - invalid (?P<invalid>) # or Something else - invalid
) )
""", """,
@ -534,6 +483,7 @@ def _Substitute( template, mapping ):
if mo.group( 'braceddefault' ) is not None: if mo.group( 'braceddefault' ) is not None:
named = mo.group( 'defname' ) named = mo.group( 'defname' )
if named not in mapping: if named not in mapping:
''
raise MissingSubstitution( raise MissingSubstitution(
named, named,
mo.group( 'default' ).replace( '\\}', '}' ) ) mo.group( 'default' ).replace( '\\}', '}' ) )
@ -575,11 +525,8 @@ def ExpandReferencesInString( orig_s,
if default_value is None and e.default_value is not None: if default_value is None and e.default_value is not None:
try: try:
default_value = _Substitute( e.default_value, mapping ) default_value = _Substitute( e.default_value, mapping )
except MissingSubstitution as e2: except MissingSubstitution:
if e2.name in calculus: default_value = e.default_value
default_value = calculus[ e2.name ]()
else:
default_value = e.default_value
mapping[ key ] = AskForInput( 'Enter value for {}: '.format( key ), mapping[ key ] = AskForInput( 'Enter value for {}: '.format( key ),
default_value ) default_value )
@ -681,19 +628,15 @@ def ParseVariables( variables_list,
return new_variables return new_variables
def DisplayBalloon( is_term, display, is_hover = False ): def DisplayBaloon( is_term, display ):
if not is_term: if not is_term:
display = '\n'.join( display )
# To enable the Windows GUI to display the balloon correctly # To enable the Windows GUI to display the balloon correctly
# Refer https://github.com/vim/vim/issues/1512#issuecomment-492070685 # Refer https://github.com/vim/vim/issues/1512#issuecomment-492070685
display = '\n'.join( display ) vim.eval( "balloon_show( '' )" )
created_win_id = int( vim.eval( vim.eval( "balloon_show( {0} )".format(
"vimspector#internal#balloon#CreateTooltip({}, {})".format( json.dumps( display ) ) )
int( is_hover ), json.dumps( display )
)
) )
return created_win_id
def GetBufferFilepath( buf ): def GetBufferFilepath( buf ):
@ -754,7 +697,7 @@ def SetSyntax( current_syntax, syntax, *args ):
syntax = '' syntax = ''
if current_syntax == syntax: if current_syntax == syntax:
return syntax return
# We use set syn= because just setting vim.Buffer.options[ 'syntax' ] # We use set syn= because just setting vim.Buffer.options[ 'syntax' ]
# doesn't actually trigger the Syntax autocommand, and i'm not sure that # doesn't actually trigger the Syntax autocommand, and i'm not sure that
@ -770,28 +713,6 @@ def GetBufferFiletypes( buf ):
return ft.split( '.' ) return ft.split( '.' )
def GetVisualSelection( bufnr ):
start_line, start_col = vim.current.buffer.mark( "<" )
end_line, end_col = vim.current.buffer.mark( ">" )
# lines are 1 based, but columns are 0 based
# don't ask me why...
start_line -= 1
end_line -= 1
lines = vim.buffers[ bufnr ][ start_line : end_line + 1 ]
# Do end first, in case it's on the same line as start (as doing start first
# would change the offset)
lines[ -1 ] = lines[ -1 ][ : end_col + 1 ]
lines[ 0 ] = lines[ 0 ][ start_col : ]
_logger.debug( f'Visual selection: { lines } from '
f'{ start_line }/{ start_col } -> { end_line }/{ end_col }' )
return lines
def DisplaySplash( api_prefix, splash, text ): def DisplaySplash( api_prefix, splash, text ):
if splash: if splash:
return Call( f'vimspector#internal#{api_prefix}popup#UpdateSplash', return Call( f'vimspector#internal#{api_prefix}popup#UpdateSplash',
@ -858,9 +779,3 @@ def WindowID( window, tab=None ):
if tab is None: if tab is None:
tab = window.tabpage tab = window.tabpage
return int( Call( 'win_getid', window.number, tab.number ) ) return int( Call( 'win_getid', window.number, tab.number ) )
def UseWinBar():
# Buggy neovim doesn't render correctly when the WinBar is defined:
# https://github.com/neovim/neovim/issues/12689
return not int( Call( 'has', 'nvim' ) )

View file

@ -19,7 +19,7 @@ import logging
from functools import partial from functools import partial
import typing import typing
from vimspector import utils, settings from vimspector import utils
class Expandable: class Expandable:
@ -32,9 +32,8 @@ class Expandable:
a 'variablesReference' to be resolved by the 'variables' request. Records the a 'variablesReference' to be resolved by the 'variables' request. Records the
current state expanded/collapsed. Implementations just implement current state expanded/collapsed. Implementations just implement
VariablesReference to get the variables.""" VariablesReference to get the variables."""
def __init__( self, container: 'Expandable' = None ): def __init__( self ):
self.variables: typing.List[ 'Variable' ] = None self.variables: typing.List[ 'Variable' ] = None
self.container: Expandable = container
# None is Falsy and represents collapsed _by default_. WHen set to False, # None is Falsy and represents collapsed _by default_. WHen set to False,
# this means the user explicitly collapsed it. When True, the user expanded # this means the user explicitly collapsed it. When True, the user expanded
# it (or we expanded it by default). # it (or we expanded it by default).
@ -49,9 +48,6 @@ class Expandable:
def IsExpandable( self ): def IsExpandable( self ):
return self.VariablesReference() > 0 return self.VariablesReference() > 0
def IsContained( self ):
return self.container is not None
@abc.abstractmethod @abc.abstractmethod
def VariablesReference( self ): def VariablesReference( self ):
assert False assert False
@ -88,16 +84,10 @@ class WatchResult( Expandable ):
self.result = result self.result = result
class WatchFailure( WatchResult ):
def __init__( self, reason ):
super().__init__( { 'result': reason } )
self.changed = True
class Variable( Expandable ): class Variable( Expandable ):
"""Holds one level of an expanded value tree. Also itself expandable.""" """Holds one level of an expanded value tree. Also itself expandable."""
def __init__( self, container: Expandable, variable: dict ): def __init__( self, variable: dict ):
super().__init__( container = container ) super().__init__()
self.variable = variable self.variable = variable
# A new variable appearing is marked as changed # A new variable appearing is marked as changed
self.changed = True self.changed = True
@ -121,48 +111,17 @@ class Watch:
self.expression = expression self.expression = expression
self.result = None self.result = None
@staticmethod
def New( frame, expression, context ):
watch = {
'expression': expression,
'context': context,
}
if frame:
watch[ 'frameId' ] = frame[ 'id' ]
return Watch( watch )
class View: class View:
lines: typing.Dict[ int, Expandable ] lines: typing.Dict[ int, Expandable ]
draw: typing.Callable draw: typing.Callable
syntax: str
def __init__( self, win, lines, draw ): def __init__( self, win, lines, draw ):
self.lines = lines self.lines = lines
self.draw = draw self.draw = draw
self.syntax = None self.buf = win.buffer
if win is not None:
self.buf = win.buffer
utils.SetUpUIWindow( win )
utils.SetUpUIWindow( win )
class BufView( View ):
def __init__( self, buf, lines, draw ):
super().__init__( None, lines, draw )
self.buf = buf
def AddExpandMappings( mappings = None ):
if mappings is None:
mappings = settings.Dict( 'mappings' )[ 'variables' ]
for mapping in utils.GetVimList( mappings, 'expand_collapse' ):
vim.command( f'nnoremap <silent> <buffer> { mapping } '
':<C-u>call vimspector#ExpandVariable()<CR>' )
for mapping in utils.GetVimList( mappings, 'set_value' ):
vim.command( f'nnoremap <silent> <buffer> { mapping } '
':<C-u>call vimspector#SetVariableValue()<CR>' )
class VariablesView( object ): class VariablesView( object ):
@ -172,22 +131,19 @@ class VariablesView( object ):
self._connection = None self._connection = None
self._current_syntax = '' self._current_syntax = ''
self._server_capabilities = None
self._variable_eval: Scope = None def AddExpandMappings():
self._variable_eval_view: View = None vim.command( 'nnoremap <silent> <buffer> <CR> '
':<C-u>call vimspector#ExpandVariable()<CR>' )
mappings = settings.Dict( 'mappings' )[ 'variables' ] vim.command( 'nnoremap <silent> <buffer> <2-LeftMouse> '
':<C-u>call vimspector#ExpandVariable()<CR>' )
# Set up the "Variables" buffer in the variables_win # Set up the "Variables" buffer in the variables_win
self._scopes: typing.List[ Scope ] = [] self._scopes: typing.List[ Scope ] = []
self._vars = View( variables_win, {}, self._DrawScopes ) self._vars = View( variables_win, {}, self._DrawScopes )
utils.SetUpHiddenBuffer( self._vars.buf, 'vimspector.Variables' ) utils.SetUpHiddenBuffer( self._vars.buf, 'vimspector.Variables' )
with utils.LetCurrentWindow( variables_win ): with utils.LetCurrentWindow( variables_win ):
if utils.UseWinBar(): AddExpandMappings()
vim.command( 'nnoremenu <silent> 1.1 WinBar.Set '
':call vimspector#SetVariableValue()<CR>' )
AddExpandMappings( mappings )
# Set up the "Watches" buffer in the watches_win (and create a WinBar in # Set up the "Watches" buffer in the watches_win (and create a WinBar in
# there) # there)
@ -199,20 +155,16 @@ class VariablesView( object ):
'vimspector#AddWatchPrompt', 'vimspector#AddWatchPrompt',
'vimspector#OmniFuncWatch' ) 'vimspector#OmniFuncWatch' )
with utils.LetCurrentWindow( watches_win ): with utils.LetCurrentWindow( watches_win ):
AddExpandMappings( mappings ) AddExpandMappings()
for mapping in utils.GetVimList( mappings, 'delete' ): vim.command(
vim.command( 'nnoremap <buffer> <DEL> :call vimspector#DeleteWatch()<CR>' )
f'nnoremap <buffer> { mapping } :call vimspector#DeleteWatch()<CR>' )
if utils.UseWinBar(): vim.command( 'nnoremenu 1.1 WinBar.New '
vim.command( 'nnoremenu <silent> 1.1 WinBar.New ' ':call vimspector#AddWatch()<CR>' )
':call vimspector#AddWatch()<CR>' ) vim.command( 'nnoremenu 1.2 WinBar.Expand/Collapse '
vim.command( 'nnoremenu <silent> 1.2 WinBar.Expand/Collapse ' ':call vimspector#ExpandVariable()<CR>' )
':call vimspector#ExpandVariable()<CR>' ) vim.command( 'nnoremenu 1.3 WinBar.Delete '
vim.command( 'nnoremenu <silent> 1.3 WinBar.Delete ' ':call vimspector#DeleteWatch()<CR>' )
':call vimspector#DeleteWatch()<CR>' )
vim.command( 'nnoremenu <silent> 1.1 WinBar.Set '
':call vimspector#SetVariableValue()<CR>' )
# Set the (global!) balloon expr if supported # Set the (global!) balloon expr if supported
has_balloon = int( vim.eval( "has( 'balloon_eval' )" ) ) has_balloon = int( vim.eval( "has( 'balloon_eval' )" ) )
@ -224,9 +176,7 @@ class VariablesView( object ):
'balloonexpr': vim.options[ 'balloonexpr' ], 'balloonexpr': vim.options[ 'balloonexpr' ],
'balloondelay': vim.options[ 'balloondelay' ], 'balloondelay': vim.options[ 'balloondelay' ],
} }
vim.options[ 'balloonexpr' ] = ( "vimspector#internal#" vim.options[ 'balloonexpr' ] = 'vimspector#internal#balloon#BalloonExpr()'
"balloon#HoverTooltip()" )
vim.options[ 'balloondelay' ] = 250 vim.options[ 'balloondelay' ] = 250
if has_balloon: if has_balloon:
@ -244,30 +194,21 @@ class VariablesView( object ):
utils.ClearBuffer( self._vars.buf ) utils.ClearBuffer( self._vars.buf )
with utils.ModifiableScratchBuffer( self._watch.buf ): with utils.ModifiableScratchBuffer( self._watch.buf ):
utils.ClearBuffer( self._watch.buf ) utils.ClearBuffer( self._watch.buf )
self.ClearTooltip()
self._current_syntax = '' self._current_syntax = ''
def ConnectionUp( self, connection ): def ConnectionUp( self, connection ):
self._connection = connection self._connection = connection
def SetServerCapabilities( self, capabilities ):
self._server_capabilities = capabilities
def ConnectionClosed( self ): def ConnectionClosed( self ):
self.Clear() self.Clear()
self._connection = None self._connection = None
self._server_capabilities = None
def Reset( self ): def Reset( self ):
self._server_capabilities = None
for k, v in self._oldoptions.items(): for k, v in self._oldoptions.items():
vim.options[ k ] = v vim.options[ k ] = v
utils.CleanUpHiddenBuffer( self._vars.buf ) utils.CleanUpHiddenBuffer( self._vars.buf )
utils.CleanUpHiddenBuffer( self._watch.buf ) utils.CleanUpHiddenBuffer( self._watch.buf )
self.ClearTooltip()
def LoadScopes( self, frame ): def LoadScopes( self, frame ):
def scopes_consumer( message ): def scopes_consumer( message ):
@ -319,97 +260,15 @@ class VariablesView( object ):
}, },
} ) } )
def _DrawBalloonEval( self ):
watch = self._variable_eval
view = self._variable_eval_view
with utils.RestoreCursorPosition():
with utils.ModifiableScratchBuffer( view.buf ):
utils.ClearBuffer( view.buf )
view.syntax = utils.SetSyntax( view.syntax,
self._current_syntax,
view.buf )
self._DrawWatchResult( view,
0,
watch,
is_short = True )
vim.eval( "vimspector#internal#balloon#ResizeTooltip()" )
def ClearTooltip( self ):
# This will actually end up calling CleanUpTooltip via the popup close
# callback
vim.eval( 'vimspector#internal#balloon#Close()' )
def CleanUpTooltip( self ) :
# remove reference to old tooltip window
self._variable_eval_view = None
vim.vars[ 'vimspector_session_windows' ][ 'eval' ] = None
def VariableEval( self, frame, expression, is_hover ):
"""Callback to display variable under cursor `:h ballonexpr`"""
if not self._connection:
return ''
def handler( message ):
watch = self._variable_eval
if watch.result is None:
watch.result = WatchResult( message[ 'body' ] )
else:
watch.result.Update( message[ 'body' ] )
popup_win_id = utils.DisplayBalloon( self._is_term, [], is_hover )
# record the global eval window id
vim.vars[ 'vimspector_session_windows' ][ 'eval' ] = int( popup_win_id )
popup_bufnr = int( vim.eval( "winbufnr({})".format( popup_win_id ) ) )
# We don't need to do any UI window setup here, as it's already done as
# part of the popup creation, so just pass the buffer to the View instance
self._variable_eval_view = BufView(
vim.buffers[ popup_bufnr ],
{},
self._DrawBalloonEval
)
if watch.result.IsExpandable():
# Always expand the first level
watch.result.expanded = Expandable.EXPANDED_BY_US
if watch.result.IsExpanded():
self._connection.DoRequest( partial( self._ConsumeVariables,
self._variable_eval_view.draw,
watch.result ), {
'command': 'variables',
'arguments': {
'variablesReference': watch.result.VariablesReference(),
},
} )
self._DrawBalloonEval()
def failure_handler( reason, message ):
display = [ reason ]
float_win_id = utils.DisplayBalloon( self._is_term, display, is_hover )
# record the global eval window id
vim.vars[ 'vimspector_session_windows' ][ 'eval' ] = int( float_win_id )
self._variable_eval = Watch.New( frame,
expression,
'hover' )
# Send async request
self._connection.DoRequest( handler, {
'command': 'evaluate',
'arguments': self._variable_eval.expression,
}, failure_handler )
# Return working (meanwhile)
return ''
def AddWatch( self, frame, expression ): def AddWatch( self, frame, expression ):
self._watches.append( Watch.New( frame, expression, 'watch' ) ) watch = {
'expression': expression,
'context': 'watch',
}
if frame:
watch[ 'frameId' ] = frame[ 'id' ]
self._watches.append( Watch( watch ) )
self.EvaluateWatches() self.EvaluateWatches()
def DeleteWatch( self ): def DeleteWatch( self ):
@ -436,14 +295,11 @@ class VariablesView( object ):
def EvaluateWatches( self ): def EvaluateWatches( self ):
for watch in self._watches: for watch in self._watches:
self._connection.DoRequest( self._connection.DoRequest( partial( self._UpdateWatchExpression,
partial( self._UpdateWatchExpression, watch ), watch ), {
{ 'command': 'evaluate',
'command': 'evaluate', 'arguments': watch.expression,
'arguments': watch.expression, } )
},
failure_handler = lambda reason, msg, watch=watch:
self._WatchExpressionFailed( reason, watch ) )
def _UpdateWatchExpression( self, watch: Watch, message: dict ): def _UpdateWatchExpression( self, watch: Watch, message: dict ):
if watch.result is not None: if watch.result is not None:
@ -464,43 +320,20 @@ class VariablesView( object ):
self._DrawWatches() self._DrawWatches()
def _WatchExpressionFailed( self, reason: str, watch: Watch ): def ExpandVariable( self ):
if watch.result is not None: if vim.current.buffer == self._vars.buf:
# We already have a result for this watch. Wut ?
return
watch.result = WatchFailure( reason )
self._DrawWatches()
def _GetVariable( self, buf = None, line_num = None ):
none = ( None, None )
if buf is None:
buf = vim.current.buffer
if line_num is None:
line_num = vim.current.window.cursor[ 0 ]
if buf == self._vars.buf:
view = self._vars view = self._vars
elif buf == self._watch.buf: elif vim.current.buffer == self._watch.buf:
view = self._watch view = self._watch
elif ( self._variable_eval_view is not None
and buf == self._variable_eval_view.buf ):
view = self._variable_eval_view
else: else:
return none
if line_num not in view.lines:
return none
return view.lines[ line_num ], view
def ExpandVariable( self, buf = None, line_num = None ):
variable, view = self._GetVariable( buf, line_num )
if variable is None:
return return
current_line = vim.current.window.cursor[ 0 ]
if current_line not in view.lines:
return
variable = view.lines[ current_line ]
if variable.IsExpanded(): if variable.IsExpanded():
# Collapse # Collapse
variable.expanded = Expandable.COLLAPSED_BY_USER variable.expanded = Expandable.COLLAPSED_BY_USER
@ -520,101 +353,25 @@ class VariablesView( object ):
}, },
} ) } )
def SetVariableValue( self, new_value = None, buf = None, line_num = None ): def _DrawVariables( self, view, variables, indent ):
variable: Variable
view: View
if not self._server_capabilities.get( 'supportsSetVariable' ):
return
variable, view = self._GetVariable( buf, line_num )
if variable is None:
return
if not variable.IsContained():
return
if new_value is None:
new_value = utils.AskForInput( 'New Value: ',
variable.variable.get( 'value', '' ),
completion = 'expr' )
if new_value is None:
return
def handler( message ):
# Annoyingly the response to setVariable request doesn't return a
# Variable, but some part of it, so take a copy of the existing Variable
# dict and update it, then call its update method with the updated copy.
new_variable = dict( variable.variable )
new_variable.update( message[ 'body' ] )
# Clear any existing known children (FIXME: Is this the right thing to do)
variable.variables = None
# If the variable is expanded, re-request its children
if variable.IsExpanded():
self._connection.DoRequest( partial( self._ConsumeVariables,
view.draw,
variable ), {
'command': 'variables',
'arguments': {
'variablesReference': variable.VariablesReference()
},
} )
variable.Update( new_variable )
view.draw()
def failure_handler( reason, message ):
utils.UserMessage( f'Cannot set value: { reason }', error = True )
self._connection.DoRequest( handler, {
'command': 'setVariable',
'arguments': {
'variablesReference': variable.container.VariablesReference(),
'name': variable.variable[ 'name' ],
'value': new_value
},
}, failure_handler = failure_handler )
def _DrawVariables( self, view, variables, indent, is_short = False ):
assert indent > 0 assert indent > 0
for variable in variables: for variable in variables:
text = '' line = utils.AppendToBuffer(
if is_short: view.buf,
text = '{indent}{icon} {name}: {value}'.format( '{indent}{marker}{icon} {name} ({type_}): {value}'.format(
# We borrow 1 space of indent to draw the change marker
indent = ' ' * ( indent - 1 ),
icon = '+' if ( variable.IsExpandable()
and not variable.IsExpanded() ) else '-',
name = variable.variable.get( 'name', '' ),
value = variable.variable.get( 'value', '<unknown>' )
)
else:
text = '{indent}{marker}{icon} {name} ({type_}): {value}'.format(
# We borrow 1 space of indent to draw the change marker # We borrow 1 space of indent to draw the change marker
indent = ' ' * ( indent - 1 ), indent = ' ' * ( indent - 1 ),
marker = '*' if variable.changed else ' ', marker = '*' if variable.changed else ' ',
icon = '+' if ( variable.IsExpandable() icon = '+' if ( variable.IsExpandable()
and not variable.IsExpanded() ) else '-', and not variable.IsExpanded() ) else '-',
name = variable.variable.get( 'name', '' ), name = variable.variable[ 'name' ],
type_ = variable.variable.get( 'type', '' ), type_ = variable.variable.get( 'type', '' ),
value = variable.variable.get( 'value', '<unknown>' ) value = variable.variable.get( 'value',
) '<unknown>' ) ).split( '\n' ) )
line = utils.AppendToBuffer(
view.buf,
text.split( '\n' )
)
view.lines[ line ] = variable view.lines[ line ] = variable
if variable.ShouldDrawDrillDown(): if variable.ShouldDrawDrillDown():
self._DrawVariables( view, variable.variables, indent + 2, is_short ) self._DrawVariables( view, variable.variables, indent + 2 )
def _DrawScopes( self ): def _DrawScopes( self ):
# FIXME: The drawing is dumb and draws from scratch every time. This is # FIXME: The drawing is dumb and draws from scratch every time. This is
@ -641,7 +398,7 @@ class VariablesView( object ):
'Expression: ' 'Expression: '
+ watch.expression[ 'expression' ] ) + watch.expression[ 'expression' ] )
watch.line = line watch.line = line
self._DrawWatchResult( self._watch, 2, watch ) self._DrawWatchResult( 2, watch )
def _DrawScope( self, indent, scope ): def _DrawScope( self, indent, scope ):
icon = '+' if scope.IsExpandable() and not scope.IsExpanded() else '-' icon = '+' if scope.IsExpandable() and not scope.IsExpanded() else '-'
@ -657,36 +414,27 @@ class VariablesView( object ):
indent += 2 indent += 2
self._DrawVariables( self._vars, scope.variables, indent ) self._DrawVariables( self._vars, scope.variables, indent )
def _DrawWatchResult( self, view, indent, watch, is_short = False ): def _DrawWatchResult( self, indent, watch ):
if not watch.result: if not watch.result:
return return
assert is_short or indent > 0 assert indent > 0
icon = '+' if ( watch.result.IsExpandable() and
not watch.result.IsExpanded() ) else '-'
if is_short: line = '{indent}{marker}{icon} Result: {result}'.format(
# The first result is always expanded in a hover (short format)
icon = ''
marker = ''
leader = ''
else:
icon = '+' if ( watch.result.IsExpandable() and
not watch.result.IsExpanded() ) else '-'
marker = '*' if watch.result.changed else ' '
leader = ' Result: '
line = '{indent}{marker}{icon}{leader}{result}'.format(
# We borrow 1 space of indent to draw the change marker # We borrow 1 space of indent to draw the change marker
indent = ' ' * ( indent - 1 ), indent = ' ' * ( indent - 1 ),
marker = marker, marker = '*' if watch.result.changed else ' ',
icon = icon, icon = icon,
leader = leader,
result = watch.result.result.get( 'result', '<unknown>' ) ) result = watch.result.result.get( 'result', '<unknown>' ) )
line = utils.AppendToBuffer( view.buf, line.split( '\n' ) ) line = utils.AppendToBuffer( self._watch.buf, line.split( '\n' ) )
view.lines[ line ] = watch.result self._watch.lines[ line ] = watch.result
if watch.result.ShouldDrawDrillDown(): if watch.result.ShouldDrawDrillDown():
self._DrawVariables( view, watch.result.variables, indent + 2, is_short ) indent = 4
self._DrawVariables( self._watch, watch.result.variables, indent )
def _ConsumeVariables( self, draw, parent, message ): def _ConsumeVariables( self, draw, parent, message ):
new_variables = [] new_variables = []
@ -701,8 +449,9 @@ class VariablesView( object ):
variable = v variable = v
found = True found = True
break break
if not found: if not found:
variable = Variable( parent, variable_body ) variable = Variable( variable_body )
else: else:
variable.Update( variable_body ) variable.Update( variable_body )
@ -722,10 +471,47 @@ class VariablesView( object ):
draw() draw()
def ShowBalloon( self, frame, expression ):
"""Callback to display variable under cursor `:h ballonexpr`"""
if not self._connection:
return ''
def handler( message ):
# TODO: this result count be expandable, but we have no way to allow the
# user to interact with the balloon to expand it, unless we use a popup
# instead, but even then we don't really want to trap the cursor.
body = message[ 'body' ]
result = body[ 'result' ]
if result is None:
result = 'null'
display = [
'Type: ' + body.get( 'type', '<unknown>' ),
'Value: ' + result
]
utils.DisplayBaloon( self._is_term, display )
def failure_handler( reason, message ):
display = [ reason ]
utils.DisplayBaloon( self._is_term, display )
# Send async request
self._connection.DoRequest( handler, {
'command': 'evaluate',
'arguments': {
'expression': expression,
'frameId': frame[ 'id' ],
'context': 'hover',
}
}, failure_handler )
# Return working (meanwhile)
return '...'
def SetSyntax( self, syntax ): def SetSyntax( self, syntax ):
# TODO: Switch to View.syntax
self._current_syntax = utils.SetSyntax( self._current_syntax, self._current_syntax = utils.SetSyntax( self._current_syntax,
syntax, syntax,
self._vars.buf, self._vars.buf,
self._watch.buf ) self._watch.buf )
# vim: sw=2 # vim: sw=2

View file

@ -21,7 +21,7 @@ out_fd=1
while [ -n "$1" ]; do while [ -n "$1" ]; do
case "$1" in case "$1" in
"--basedir"|"--base-dir"|"--test-base") "--basedir")
shift shift
SetBaseDir $1 SetBaseDir $1
shift shift
@ -36,7 +36,7 @@ while [ -n "$1" ]; do
INSTALL=$1 INSTALL=$1
shift shift
;; ;;
"--update"|"--upgrade") "--update")
UPDATE=1 UPDATE=1
shift shift
;; ;;
@ -91,8 +91,7 @@ if [ "$INSTALL" = "1" ] || [ "$INSTALL" = "script" ]; then
if ! python3 $(dirname $0)/install_gadget.py \ if ! python3 $(dirname $0)/install_gadget.py \
--basedir ${BASEDIR} \ --basedir ${BASEDIR} \
${INSTALLER_ARGS} \ ${INSTALLER_ARGS} \
--all \ --all; then
--force-enable-csharp; then
echo "Script installation reported errors" >&2 echo "Script installation reported errors" >&2
exit 1 exit 1
fi fi
@ -103,7 +102,7 @@ if [ "$INSTALL" = "1" ] || [ "$INSTALL" = "vim" ]; then
--cmd "${BASEDIR_CMD}" \ --cmd "${BASEDIR_CMD}" \
-c 'autocmd User VimspectorInstallSuccess qa!' \ -c 'autocmd User VimspectorInstallSuccess qa!' \
-c 'autocmd User VimspectorInstallFailed cquit!' \ -c 'autocmd User VimspectorInstallFailed cquit!' \
-c "VimspectorInstall --all netcoredbg"; then -c "VimspectorInstall --all"; then
echo "Vim installation reported errors" >&2 echo "Vim installation reported errors" >&2
exit 1 exit 1
fi fi
@ -145,9 +144,6 @@ set -e
pushd tests/testdata/cpp/simple pushd tests/testdata/cpp/simple
make clean all make clean all
popd popd
pushd support/test/csharp
dotnet build
popd
set +e set +e
echo "%DONE - built test programs" echo "%DONE - built test programs"

View file

@ -1,12 +1,5 @@
" setup boilerplate to make this file usable with vim -Nu <tihs file> {{{
scriptencoding utf-8
execute 'source' expand( '<sfile>:p:h' ) . '/minimal_vimrc' execute 'source' expand( '<sfile>:p:h' ) . '/minimal_vimrc'
set noequalalways set noequalalways
let mapleader = ','
let maplocalleader = "\<Space>"
" }}}
" Custom Layout {{{
function! s:CustomiseUI() function! s:CustomiseUI()
let wins = g:vimspector_session_windows let wins = g:vimspector_session_windows
@ -38,10 +31,6 @@ function! s:CustomiseUI()
endfunction endfunction
function s:SetUpTerminal() function s:SetUpTerminal()
if !has_key( g:vimspector_session_windows, 'terminal' )
" There's a neovim bug which means that this doesn't work in neovim
return
endif
let terminal_win = g:vimspector_session_windows.terminal let terminal_win = g:vimspector_session_windows.terminal
" Make the terminal window at most 80 columns wide, ensuring there is enough " Make the terminal window at most 80 columns wide, ensuring there is enough
@ -54,7 +43,7 @@ function s:SetUpTerminal()
let padding = 4 let padding = 4
let cols = max( [ min( [ &columns - left_bar - code - padding, 80 ] ), 10 ] ) let cols = max( [ min( [ &columns - left_bar - code - padding, 80 ] ), 10 ] )
call win_gotoid( terminal_win ) call win_gotoid( terminal_win )
execute string(cols) . 'wincmd |' execute cols . 'wincmd |'
endfunction endfunction
function! s:CustomiseWinBar() function! s:CustomiseWinBar()
@ -77,85 +66,9 @@ augroup TestUICustomistaion
autocmd User VimspectorUICreated call s:CustomiseWinBar() autocmd User VimspectorUICreated call s:CustomiseWinBar()
augroup END augroup END
" }}}
" Custom sign priority {{{
let g:vimspector_sign_priority = { let g:vimspector_sign_priority = {
\ 'vimspectorBP': 3, \ 'vimspectorBP': 3,
\ 'vimspectorBPCond': 2, \ 'vimspectorBPCond': 2,
\ 'vimspectorBPDisabled': 1, \ 'vimspectorBPDisabled': 1,
\ 'vimspectorPC': 999, \ 'vimspectorPC': 999,
\ } \ }
" }}}
" Custom mappings while debuggins {{{
let s:mapped = {}
function! s:OnJumpToFrame() abort
if has_key( s:mapped, string( bufnr() ) )
return
endif
nmap <silent> <buffer> <LocalLeader>dn <Plug>VimspectorStepOver
nmap <silent> <buffer> <LocalLeader>ds <Plug>VimspectorStepInto
nmap <silent> <buffer> <LocalLeader>df <Plug>VimspectorStepOut
nmap <silent> <buffer> <LocalLeader>dc <Plug>VimspectorContinue
nmap <silent> <buffer> <LocalLeader>di <Plug>VimspectorBalloonEval
xmap <silent> <buffer> <LocalLeader>di <Plug>VimspectorBalloonEval
let s:mapped[ string( bufnr() ) ] = { 'modifiable': &modifiable }
setlocal nomodifiable
endfunction
function! s:OnDebugEnd() abort
let original_buf = bufnr()
let hidden = &hidden
try
set hidden
for bufnr in keys( s:mapped )
try
execute 'noautocmd buffer' bufnr
silent! nunmap <buffer> <LocalLeader>dn
silent! nunmap <buffer> <LocalLeader>ds
silent! nunmap <buffer> <LocalLeader>df
silent! nunmap <buffer> <LocalLeader>dc
silent! nunmap <buffer> <LocalLeader>di
silent! xunmap <buffer> <LocalLeader>di
let &l:modifiable = s:mapped[ bufnr ][ 'modifiable' ]
endtry
endfor
finally
execute 'noautocmd buffer' original_buf
let &hidden = hidden
endtry
let s:mapped = {}
endfunction
augroup TestCustomMappings
au!
autocmd User VimspectorJumpedToFrame call s:OnJumpToFrame()
autocmd User VimspectorDebugEnded call s:OnDebugEnd()
augroup END
" }}}
" Custom mappings for special buffers {{{
let g:vimspector_mappings = {
\ 'stack_trace': {},
\ 'variables': {
\ 'set_value': [ '<Tab>', '<C-CR>', 'C' ],
\ }
\ }
" }}}
" vim: foldmethod=marker

View file

@ -1,8 +0,0 @@
# Manually updating shipped gadgets
Download the gadget files manuall from their official source into this dir.
Run `./checksum.py <list of files>` to get the checksums.
Update ../../python3/vimspector/gadgets.py with the new version and the
checksums.

View file

@ -1,13 +0,0 @@
#!/usr/bin/env python3
import hashlib
import sys
def GetChecksumSHA254( file_path ):
with open( file_path, 'rb' ) as existing_file:
return hashlib.sha256( existing_file.read() ).hexdigest()
for arg in sys.argv[ 1: ]:
print( f"{ arg } = { GetChecksumSHA254( arg ) }" )

View file

@ -1,15 +0,0 @@
{
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
"configurations": {
"Run Current Script": {
"adapter": "vscode-bash",
"autoselect": false,
"configuration": {
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"args": [ "*${args}" ]
}
}
}
}

View file

@ -1,28 +1,11 @@
{ {
"configurations": { "configurations": {
"CodeLLDB": { "simple_c_program - Launch": {
"adapter": "CodeLLDB",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/test",
"stopAtEntry": true
}
},
"lldb-vscode": {
"adapter": "lldb-vscode",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/test",
"stopAtEntry": true
}
},
"cpptools": {
"adapter": "vscode-cpptools", "adapter": "vscode-cpptools",
"configuration": { "configuration": {
"request": "launch", "request": "launch",
"program": "${workspaceRoot}/test", "program": "${workspaceRoot}/test",
"stopOnEntry": true, "stopAtEntry": true
"MIMode": "lldb"
} }
} }
} }

View file

@ -1,4 +1,4 @@
def Settings( **kwargs ): def Settings( **kwargs ):
return { return {
'flags': [ '-x', 'c++', '-Wall', '-Wextra', '-std=c++17' ] 'flags': [ '-x', 'c++', '-Wall', '-Wextra' ]
} }

View file

@ -1,5 +1,3 @@
#include <cstdio>
#include <cstdlib>
#include <iostream> #include <iostream>
namespace Test namespace Test
@ -35,8 +33,6 @@ int main ( int argc, char ** argv )
{ {
int x{ 10 }; int x{ 10 };
printf( "HOME: %s\n", getenv( "HOME" ) );
Test::TestStruct t{ true, {99} }; Test::TestStruct t{ true, {99} };
foo( t ); foo( t );
} }

View file

@ -1,3 +1,2 @@
bin/ bin/
obj/Debug obj/Debug
obj/

View file

@ -1,57 +1,21 @@
{ {
"adapters": { "configurations": {
"netcoredbg-debuglog": { "launch - netcoredbg": {
"attach": { "adapter": "netcoredbg",
"pidProperty": "processId", "configuration": {
"pidSelect": "ask" "request": "launch",
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.2/csharp.dll",
"args": [],
"stopAtEntry": true
}
}, },
"command": [ "launch - mono": {
"${gadgetDir}/netcoredbg/netcoredbg", "adapter": "vscode-mono-debug",
"--interpreter=vscode", "configuration": {
"--engineLogging=${workspaceRoot}/netcoredbg.engine.log", "request": "launch",
"--log=${workspaceRoot}/netcoredbg.log" "program": "${workspaceRoot}/Program.exe"
], }
"configuration": {
"cwd": "${workspaceRoot}"
},
"name": "netcoredbg"
}
},
"configurations": {
//
// NOTE:
// If you add to this, you must update tests/get_configurations.test.vim
//
"launch - netcoredbg": {
"adapter": "netcoredbg",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/bin/Debug/netcoreapp3.1/csharp.dll",
"args": [],
"stopAtEntry": false
}
},
"launch - netcoredbg - with debug log": {
"adapter": "netcoredbg-debuglog",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/bin/Debug/netcoreapp3.1/csharp.dll",
"args": [],
"stopAtEntry": false
}
},
"launch - mono": {
"adapter": "vscode-mono-debug",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/Program.exe",
"console": "integratedTerminal",
"cwd": "${workspaceRoot}",
"args": [],
"env": {}
} }
} }
}
} }

View file

@ -2,36 +2,11 @@
namespace csharp namespace csharp
{ {
class Program class Program
{
string toaster = "Making round of toast";
static int max_bread = 100;
int bread = max_bread;
void PrintToast( int r ) {
int this_round = ( max_bread - bread - r);
Console.WriteLine( this.toaster + ": " + this_round );
}
void MakeToast( int rounds ) {
if (this.bread - rounds < 0) {
throw new Exception( "No moar bread!" );
}
this.bread -= rounds;
for (int r = 0; r < rounds; ++r) {
this.PrintToast( r );
}
Console.WriteLine( "Got only " + this.bread + " left" );
}
static void Main(string[] args)
{ {
Program p = new Program(); static void Main(string[] args)
for (int x = 1; x < 10; ++ x) { {
p.MakeToast( x ); Console.WriteLine("Hello World!");
} }
} }
}
} }

View file

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View file

@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26124.0 VisualStudioVersion = 15.0.26124.0
MinimumVisualStudioVersion = 15.0.26124.0 MinimumVisualStudioVersion = 15.0.26124.0
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp", "csharp.csproj", "{91DB205F-E422-430B-BBB8-955110C7B3B6}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -17,18 +15,4 @@ Global
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Debug|x64.ActiveCfg = Debug|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Debug|x64.Build.0 = Debug|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Debug|x86.ActiveCfg = Debug|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Debug|x86.Build.0 = Debug|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Release|Any CPU.Build.0 = Release|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Release|x64.ActiveCfg = Release|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Release|x64.Build.0 = Release|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Release|x86.ActiveCfg = Release|Any CPU
{91DB205F-E422-430B-BBB8-955110C7B3B6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal EndGlobal

View file

@ -0,0 +1,5 @@
{
"version": 1,
"dgSpecHash": "6/vdr7YprlSIoQecv/nNuLNflFpO0X7eN7jHUinZTsgian9nYpmHMWirsDWMi5l+29TH+Qy8O/QfaB/48QtjRQ==",
"success": true
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/Users/ben/.vim/bundle/vimspector/support/test/csharp/obj/project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/ben/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/ben/.nuget/packages/;/usr/local/share/dotnet/sdk/NuGetFallbackFolder</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.9.4</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.props" Condition="Exists('/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.props')" />
</ImportGroup>
</Project>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="/usr/local/share/dotnet/sdk/NuGetFallbackFolder/netstandard.library/2.0.3/build/netstandard2.0/NETStandard.Library.targets" Condition="Exists('/usr/local/share/dotnet/sdk/NuGetFallbackFolder/netstandard.library/2.0.3/build/netstandard2.0/NETStandard.Library.targets')" />
<Import Project="/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.targets" Condition="Exists('/usr/local/share/dotnet/sdk/NuGetFallbackFolder/microsoft.netcore.app/2.2.0/build/netcoreapp2.2/Microsoft.NETCore.App.targets')" />
</ImportGroup>
</Project>

View file

@ -0,0 +1,742 @@
{
"version": 3,
"targets": {
".NETCoreApp,Version=v2.2": {
"Microsoft.NETCore.App/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.NETCore.DotNetHostPolicy": "2.2.0",
"Microsoft.NETCore.Platforms": "2.2.0",
"Microsoft.NETCore.Targets": "2.0.0",
"NETStandard.Library": "2.0.3"
},
"compile": {
"ref/netcoreapp2.2/Microsoft.CSharp.dll": {},
"ref/netcoreapp2.2/Microsoft.VisualBasic.dll": {},
"ref/netcoreapp2.2/Microsoft.Win32.Primitives.dll": {},
"ref/netcoreapp2.2/System.AppContext.dll": {},
"ref/netcoreapp2.2/System.Buffers.dll": {},
"ref/netcoreapp2.2/System.Collections.Concurrent.dll": {},
"ref/netcoreapp2.2/System.Collections.Immutable.dll": {},
"ref/netcoreapp2.2/System.Collections.NonGeneric.dll": {},
"ref/netcoreapp2.2/System.Collections.Specialized.dll": {},
"ref/netcoreapp2.2/System.Collections.dll": {},
"ref/netcoreapp2.2/System.ComponentModel.Annotations.dll": {},
"ref/netcoreapp2.2/System.ComponentModel.DataAnnotations.dll": {},
"ref/netcoreapp2.2/System.ComponentModel.EventBasedAsync.dll": {},
"ref/netcoreapp2.2/System.ComponentModel.Primitives.dll": {},
"ref/netcoreapp2.2/System.ComponentModel.TypeConverter.dll": {},
"ref/netcoreapp2.2/System.ComponentModel.dll": {},
"ref/netcoreapp2.2/System.Configuration.dll": {},
"ref/netcoreapp2.2/System.Console.dll": {},
"ref/netcoreapp2.2/System.Core.dll": {},
"ref/netcoreapp2.2/System.Data.Common.dll": {},
"ref/netcoreapp2.2/System.Data.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.Contracts.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.Debug.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.DiagnosticSource.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.FileVersionInfo.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.Process.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.StackTrace.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.TextWriterTraceListener.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.Tools.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.TraceSource.dll": {},
"ref/netcoreapp2.2/System.Diagnostics.Tracing.dll": {},
"ref/netcoreapp2.2/System.Drawing.Primitives.dll": {},
"ref/netcoreapp2.2/System.Drawing.dll": {},
"ref/netcoreapp2.2/System.Dynamic.Runtime.dll": {},
"ref/netcoreapp2.2/System.Globalization.Calendars.dll": {},
"ref/netcoreapp2.2/System.Globalization.Extensions.dll": {},
"ref/netcoreapp2.2/System.Globalization.dll": {},
"ref/netcoreapp2.2/System.IO.Compression.Brotli.dll": {},
"ref/netcoreapp2.2/System.IO.Compression.FileSystem.dll": {},
"ref/netcoreapp2.2/System.IO.Compression.ZipFile.dll": {},
"ref/netcoreapp2.2/System.IO.Compression.dll": {},
"ref/netcoreapp2.2/System.IO.FileSystem.DriveInfo.dll": {},
"ref/netcoreapp2.2/System.IO.FileSystem.Primitives.dll": {},
"ref/netcoreapp2.2/System.IO.FileSystem.Watcher.dll": {},
"ref/netcoreapp2.2/System.IO.FileSystem.dll": {},
"ref/netcoreapp2.2/System.IO.IsolatedStorage.dll": {},
"ref/netcoreapp2.2/System.IO.MemoryMappedFiles.dll": {},
"ref/netcoreapp2.2/System.IO.Pipes.dll": {},
"ref/netcoreapp2.2/System.IO.UnmanagedMemoryStream.dll": {},
"ref/netcoreapp2.2/System.IO.dll": {},
"ref/netcoreapp2.2/System.Linq.Expressions.dll": {},
"ref/netcoreapp2.2/System.Linq.Parallel.dll": {},
"ref/netcoreapp2.2/System.Linq.Queryable.dll": {},
"ref/netcoreapp2.2/System.Linq.dll": {},
"ref/netcoreapp2.2/System.Memory.dll": {},
"ref/netcoreapp2.2/System.Net.Http.dll": {},
"ref/netcoreapp2.2/System.Net.HttpListener.dll": {},
"ref/netcoreapp2.2/System.Net.Mail.dll": {},
"ref/netcoreapp2.2/System.Net.NameResolution.dll": {},
"ref/netcoreapp2.2/System.Net.NetworkInformation.dll": {},
"ref/netcoreapp2.2/System.Net.Ping.dll": {},
"ref/netcoreapp2.2/System.Net.Primitives.dll": {},
"ref/netcoreapp2.2/System.Net.Requests.dll": {},
"ref/netcoreapp2.2/System.Net.Security.dll": {},
"ref/netcoreapp2.2/System.Net.ServicePoint.dll": {},
"ref/netcoreapp2.2/System.Net.Sockets.dll": {},
"ref/netcoreapp2.2/System.Net.WebClient.dll": {},
"ref/netcoreapp2.2/System.Net.WebHeaderCollection.dll": {},
"ref/netcoreapp2.2/System.Net.WebProxy.dll": {},
"ref/netcoreapp2.2/System.Net.WebSockets.Client.dll": {},
"ref/netcoreapp2.2/System.Net.WebSockets.dll": {},
"ref/netcoreapp2.2/System.Net.dll": {},
"ref/netcoreapp2.2/System.Numerics.Vectors.dll": {},
"ref/netcoreapp2.2/System.Numerics.dll": {},
"ref/netcoreapp2.2/System.ObjectModel.dll": {},
"ref/netcoreapp2.2/System.Reflection.DispatchProxy.dll": {},
"ref/netcoreapp2.2/System.Reflection.Emit.ILGeneration.dll": {},
"ref/netcoreapp2.2/System.Reflection.Emit.Lightweight.dll": {},
"ref/netcoreapp2.2/System.Reflection.Emit.dll": {},
"ref/netcoreapp2.2/System.Reflection.Extensions.dll": {},
"ref/netcoreapp2.2/System.Reflection.Metadata.dll": {},
"ref/netcoreapp2.2/System.Reflection.Primitives.dll": {},
"ref/netcoreapp2.2/System.Reflection.TypeExtensions.dll": {},
"ref/netcoreapp2.2/System.Reflection.dll": {},
"ref/netcoreapp2.2/System.Resources.Reader.dll": {},
"ref/netcoreapp2.2/System.Resources.ResourceManager.dll": {},
"ref/netcoreapp2.2/System.Resources.Writer.dll": {},
"ref/netcoreapp2.2/System.Runtime.CompilerServices.VisualC.dll": {},
"ref/netcoreapp2.2/System.Runtime.Extensions.dll": {},
"ref/netcoreapp2.2/System.Runtime.Handles.dll": {},
"ref/netcoreapp2.2/System.Runtime.InteropServices.RuntimeInformation.dll": {},
"ref/netcoreapp2.2/System.Runtime.InteropServices.WindowsRuntime.dll": {},
"ref/netcoreapp2.2/System.Runtime.InteropServices.dll": {},
"ref/netcoreapp2.2/System.Runtime.Loader.dll": {},
"ref/netcoreapp2.2/System.Runtime.Numerics.dll": {},
"ref/netcoreapp2.2/System.Runtime.Serialization.Formatters.dll": {},
"ref/netcoreapp2.2/System.Runtime.Serialization.Json.dll": {},
"ref/netcoreapp2.2/System.Runtime.Serialization.Primitives.dll": {},
"ref/netcoreapp2.2/System.Runtime.Serialization.Xml.dll": {},
"ref/netcoreapp2.2/System.Runtime.Serialization.dll": {},
"ref/netcoreapp2.2/System.Runtime.dll": {},
"ref/netcoreapp2.2/System.Security.Claims.dll": {},
"ref/netcoreapp2.2/System.Security.Cryptography.Algorithms.dll": {},
"ref/netcoreapp2.2/System.Security.Cryptography.Csp.dll": {},
"ref/netcoreapp2.2/System.Security.Cryptography.Encoding.dll": {},
"ref/netcoreapp2.2/System.Security.Cryptography.Primitives.dll": {},
"ref/netcoreapp2.2/System.Security.Cryptography.X509Certificates.dll": {},
"ref/netcoreapp2.2/System.Security.Principal.dll": {},
"ref/netcoreapp2.2/System.Security.SecureString.dll": {},
"ref/netcoreapp2.2/System.Security.dll": {},
"ref/netcoreapp2.2/System.ServiceModel.Web.dll": {},
"ref/netcoreapp2.2/System.ServiceProcess.dll": {},
"ref/netcoreapp2.2/System.Text.Encoding.Extensions.dll": {},
"ref/netcoreapp2.2/System.Text.Encoding.dll": {},
"ref/netcoreapp2.2/System.Text.RegularExpressions.dll": {},
"ref/netcoreapp2.2/System.Threading.Overlapped.dll": {},
"ref/netcoreapp2.2/System.Threading.Tasks.Dataflow.dll": {},
"ref/netcoreapp2.2/System.Threading.Tasks.Extensions.dll": {},
"ref/netcoreapp2.2/System.Threading.Tasks.Parallel.dll": {},
"ref/netcoreapp2.2/System.Threading.Tasks.dll": {},
"ref/netcoreapp2.2/System.Threading.Thread.dll": {},
"ref/netcoreapp2.2/System.Threading.ThreadPool.dll": {},
"ref/netcoreapp2.2/System.Threading.Timer.dll": {},
"ref/netcoreapp2.2/System.Threading.dll": {},
"ref/netcoreapp2.2/System.Transactions.Local.dll": {},
"ref/netcoreapp2.2/System.Transactions.dll": {},
"ref/netcoreapp2.2/System.ValueTuple.dll": {},
"ref/netcoreapp2.2/System.Web.HttpUtility.dll": {},
"ref/netcoreapp2.2/System.Web.dll": {},
"ref/netcoreapp2.2/System.Windows.dll": {},
"ref/netcoreapp2.2/System.Xml.Linq.dll": {},
"ref/netcoreapp2.2/System.Xml.ReaderWriter.dll": {},
"ref/netcoreapp2.2/System.Xml.Serialization.dll": {},
"ref/netcoreapp2.2/System.Xml.XDocument.dll": {},
"ref/netcoreapp2.2/System.Xml.XPath.XDocument.dll": {},
"ref/netcoreapp2.2/System.Xml.XPath.dll": {},
"ref/netcoreapp2.2/System.Xml.XmlDocument.dll": {},
"ref/netcoreapp2.2/System.Xml.XmlSerializer.dll": {},
"ref/netcoreapp2.2/System.Xml.dll": {},
"ref/netcoreapp2.2/System.dll": {},
"ref/netcoreapp2.2/WindowsBase.dll": {},
"ref/netcoreapp2.2/mscorlib.dll": {},
"ref/netcoreapp2.2/netstandard.dll": {}
},
"build": {
"build/netcoreapp2.2/Microsoft.NETCore.App.props": {},
"build/netcoreapp2.2/Microsoft.NETCore.App.targets": {}
}
},
"Microsoft.NETCore.DotNetAppHost/2.2.0": {
"type": "package"
},
"Microsoft.NETCore.DotNetHostPolicy/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.NETCore.DotNetHostResolver": "2.2.0"
}
},
"Microsoft.NETCore.DotNetHostResolver/2.2.0": {
"type": "package",
"dependencies": {
"Microsoft.NETCore.DotNetAppHost": "2.2.0"
}
},
"Microsoft.NETCore.Platforms/2.2.0": {
"type": "package",
"compile": {
"lib/netstandard1.0/_._": {}
},
"runtime": {
"lib/netstandard1.0/_._": {}
}
},
"Microsoft.NETCore.Targets/2.0.0": {
"type": "package",
"compile": {
"lib/netstandard1.0/_._": {}
},
"runtime": {
"lib/netstandard1.0/_._": {}
}
},
"NETStandard.Library/2.0.3": {
"type": "package",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
},
"compile": {
"lib/netstandard1.0/_._": {}
},
"runtime": {
"lib/netstandard1.0/_._": {}
},
"build": {
"build/netstandard2.0/NETStandard.Library.targets": {}
}
}
}
},
"libraries": {
"Microsoft.NETCore.App/2.2.0": {
"sha512": "7z5l8Jp324S8bU8+yyWeYHXUFYvKyiI5lqS1dXgTzOx1H69Qbf6df12kCKlNX45LpMfCMd4U3M6p7Rl5Zk7SLA==",
"type": "package",
"path": "microsoft.netcore.app/2.2.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"Microsoft.NETCore.App.versions.txt",
"THIRD-PARTY-NOTICES.TXT",
"build/netcoreapp2.2/Microsoft.NETCore.App.PlatformManifest.txt",
"build/netcoreapp2.2/Microsoft.NETCore.App.props",
"build/netcoreapp2.2/Microsoft.NETCore.App.targets",
"microsoft.netcore.app.2.2.0.nupkg.sha512",
"microsoft.netcore.app.nuspec",
"ref/netcoreapp2.2/Microsoft.CSharp.dll",
"ref/netcoreapp2.2/Microsoft.CSharp.xml",
"ref/netcoreapp2.2/Microsoft.VisualBasic.dll",
"ref/netcoreapp2.2/Microsoft.VisualBasic.xml",
"ref/netcoreapp2.2/Microsoft.Win32.Primitives.dll",
"ref/netcoreapp2.2/Microsoft.Win32.Primitives.xml",
"ref/netcoreapp2.2/System.AppContext.dll",
"ref/netcoreapp2.2/System.Buffers.dll",
"ref/netcoreapp2.2/System.Buffers.xml",
"ref/netcoreapp2.2/System.Collections.Concurrent.dll",
"ref/netcoreapp2.2/System.Collections.Concurrent.xml",
"ref/netcoreapp2.2/System.Collections.Immutable.dll",
"ref/netcoreapp2.2/System.Collections.Immutable.xml",
"ref/netcoreapp2.2/System.Collections.NonGeneric.dll",
"ref/netcoreapp2.2/System.Collections.NonGeneric.xml",
"ref/netcoreapp2.2/System.Collections.Specialized.dll",
"ref/netcoreapp2.2/System.Collections.Specialized.xml",
"ref/netcoreapp2.2/System.Collections.dll",
"ref/netcoreapp2.2/System.Collections.xml",
"ref/netcoreapp2.2/System.ComponentModel.Annotations.dll",
"ref/netcoreapp2.2/System.ComponentModel.Annotations.xml",
"ref/netcoreapp2.2/System.ComponentModel.DataAnnotations.dll",
"ref/netcoreapp2.2/System.ComponentModel.EventBasedAsync.dll",
"ref/netcoreapp2.2/System.ComponentModel.EventBasedAsync.xml",
"ref/netcoreapp2.2/System.ComponentModel.Primitives.dll",
"ref/netcoreapp2.2/System.ComponentModel.Primitives.xml",
"ref/netcoreapp2.2/System.ComponentModel.TypeConverter.dll",
"ref/netcoreapp2.2/System.ComponentModel.TypeConverter.xml",
"ref/netcoreapp2.2/System.ComponentModel.dll",
"ref/netcoreapp2.2/System.ComponentModel.xml",
"ref/netcoreapp2.2/System.Configuration.dll",
"ref/netcoreapp2.2/System.Console.dll",
"ref/netcoreapp2.2/System.Console.xml",
"ref/netcoreapp2.2/System.Core.dll",
"ref/netcoreapp2.2/System.Data.Common.dll",
"ref/netcoreapp2.2/System.Data.Common.xml",
"ref/netcoreapp2.2/System.Data.dll",
"ref/netcoreapp2.2/System.Diagnostics.Contracts.dll",
"ref/netcoreapp2.2/System.Diagnostics.Contracts.xml",
"ref/netcoreapp2.2/System.Diagnostics.Debug.dll",
"ref/netcoreapp2.2/System.Diagnostics.Debug.xml",
"ref/netcoreapp2.2/System.Diagnostics.DiagnosticSource.dll",
"ref/netcoreapp2.2/System.Diagnostics.DiagnosticSource.xml",
"ref/netcoreapp2.2/System.Diagnostics.FileVersionInfo.dll",
"ref/netcoreapp2.2/System.Diagnostics.FileVersionInfo.xml",
"ref/netcoreapp2.2/System.Diagnostics.Process.dll",
"ref/netcoreapp2.2/System.Diagnostics.Process.xml",
"ref/netcoreapp2.2/System.Diagnostics.StackTrace.dll",
"ref/netcoreapp2.2/System.Diagnostics.StackTrace.xml",
"ref/netcoreapp2.2/System.Diagnostics.TextWriterTraceListener.dll",
"ref/netcoreapp2.2/System.Diagnostics.TextWriterTraceListener.xml",
"ref/netcoreapp2.2/System.Diagnostics.Tools.dll",
"ref/netcoreapp2.2/System.Diagnostics.Tools.xml",
"ref/netcoreapp2.2/System.Diagnostics.TraceSource.dll",
"ref/netcoreapp2.2/System.Diagnostics.TraceSource.xml",
"ref/netcoreapp2.2/System.Diagnostics.Tracing.dll",
"ref/netcoreapp2.2/System.Diagnostics.Tracing.xml",
"ref/netcoreapp2.2/System.Drawing.Primitives.dll",
"ref/netcoreapp2.2/System.Drawing.Primitives.xml",
"ref/netcoreapp2.2/System.Drawing.dll",
"ref/netcoreapp2.2/System.Dynamic.Runtime.dll",
"ref/netcoreapp2.2/System.Globalization.Calendars.dll",
"ref/netcoreapp2.2/System.Globalization.Extensions.dll",
"ref/netcoreapp2.2/System.Globalization.dll",
"ref/netcoreapp2.2/System.IO.Compression.Brotli.dll",
"ref/netcoreapp2.2/System.IO.Compression.FileSystem.dll",
"ref/netcoreapp2.2/System.IO.Compression.ZipFile.dll",
"ref/netcoreapp2.2/System.IO.Compression.ZipFile.xml",
"ref/netcoreapp2.2/System.IO.Compression.dll",
"ref/netcoreapp2.2/System.IO.Compression.xml",
"ref/netcoreapp2.2/System.IO.FileSystem.DriveInfo.dll",
"ref/netcoreapp2.2/System.IO.FileSystem.DriveInfo.xml",
"ref/netcoreapp2.2/System.IO.FileSystem.Primitives.dll",
"ref/netcoreapp2.2/System.IO.FileSystem.Watcher.dll",
"ref/netcoreapp2.2/System.IO.FileSystem.Watcher.xml",
"ref/netcoreapp2.2/System.IO.FileSystem.dll",
"ref/netcoreapp2.2/System.IO.FileSystem.xml",
"ref/netcoreapp2.2/System.IO.IsolatedStorage.dll",
"ref/netcoreapp2.2/System.IO.IsolatedStorage.xml",
"ref/netcoreapp2.2/System.IO.MemoryMappedFiles.dll",
"ref/netcoreapp2.2/System.IO.MemoryMappedFiles.xml",
"ref/netcoreapp2.2/System.IO.Pipes.dll",
"ref/netcoreapp2.2/System.IO.Pipes.xml",
"ref/netcoreapp2.2/System.IO.UnmanagedMemoryStream.dll",
"ref/netcoreapp2.2/System.IO.dll",
"ref/netcoreapp2.2/System.Linq.Expressions.dll",
"ref/netcoreapp2.2/System.Linq.Expressions.xml",
"ref/netcoreapp2.2/System.Linq.Parallel.dll",
"ref/netcoreapp2.2/System.Linq.Parallel.xml",
"ref/netcoreapp2.2/System.Linq.Queryable.dll",
"ref/netcoreapp2.2/System.Linq.Queryable.xml",
"ref/netcoreapp2.2/System.Linq.dll",
"ref/netcoreapp2.2/System.Linq.xml",
"ref/netcoreapp2.2/System.Memory.dll",
"ref/netcoreapp2.2/System.Memory.xml",
"ref/netcoreapp2.2/System.Net.Http.dll",
"ref/netcoreapp2.2/System.Net.Http.xml",
"ref/netcoreapp2.2/System.Net.HttpListener.dll",
"ref/netcoreapp2.2/System.Net.HttpListener.xml",
"ref/netcoreapp2.2/System.Net.Mail.dll",
"ref/netcoreapp2.2/System.Net.Mail.xml",
"ref/netcoreapp2.2/System.Net.NameResolution.dll",
"ref/netcoreapp2.2/System.Net.NameResolution.xml",
"ref/netcoreapp2.2/System.Net.NetworkInformation.dll",
"ref/netcoreapp2.2/System.Net.NetworkInformation.xml",
"ref/netcoreapp2.2/System.Net.Ping.dll",
"ref/netcoreapp2.2/System.Net.Ping.xml",
"ref/netcoreapp2.2/System.Net.Primitives.dll",
"ref/netcoreapp2.2/System.Net.Primitives.xml",
"ref/netcoreapp2.2/System.Net.Requests.dll",
"ref/netcoreapp2.2/System.Net.Requests.xml",
"ref/netcoreapp2.2/System.Net.Security.dll",
"ref/netcoreapp2.2/System.Net.Security.xml",
"ref/netcoreapp2.2/System.Net.ServicePoint.dll",
"ref/netcoreapp2.2/System.Net.ServicePoint.xml",
"ref/netcoreapp2.2/System.Net.Sockets.dll",
"ref/netcoreapp2.2/System.Net.Sockets.xml",
"ref/netcoreapp2.2/System.Net.WebClient.dll",
"ref/netcoreapp2.2/System.Net.WebClient.xml",
"ref/netcoreapp2.2/System.Net.WebHeaderCollection.dll",
"ref/netcoreapp2.2/System.Net.WebHeaderCollection.xml",
"ref/netcoreapp2.2/System.Net.WebProxy.dll",
"ref/netcoreapp2.2/System.Net.WebProxy.xml",
"ref/netcoreapp2.2/System.Net.WebSockets.Client.dll",
"ref/netcoreapp2.2/System.Net.WebSockets.Client.xml",
"ref/netcoreapp2.2/System.Net.WebSockets.dll",
"ref/netcoreapp2.2/System.Net.WebSockets.xml",
"ref/netcoreapp2.2/System.Net.dll",
"ref/netcoreapp2.2/System.Numerics.Vectors.dll",
"ref/netcoreapp2.2/System.Numerics.Vectors.xml",
"ref/netcoreapp2.2/System.Numerics.dll",
"ref/netcoreapp2.2/System.ObjectModel.dll",
"ref/netcoreapp2.2/System.ObjectModel.xml",
"ref/netcoreapp2.2/System.Reflection.DispatchProxy.dll",
"ref/netcoreapp2.2/System.Reflection.DispatchProxy.xml",
"ref/netcoreapp2.2/System.Reflection.Emit.ILGeneration.dll",
"ref/netcoreapp2.2/System.Reflection.Emit.ILGeneration.xml",
"ref/netcoreapp2.2/System.Reflection.Emit.Lightweight.dll",
"ref/netcoreapp2.2/System.Reflection.Emit.Lightweight.xml",
"ref/netcoreapp2.2/System.Reflection.Emit.dll",
"ref/netcoreapp2.2/System.Reflection.Emit.xml",
"ref/netcoreapp2.2/System.Reflection.Extensions.dll",
"ref/netcoreapp2.2/System.Reflection.Metadata.dll",
"ref/netcoreapp2.2/System.Reflection.Metadata.xml",
"ref/netcoreapp2.2/System.Reflection.Primitives.dll",
"ref/netcoreapp2.2/System.Reflection.Primitives.xml",
"ref/netcoreapp2.2/System.Reflection.TypeExtensions.dll",
"ref/netcoreapp2.2/System.Reflection.TypeExtensions.xml",
"ref/netcoreapp2.2/System.Reflection.dll",
"ref/netcoreapp2.2/System.Resources.Reader.dll",
"ref/netcoreapp2.2/System.Resources.ResourceManager.dll",
"ref/netcoreapp2.2/System.Resources.ResourceManager.xml",
"ref/netcoreapp2.2/System.Resources.Writer.dll",
"ref/netcoreapp2.2/System.Resources.Writer.xml",
"ref/netcoreapp2.2/System.Runtime.CompilerServices.VisualC.dll",
"ref/netcoreapp2.2/System.Runtime.CompilerServices.VisualC.xml",
"ref/netcoreapp2.2/System.Runtime.Extensions.dll",
"ref/netcoreapp2.2/System.Runtime.Extensions.xml",
"ref/netcoreapp2.2/System.Runtime.Handles.dll",
"ref/netcoreapp2.2/System.Runtime.InteropServices.RuntimeInformation.dll",
"ref/netcoreapp2.2/System.Runtime.InteropServices.RuntimeInformation.xml",
"ref/netcoreapp2.2/System.Runtime.InteropServices.WindowsRuntime.dll",
"ref/netcoreapp2.2/System.Runtime.InteropServices.WindowsRuntime.xml",
"ref/netcoreapp2.2/System.Runtime.InteropServices.dll",
"ref/netcoreapp2.2/System.Runtime.InteropServices.xml",
"ref/netcoreapp2.2/System.Runtime.Loader.dll",
"ref/netcoreapp2.2/System.Runtime.Loader.xml",
"ref/netcoreapp2.2/System.Runtime.Numerics.dll",
"ref/netcoreapp2.2/System.Runtime.Numerics.xml",
"ref/netcoreapp2.2/System.Runtime.Serialization.Formatters.dll",
"ref/netcoreapp2.2/System.Runtime.Serialization.Formatters.xml",
"ref/netcoreapp2.2/System.Runtime.Serialization.Json.dll",
"ref/netcoreapp2.2/System.Runtime.Serialization.Json.xml",
"ref/netcoreapp2.2/System.Runtime.Serialization.Primitives.dll",
"ref/netcoreapp2.2/System.Runtime.Serialization.Primitives.xml",
"ref/netcoreapp2.2/System.Runtime.Serialization.Xml.dll",
"ref/netcoreapp2.2/System.Runtime.Serialization.Xml.xml",
"ref/netcoreapp2.2/System.Runtime.Serialization.dll",
"ref/netcoreapp2.2/System.Runtime.dll",
"ref/netcoreapp2.2/System.Runtime.xml",
"ref/netcoreapp2.2/System.Security.Claims.dll",
"ref/netcoreapp2.2/System.Security.Claims.xml",
"ref/netcoreapp2.2/System.Security.Cryptography.Algorithms.dll",
"ref/netcoreapp2.2/System.Security.Cryptography.Algorithms.xml",
"ref/netcoreapp2.2/System.Security.Cryptography.Csp.dll",
"ref/netcoreapp2.2/System.Security.Cryptography.Csp.xml",
"ref/netcoreapp2.2/System.Security.Cryptography.Encoding.dll",
"ref/netcoreapp2.2/System.Security.Cryptography.Encoding.xml",
"ref/netcoreapp2.2/System.Security.Cryptography.Primitives.dll",
"ref/netcoreapp2.2/System.Security.Cryptography.Primitives.xml",
"ref/netcoreapp2.2/System.Security.Cryptography.X509Certificates.dll",
"ref/netcoreapp2.2/System.Security.Cryptography.X509Certificates.xml",
"ref/netcoreapp2.2/System.Security.Principal.dll",
"ref/netcoreapp2.2/System.Security.Principal.xml",
"ref/netcoreapp2.2/System.Security.SecureString.dll",
"ref/netcoreapp2.2/System.Security.dll",
"ref/netcoreapp2.2/System.ServiceModel.Web.dll",
"ref/netcoreapp2.2/System.ServiceProcess.dll",
"ref/netcoreapp2.2/System.Text.Encoding.Extensions.dll",
"ref/netcoreapp2.2/System.Text.Encoding.Extensions.xml",
"ref/netcoreapp2.2/System.Text.Encoding.dll",
"ref/netcoreapp2.2/System.Text.RegularExpressions.dll",
"ref/netcoreapp2.2/System.Text.RegularExpressions.xml",
"ref/netcoreapp2.2/System.Threading.Overlapped.dll",
"ref/netcoreapp2.2/System.Threading.Overlapped.xml",
"ref/netcoreapp2.2/System.Threading.Tasks.Dataflow.dll",
"ref/netcoreapp2.2/System.Threading.Tasks.Dataflow.xml",
"ref/netcoreapp2.2/System.Threading.Tasks.Extensions.dll",
"ref/netcoreapp2.2/System.Threading.Tasks.Extensions.xml",
"ref/netcoreapp2.2/System.Threading.Tasks.Parallel.dll",
"ref/netcoreapp2.2/System.Threading.Tasks.Parallel.xml",
"ref/netcoreapp2.2/System.Threading.Tasks.dll",
"ref/netcoreapp2.2/System.Threading.Tasks.xml",
"ref/netcoreapp2.2/System.Threading.Thread.dll",
"ref/netcoreapp2.2/System.Threading.Thread.xml",
"ref/netcoreapp2.2/System.Threading.ThreadPool.dll",
"ref/netcoreapp2.2/System.Threading.ThreadPool.xml",
"ref/netcoreapp2.2/System.Threading.Timer.dll",
"ref/netcoreapp2.2/System.Threading.Timer.xml",
"ref/netcoreapp2.2/System.Threading.dll",
"ref/netcoreapp2.2/System.Threading.xml",
"ref/netcoreapp2.2/System.Transactions.Local.dll",
"ref/netcoreapp2.2/System.Transactions.Local.xml",
"ref/netcoreapp2.2/System.Transactions.dll",
"ref/netcoreapp2.2/System.ValueTuple.dll",
"ref/netcoreapp2.2/System.Web.HttpUtility.dll",
"ref/netcoreapp2.2/System.Web.HttpUtility.xml",
"ref/netcoreapp2.2/System.Web.dll",
"ref/netcoreapp2.2/System.Windows.dll",
"ref/netcoreapp2.2/System.Xml.Linq.dll",
"ref/netcoreapp2.2/System.Xml.ReaderWriter.dll",
"ref/netcoreapp2.2/System.Xml.ReaderWriter.xml",
"ref/netcoreapp2.2/System.Xml.Serialization.dll",
"ref/netcoreapp2.2/System.Xml.XDocument.dll",
"ref/netcoreapp2.2/System.Xml.XDocument.xml",
"ref/netcoreapp2.2/System.Xml.XPath.XDocument.dll",
"ref/netcoreapp2.2/System.Xml.XPath.XDocument.xml",
"ref/netcoreapp2.2/System.Xml.XPath.dll",
"ref/netcoreapp2.2/System.Xml.XPath.xml",
"ref/netcoreapp2.2/System.Xml.XmlDocument.dll",
"ref/netcoreapp2.2/System.Xml.XmlSerializer.dll",
"ref/netcoreapp2.2/System.Xml.XmlSerializer.xml",
"ref/netcoreapp2.2/System.Xml.dll",
"ref/netcoreapp2.2/System.dll",
"ref/netcoreapp2.2/WindowsBase.dll",
"ref/netcoreapp2.2/mscorlib.dll",
"ref/netcoreapp2.2/netstandard.dll",
"runtime.json"
]
},
"Microsoft.NETCore.DotNetAppHost/2.2.0": {
"sha512": "DrhaKInRKKvN6Ns2VNIlC7ZffLOp9THf8cO6X4fytPRJovJUbF49/zzx4WfgX9E44FMsw9hT8hrKiIqDSHvGvA==",
"type": "package",
"path": "microsoft.netcore.dotnetapphost/2.2.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"microsoft.netcore.dotnetapphost.2.2.0.nupkg.sha512",
"microsoft.netcore.dotnetapphost.nuspec",
"runtime.json"
]
},
"Microsoft.NETCore.DotNetHostPolicy/2.2.0": {
"sha512": "FJie7IoPZFaPgNDxhZGmDBQP/Bs5vPdfca/G2Wf9gd6LIvMYkZcibtmJwB4tcf4KXkaOYfIOo4Cl9sEPMsSzkw==",
"type": "package",
"path": "microsoft.netcore.dotnethostpolicy/2.2.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"microsoft.netcore.dotnethostpolicy.2.2.0.nupkg.sha512",
"microsoft.netcore.dotnethostpolicy.nuspec",
"runtime.json"
]
},
"Microsoft.NETCore.DotNetHostResolver/2.2.0": {
"sha512": "spDm3AJYmebthDNhzY17YLPtvbc+Y1lCLVeiIH1uLJ/hZaM+40pBiPefFR8J1u66Ndkqi8ipR2tEbqPnYnjRhw==",
"type": "package",
"path": "microsoft.netcore.dotnethostresolver/2.2.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"microsoft.netcore.dotnethostresolver.2.2.0.nupkg.sha512",
"microsoft.netcore.dotnethostresolver.nuspec",
"runtime.json"
]
},
"Microsoft.NETCore.Platforms/2.2.0": {
"sha512": "T/J+XZo+YheFTJh8/4uoeJDdz5qOmOMkjg6/VL8mHJ9AnP8+fmV/kcbxeXsob0irRNiChf+V0ig1MCRLp/+Kog==",
"type": "package",
"path": "microsoft.netcore.platforms/2.2.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"lib/netstandard1.0/_._",
"microsoft.netcore.platforms.2.2.0.nupkg.sha512",
"microsoft.netcore.platforms.nuspec",
"runtime.json",
"useSharedDesignerContext.txt",
"version.txt"
]
},
"Microsoft.NETCore.Targets/2.0.0": {
"sha512": "odP/tJj1z6GylFpNo7pMtbd/xQgTC3Ex2If63dRTL38bBNMwsBnJ+RceUIyHdRBC0oik/3NehYT+oECwBhIM3Q==",
"type": "package",
"path": "microsoft.netcore.targets/2.0.0",
"files": [
".nupkg.metadata",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"lib/netstandard1.0/_._",
"microsoft.netcore.targets.2.0.0.nupkg.sha512",
"microsoft.netcore.targets.nuspec",
"runtime.json",
"useSharedDesignerContext.txt",
"version.txt"
]
},
"NETStandard.Library/2.0.3": {
"sha512": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"type": "package",
"path": "netstandard.library/2.0.3",
"files": [
".nupkg.metadata",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"build/netstandard2.0/NETStandard.Library.targets",
"build/netstandard2.0/ref/Microsoft.Win32.Primitives.dll",
"build/netstandard2.0/ref/System.AppContext.dll",
"build/netstandard2.0/ref/System.Collections.Concurrent.dll",
"build/netstandard2.0/ref/System.Collections.NonGeneric.dll",
"build/netstandard2.0/ref/System.Collections.Specialized.dll",
"build/netstandard2.0/ref/System.Collections.dll",
"build/netstandard2.0/ref/System.ComponentModel.Composition.dll",
"build/netstandard2.0/ref/System.ComponentModel.EventBasedAsync.dll",
"build/netstandard2.0/ref/System.ComponentModel.Primitives.dll",
"build/netstandard2.0/ref/System.ComponentModel.TypeConverter.dll",
"build/netstandard2.0/ref/System.ComponentModel.dll",
"build/netstandard2.0/ref/System.Console.dll",
"build/netstandard2.0/ref/System.Core.dll",
"build/netstandard2.0/ref/System.Data.Common.dll",
"build/netstandard2.0/ref/System.Data.dll",
"build/netstandard2.0/ref/System.Diagnostics.Contracts.dll",
"build/netstandard2.0/ref/System.Diagnostics.Debug.dll",
"build/netstandard2.0/ref/System.Diagnostics.FileVersionInfo.dll",
"build/netstandard2.0/ref/System.Diagnostics.Process.dll",
"build/netstandard2.0/ref/System.Diagnostics.StackTrace.dll",
"build/netstandard2.0/ref/System.Diagnostics.TextWriterTraceListener.dll",
"build/netstandard2.0/ref/System.Diagnostics.Tools.dll",
"build/netstandard2.0/ref/System.Diagnostics.TraceSource.dll",
"build/netstandard2.0/ref/System.Diagnostics.Tracing.dll",
"build/netstandard2.0/ref/System.Drawing.Primitives.dll",
"build/netstandard2.0/ref/System.Drawing.dll",
"build/netstandard2.0/ref/System.Dynamic.Runtime.dll",
"build/netstandard2.0/ref/System.Globalization.Calendars.dll",
"build/netstandard2.0/ref/System.Globalization.Extensions.dll",
"build/netstandard2.0/ref/System.Globalization.dll",
"build/netstandard2.0/ref/System.IO.Compression.FileSystem.dll",
"build/netstandard2.0/ref/System.IO.Compression.ZipFile.dll",
"build/netstandard2.0/ref/System.IO.Compression.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.DriveInfo.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.Primitives.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.Watcher.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.dll",
"build/netstandard2.0/ref/System.IO.IsolatedStorage.dll",
"build/netstandard2.0/ref/System.IO.MemoryMappedFiles.dll",
"build/netstandard2.0/ref/System.IO.Pipes.dll",
"build/netstandard2.0/ref/System.IO.UnmanagedMemoryStream.dll",
"build/netstandard2.0/ref/System.IO.dll",
"build/netstandard2.0/ref/System.Linq.Expressions.dll",
"build/netstandard2.0/ref/System.Linq.Parallel.dll",
"build/netstandard2.0/ref/System.Linq.Queryable.dll",
"build/netstandard2.0/ref/System.Linq.dll",
"build/netstandard2.0/ref/System.Net.Http.dll",
"build/netstandard2.0/ref/System.Net.NameResolution.dll",
"build/netstandard2.0/ref/System.Net.NetworkInformation.dll",
"build/netstandard2.0/ref/System.Net.Ping.dll",
"build/netstandard2.0/ref/System.Net.Primitives.dll",
"build/netstandard2.0/ref/System.Net.Requests.dll",
"build/netstandard2.0/ref/System.Net.Security.dll",
"build/netstandard2.0/ref/System.Net.Sockets.dll",
"build/netstandard2.0/ref/System.Net.WebHeaderCollection.dll",
"build/netstandard2.0/ref/System.Net.WebSockets.Client.dll",
"build/netstandard2.0/ref/System.Net.WebSockets.dll",
"build/netstandard2.0/ref/System.Net.dll",
"build/netstandard2.0/ref/System.Numerics.dll",
"build/netstandard2.0/ref/System.ObjectModel.dll",
"build/netstandard2.0/ref/System.Reflection.Extensions.dll",
"build/netstandard2.0/ref/System.Reflection.Primitives.dll",
"build/netstandard2.0/ref/System.Reflection.dll",
"build/netstandard2.0/ref/System.Resources.Reader.dll",
"build/netstandard2.0/ref/System.Resources.ResourceManager.dll",
"build/netstandard2.0/ref/System.Resources.Writer.dll",
"build/netstandard2.0/ref/System.Runtime.CompilerServices.VisualC.dll",
"build/netstandard2.0/ref/System.Runtime.Extensions.dll",
"build/netstandard2.0/ref/System.Runtime.Handles.dll",
"build/netstandard2.0/ref/System.Runtime.InteropServices.RuntimeInformation.dll",
"build/netstandard2.0/ref/System.Runtime.InteropServices.dll",
"build/netstandard2.0/ref/System.Runtime.Numerics.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Formatters.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Json.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Primitives.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Xml.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.dll",
"build/netstandard2.0/ref/System.Runtime.dll",
"build/netstandard2.0/ref/System.Security.Claims.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Algorithms.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Csp.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Encoding.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Primitives.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.X509Certificates.dll",
"build/netstandard2.0/ref/System.Security.Principal.dll",
"build/netstandard2.0/ref/System.Security.SecureString.dll",
"build/netstandard2.0/ref/System.ServiceModel.Web.dll",
"build/netstandard2.0/ref/System.Text.Encoding.Extensions.dll",
"build/netstandard2.0/ref/System.Text.Encoding.dll",
"build/netstandard2.0/ref/System.Text.RegularExpressions.dll",
"build/netstandard2.0/ref/System.Threading.Overlapped.dll",
"build/netstandard2.0/ref/System.Threading.Tasks.Parallel.dll",
"build/netstandard2.0/ref/System.Threading.Tasks.dll",
"build/netstandard2.0/ref/System.Threading.Thread.dll",
"build/netstandard2.0/ref/System.Threading.ThreadPool.dll",
"build/netstandard2.0/ref/System.Threading.Timer.dll",
"build/netstandard2.0/ref/System.Threading.dll",
"build/netstandard2.0/ref/System.Transactions.dll",
"build/netstandard2.0/ref/System.ValueTuple.dll",
"build/netstandard2.0/ref/System.Web.dll",
"build/netstandard2.0/ref/System.Windows.dll",
"build/netstandard2.0/ref/System.Xml.Linq.dll",
"build/netstandard2.0/ref/System.Xml.ReaderWriter.dll",
"build/netstandard2.0/ref/System.Xml.Serialization.dll",
"build/netstandard2.0/ref/System.Xml.XDocument.dll",
"build/netstandard2.0/ref/System.Xml.XPath.XDocument.dll",
"build/netstandard2.0/ref/System.Xml.XPath.dll",
"build/netstandard2.0/ref/System.Xml.XmlDocument.dll",
"build/netstandard2.0/ref/System.Xml.XmlSerializer.dll",
"build/netstandard2.0/ref/System.Xml.dll",
"build/netstandard2.0/ref/System.dll",
"build/netstandard2.0/ref/mscorlib.dll",
"build/netstandard2.0/ref/netstandard.dll",
"build/netstandard2.0/ref/netstandard.xml",
"lib/netstandard1.0/_._",
"netstandard.library.2.0.3.nupkg.sha512",
"netstandard.library.nuspec"
]
}
},
"projectFileDependencyGroups": {
".NETCoreApp,Version=v2.2": [
"Microsoft.NETCore.App >= 2.2.0"
]
},
"packageFolders": {
"/Users/ben/.nuget/packages/": {},
"/usr/local/share/dotnet/sdk/NuGetFallbackFolder": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/csharp.csproj",
"projectName": "csharp",
"projectPath": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/csharp.csproj",
"packagesPath": "/Users/ben/.nuget/packages/",
"outputPath": "/Users/ben/.vim/bundle/vimspector/support/test/csharp/obj/",
"projectStyle": "PackageReference",
"fallbackFolders": [
"/usr/local/share/dotnet/sdk/NuGetFallbackFolder"
],
"configFilePaths": [
"/Users/ben/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"netcoreapp2.2"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netcoreapp2.2": {
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netcoreapp2.2": {
"dependencies": {
"Microsoft.NETCore.App": {
"suppressParent": "All",
"target": "Package",
"version": "[2.2.0, )",
"autoReferenced": true
}
},
"imports": [
"net461"
],
"assetTargetFallback": true,
"warn": true
}
}
}
}

View file

@ -1,22 +1,7 @@
{ {
"adapters": {
"dlv-dap": {
"variables": {
"port": "${unusedLocalPort}"
},
"command": [
"$HOME/go/bin/dlv",
"dap",
"--listen",
"127.0.0.1:${port}"
],
"port": "${port}"
}
},
"configurations": { "configurations": {
"run": { "run": {
"adapter": "vscode-go", "adapter": "vscode-go",
"default": true,
"configuration": { "configuration": {
"request": "launch", "request": "launch",
"program": "${workspaceRoot}/hello-world.go", "program": "${workspaceRoot}/hello-world.go",
@ -25,35 +10,6 @@
"trace": true, "trace": true,
"env": { "GO111MODULE": "off" } "env": { "GO111MODULE": "off" }
} }
},
"run-dap": {
"adapter": "dlv-dap",
"configuration": {
"request": "launch",
"env": { "GO111MODULE": "off" },
"mode": "debug", // debug|test
"program": "${workspaceRoot}/hello-world.go"
// "args": [],
// "buildFlags": ...
// "stackTraceDepth": ...,
// "showGlobalVariables": true,
}
},
"run-exec": {
// NOTE: To use this you _must_ disable optimistaion:
// go build -o hello_world -gcflags="all=-N -l"
// https://github.com/golang/vscode-go/blob/master/docs/debugging.md#troubleshooting
"adapter": "vscode-go",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/hello-world",
"mode": "exec",
"dlvToolPath": "$HOME/go/bin/dlv",
"trace": true,
"env": { "GO111MODULE": "off" }
}
} }
} }
} }

View file

@ -1,29 +0,0 @@
{
"configurations": {
"run-cmd": {
"adapter": "vscode-go",
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/cmd/namestartswithvowel/main.go",
"mode": "debug",
"dlvToolPath": "$HOME/go/bin/dlv",
"dlvLoadConfig": {
"maxArrayValues": 1000,
"maxStringLen": 1000
}
}
},
"test-current-file": {
"adapter": "vscode-go",
"configuration": {
"request": "launch",
"mode": "test",
"program": "${fileDirname}",
"cwd": "${fileDirname}",
"dlvToolPath": "$GOPATH/bin/dlv",
"env": {},
"args": []
}
}
}
}

View file

@ -1,33 +0,0 @@
# Purpose
This example comes with two example vimspector configs for the Go programming language.
1) `run-cmd` will launch the main programme under `cmd/namestartswithvowel`.
1) `test-current-file` will run the tests in the current file in debug mode.
## Example use-cases
### run-cmd
* Open `cmd/namestartswithvowel/main.go`
* Add a breakpoint somewhere within the programme
* Start the debugger (`:call vimspector#Continue()` or your relevant keymapping)
* Select the first launch configuration (`1: run-cmd`)
### test-current-file
* Open `internal/vowels/vowels_test.go`
* Add a breakpoint somewhere within the test
* Start the debugger (`:call vimspector#Continue()` or your relevant keymapping)
* Select the second launch configuration (`2: test-current-file`)
## Additional Configuration
There are two additional configuration options specified under `run-cmd`; these parameters configure the maximum string/array size to be shown while debugging.
```
"dlvLoadConfig": {
"maxArrayValues": 1000,
"maxStringLen": 1000
}
```

View file

@ -1,20 +0,0 @@
package main
import (
"fmt"
"example.com/internal/vowels"
)
func main() {
names := []string{"Simon", "Bob", "Jennifer", "Amy", "Duke", "Elizabeth"}
for _, n := range names {
if vowels.NameStartsWithVowel(n) {
fmt.Printf("%s starts with a vowel!\n", n)
continue
}
fmt.Printf("%s does not start with a vowel!\n", n)
}
}

View file

@ -1,3 +0,0 @@
module example.com
go 1.16

View file

@ -1,9 +0,0 @@
package vowels
import "strings"
func NameStartsWithVowel(name string) bool {
s := strings.Split(strings.ToLower(name), "")
return s[0] == "a" || s[0] == "e" || s[0] == "i" || s[0] == "o" || s[0] == "u"
}

View file

@ -1,30 +0,0 @@
package vowels
import (
"fmt"
"testing"
)
func TestNameStartsWithVowel(t *testing.T) {
testCases := []struct {
input string
expectedOutput bool
}{
{
input: "Simon",
expectedOutput: false,
},
{
input: "Andy",
expectedOutput: true,
},
}
for _, tt := range testCases {
t.Run(fmt.Sprintf("%s should product %t", tt.input, tt.expectedOutput), func(t *testing.T) {
out := NameStartsWithVowel(tt.input)
if out != tt.expectedOutput {
t.Errorf("%s produced %t, when %t was expected", tt.input, out, tt.expectedOutput)
}
})
}
}

View file

@ -4,7 +4,7 @@
<artifactId>TestApplication</artifactId> <artifactId>TestApplication</artifactId>
<version>1</version> <version>1</version>
<properties> <properties>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>
</properties> </properties>
</project> </project>

View file

@ -1,2 +0,0 @@
.gradle
build

View file

@ -1,21 +0,0 @@
{
"configurations": {
"kotlin-debug-adapter launch": {
"adapter": "cust_kotlin-debug-adapter",
"configuration": {
"request": "launch",
"projectRoot": "${workspaceFolder}",
"mainClass": "vimspector/test/ApplicationKt"
}
},
"kotlin-debug-adapter attach": {
"adapter": "cust_kotlin-debug-adapter",
"configuration": {
"request": "attach",
"projectRoot": "${workspaceFolder}",
"hostName": "${hostName}",
"port": "${port}"
}
}
}
}

View file

@ -1,25 +0,0 @@
plugins {
kotlin("jvm") version "1.4.0"
application
}
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
// Align versions of all Kotlin components
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
}
application {
// Define the main class for the application.
mainClassName = "vimspector.test.ApplicationKt"
}

View file

@ -1 +0,0 @@
rootProject.name = "vimspector-test"

View file

@ -1,5 +0,0 @@
package vimspector.test
fun main(args: Array<String>) {
println("Hello World!")
}

View file

@ -1,18 +0,0 @@
{
"$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}"],
"stopOnEntry": false
}
}
}
}

View file

@ -1,12 +0,0 @@
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

View file

@ -1,10 +0,0 @@
if pcall(require, 'lldebugger') then
require('lldebugger').start()
end
local time = 0
function love.update(dt)
time = time + dt
love.event.quit()
end

View file

@ -1,18 +0,0 @@
{
"$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}"],
"stopOnEntry": false
}
}
}
}

View file

@ -1,21 +0,0 @@
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

View file

@ -1,31 +0,0 @@
{
"$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",
"stopOnEntry": false
}
}
},
"luajit": {
"adapter": "lua-local",
"configuration": {
"request": "launch",
"type": "lua-local",
"cwd": "${workspaceFolder}",
"program": {
"lua": "luajit",
"file": "simple.lua",
"stopOnEntry": false
}
}
}
}
}

View file

@ -1,21 +0,0 @@
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())

View file

@ -3,7 +3,7 @@ var msg = 'Hello, world!'
var obj = { var obj = {
test: 'testing', test: 'testing',
toast: function() { toast: function() {
return 'toasty' + this.test; return 'toasty' . this.test;
} }
} }

View file

@ -1,21 +0,0 @@
{
"configurations": {
"run": {
"adapter": "debugpy",
"default": true,
"configuration": {
"request": "launch",
"program": "${workspaceRoot}/moo.py",
"cwd": "${workspaceRoot}",
"stopOnEntry": true
},
"breakpoints": {
"exception": {
"raised": "N",
"uncaught": "",
"userUnhandled": ""
}
}
}
}
}

View file

@ -1,15 +0,0 @@
def Say( *args, **kwargs ):
print( *args, **kwargs )
def Quiet():
pass

View file

@ -1,13 +0,0 @@
import cow
def Moo():
for i in range( 1, 100 ):
cow.Say( 'Moo' )
for i in range( 1, 100 ):
cow.Say( 'Ooom' )
if __name__ == '__main__':
Moo()

View file

@ -1,56 +1,5 @@
{ {
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
"adapters": {
"run_with_debugpy": {
"command": [ "${workspaceRoot}/run_with_debugpy" ],
"port": 9876,
"env": {
"DEBUG_PORT": "9876"
}
},
"python-remote-docker": {
"variables": {
"port": "8765"
},
"port": "${port}",
"launch": {
"remote": {
"container": "${ContainerID}",
"runCommand": [
"python3", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"--wait-for-client",
"%CMD%"
]
},
"delay": "5000m"
}
},
"python-remote-ssh": {
"variables": {
"port": "8765"
},
"port": "${port}",
"host": "${host}",
"launch": {
"remote": {
"host": "${host}",
"account": "${account}",
"runCommand": [
"python3", "-m", "debugpy", "--listen", "0.0.0.0:${port}",
"--wait-for-client",
"%CMD%"
]
}
}
}
},
"configurations": { "configurations": {
"Use custom gadget": {
"adapter": "test_custom",
"configuration": {
"request": "launch"
}
},
// This is a comment. // This is a comment.
"run legacy vscode-python": { "run legacy vscode-python": {
"adapter": "vscode-python", /* coment goes here too */ "adapter": "vscode-python", /* coment goes here too */
@ -83,33 +32,6 @@
} }
} }
}, },
"attach-run": {
"adapter": "run_with_debugpy",
"configuration": {
"request": "attach"
},
"breakpoints": {
"exception": {
"raised": "N",
"uncaught": "",
"userUnhandled": ""
}
}
},
"docker-attach": {
"adapter": "python-remote-docker",
"remote-cmdLine": [ "/root/main.py" ],
"remote-request": "launch",
"configuration": {
"request": "attach",
"pathMappings": [
{
"localRoot": "${workspaceRoot}",
"remoteRoot": "/root"
}
]
}
},
"run": { "run": {
"adapter": "debugpy", "adapter": "debugpy",
"configuration": { "configuration": {
@ -130,11 +52,6 @@
}, },
"run - default": { "run - default": {
"adapter": "debugpy", "adapter": "debugpy",
"variables": {
"MAKE_ENV_OUTPUT": {
"shell": "${workspaceRoot}/make_env.sh"
}
},
"configuration": { "configuration": {
"request": "launch", "request": "launch",
"type": "python", "type": "python",
@ -143,8 +60,8 @@
"stopOnEntry#json": "${StopOnEntry:true}", "stopOnEntry#json": "${StopOnEntry:true}",
"console": "integratedTerminal", "console": "integratedTerminal",
"args#json": "${args:[]}", "args#json": "${args:[]}",
"igored#json#s": "string not json", "env#json": "${env:{\\}}",
"env#json": "${MAKE_ENV_OUTPUT}" "igored#json#s": "string not json"
}, },
"breakpoints": { "breakpoints": {
"exception": { "exception": {
@ -182,23 +99,6 @@
"stopOnEntry": false, "stopOnEntry": false,
"console": "integratedTerminal" "console": "integratedTerminal"
} }
},
"run - remote host": {
"adapter": "python-remote-ssh",
"remote-cmdLine": [
"${remoteRoot}/main.py"
],
"remote-request": "launch",
"configuration": {
"request": "attach",
"redirectOutput": true,
"pathMappings": [
{
"localRoot": "${workspaceRoot}",
"remoteRoot": "${remoteRoot}"
}
]
}
} }
} }
} }

View file

@ -1,22 +0,0 @@
FROM ubuntu:18.04
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install sudo \
lsb-release \
ca-certificates \
python3-dev \
python3-pip \
ca-cacert \
locales \
language-pack-en \
libncurses5-dev libncursesw5-dev \
git && \
apt-get -y autoremove
## cleanup of files from setup
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pip3 install debugpy
ADD main.py /root/main.py

View file

@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -e
if [ "$1" = "--continue" ]; then
OPTS=""
else
OPTS="--no-cache"
fi
docker build ${OPTS} -t puremourning/vimspector:simple_python .

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
cat <<"EOF"
{
"Something": "Value1",
"SomethingElse": "Value2"
}
EOF

View file

@ -1,15 +0,0 @@
#!/usr/bin/env python
import os
def Main():
print( os.environ.get( 'Something', 'ERROR' ) )
print( os.environ.get( 'SomethingElse', 'ERROR' ) )
for k, v in os.environ:
print( f'{ k } = "{ v }"' )
Main()

View file

@ -1,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if [ -z "$DEBUG_PORT" ]; then PYTHON=python3
DEBUG_PORT=5678
if [ -n "$1" ]; then
PYTHON=$1
fi fi
pushd $(dirname $0) pushd $(dirname $0)
@ -9,11 +11,10 @@ pushd $(dirname $0)
rm -rf env rm -rf env
fi fi
python3 -m venv env $PYTHON -m venv env
. env/bin/activate . env/bin/activate
python -m pip install -r requirements.txt python -m pip install -r requirements.txt
echo "using port $DEBUG_PORT"
echo "*** Launching ***" echo "*** Launching ***"
python -m debugpy --wait-for-client --listen 0.0.0.0:${DEBUG_PORT} main.py python -m debugpy --wait-for-client --listen 0.0.0.0:5678 main.py
popd popd

View file

@ -3,8 +3,6 @@
set SCALAR g set SCALAR g
array set ARRAY {key1 value1 key2 value2} array set ARRAY {key1 value1 key2 value2}
set LIST [list a b c {def} {g h i j} k l m]
proc Wrap { body } { proc Wrap { body } {
uplevel 1 $body uplevel 1 $body
} }

View file

@ -1,12 +1,43 @@
function! SetUp() function! SetUp()
call vimspector#test#setup#SetUpWithMappings( v:none ) call vimspector#test#setup#SetUpWithMappings( v:none )
call ThisTestIsFlaky()
endfunction endfunction
function! ClearDown() function! ClearDown()
call vimspector#test#setup#ClearDown() call vimspector#test#setup#ClearDown()
endfunction endfunction
function! SetUp_Test_Mappings_Are_Added_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Mappings_Are_Added_HUMAN()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Mappings_Are_Added_VISUAL_STUDIO()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
function! Test_Mappings_Are_Added_VISUAL_STUDIO()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Signs_Placed_Using_API_Are_Shown() function! SetUp_Test_Signs_Placed_Using_API_Are_Shown()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO' let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction endfunction
@ -47,6 +78,68 @@ function! Test_Signs_Placed_Using_API_Are_Shown()
%bwipeout! %bwipeout!
endfunction endfunction
function! SetUp_Test_Use_Mappings_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Use_Mappings_HUMAN()
lcd testdata/cpp/simple
edit simple.cpp
call setpos( '.', [ 0, 15, 1 ] )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Disable the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBPDisabled',
\ 9 )
" Delete the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add it again
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Here we go. Start Debugging
call feedkeys( "\<F5>", 'xt' )
call assert_equal( 2, len( gettabinfo() ) )
let cur_tabnr = tabpagenr()
call assert_equal( 5, len( gettabinfo( cur_tabnr )[ 0 ].windows ) )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cp', 16 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! SetUp_Test_StopAtEntry() function! SetUp_Test_StopAtEntry()
let g:vimspector_enable_mappings = 'HUMAN' let g:vimspector_enable_mappings = 'HUMAN'
endfunction endfunction
@ -107,8 +200,8 @@ function Test_DisableBreakpointWhileDebugging()
\ 16 ) \ 16 )
\ } ) \ } )
call setpos( '.', [ 0, 1, 1 ] ) " Add the breakpoint
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 ) call feedkeys( "\<F9>", 'xt' )
call WaitForAssert( {-> call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupSingletonAtLine( \ vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode', \ 'VimspectorCode',
@ -118,6 +211,7 @@ function Test_DisableBreakpointWhileDebugging()
\ } ) \ } )
" Run to breakpoint " Run to breakpoint
call setpos( '.', [ 0, 15, 1 ] )
call feedkeys( "\<F5>", 'xt' ) call feedkeys( "\<F5>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {-> call WaitForAssert( {->
@ -164,58 +258,6 @@ function Test_DisableBreakpointWhileDebugging()
%bwipeout! %bwipeout!
endfunction endfunction
function! Test_Add_Breakpoints_In_File_Then_Open()
lcd testdata/cpp/simple
" Set and clear without file open
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
call vimspector#ClearLineBreakpoint( 'simple.cpp', 16 )
" Clear non-set breakpoint
call vimspector#ClearLineBreakpoint( 'simple.cpp', 1 )
" Re-add
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
" Open and expect sign to be added
edit simple.cpp
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 16,
\ 'vimspectorBP',
\ 9 )
call vimspector#LaunchWithSettings( { 'configuration': 'run-to-breakpoint' } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! Test_Add_Breakpoints_In_NonOpenedFile_RunToBreak()
lcd testdata/cpp/simple
" add
call vimspector#SetLineBreakpoint( 'simple.cpp', 16 )
call vimspector#LaunchWithSettings( {
\ 'configuration': 'run-to-breakpoint-specify-file',
\ 'prog': 'simple'
\ } )
call WaitFor( {-> bufexists( 'simple.cpp' ) } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 16,
\ 'vimspectorPCBP',
\ 200 )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! SetUp_Test_Insert_Code_Above_Breakpoint() function! SetUp_Test_Insert_Code_Above_Breakpoint()
let g:vimspector_enable_mappings = 'HUMAN' let g:vimspector_enable_mappings = 'HUMAN'
endfunction endfunction
@ -266,6 +308,7 @@ function! Test_Insert_Code_Above_Breakpoint()
" Delete it " Delete it
call feedkeys( "\<F9>", 'xt' ) call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 26 ) call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 26 )
endfunction endfunction
function! SetUp_Test_Conditional_Line_Breakpoint() function! SetUp_Test_Conditional_Line_Breakpoint()
@ -280,8 +323,8 @@ function! Test_Conditional_Line_Breakpoint()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 ) call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 )
" Add the conditional breakpoint (note , is the mapleader) " Add the conditional breakpoint
call feedkeys( ",\<F9>argc==0\<CR>\<CR>", 'xt' ) call feedkeys( "\\\<F9>argc==0\<CR>\<CR>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP', call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 16, \ 16,
\ 'vimspectorBPCond', \ 'vimspectorBPCond',
@ -317,11 +360,8 @@ function! Test_Conditional_Line_Breakpoint()
\ 'vimspectorBP', \ 'vimspectorBP',
\ 9 ) \ 9 )
call setpos( '.', [ 0, 1, 1 ] ) call setpos( '.', [ 0, 17, 1 ] )
call vimspector#SetLineBreakpoint( call vimspector#ToggleBreakpoint( { 'condition': 'argc == 1' } )
\ 'simple.cpp',
\ 17,
\ { 'condition': 'argc == 1' } )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP', \ 'VimspectorBP',
\ 17, \ 17,
@ -360,8 +400,8 @@ function! Test_Conditional_Line_Breakpoint_Hit()
exe 'edit' fn exe 'edit' fn
call setpos( '.', [ 0, 14, 1 ] ) call setpos( '.', [ 0, 14, 1 ] )
" Add the conditional breakpoint (3 times) (note , is the mapleader) " Add the conditional breakpoint (3 times)
call feedkeys( ",\<F9>\<CR>3\<CR>", 'xt' ) call feedkeys( "\\\<F9>\<CR>3\<CR>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP', \ 'VimspectorBP',
\ 14, \ 14,
@ -536,7 +576,7 @@ function! Test_Custom_Breakpoint_Priority()
\ 'vimspectorBPDisabled', \ 'vimspectorBPDisabled',
\ 4 ) \ 4 )
call vimspector#ToggleBreakpoint() call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 ) call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
call setpos( '.', [ 0, 17, 1 ] ) call setpos( '.', [ 0, 17, 1 ] )
call vimspector#ToggleBreakpoint( { 'condition': '1' } ) call vimspector#ToggleBreakpoint( { 'condition': '1' } )
@ -623,7 +663,7 @@ function! Test_Custom_Breakpoint_Priority_Partial()
\ 'vimspectorBPDisabled', \ 'vimspectorBPDisabled',
\ 4 ) \ 4 )
call vimspector#ToggleBreakpoint() call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 ) call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
call setpos( '.', [ 0, 17, 1 ] ) call setpos( '.', [ 0, 17, 1 ] )
call vimspector#ToggleBreakpoint( { 'condition': '1' } ) call vimspector#ToggleBreakpoint( { 'condition': '1' } )
@ -683,72 +723,3 @@ function! Test_Custom_Breakpoint_Priority_Partial()
%bwipeout! %bwipeout!
unlet! g:vimspector_sign_priority unlet! g:vimspector_sign_priority
endfunction endfunction
function! Test_Add_Line_BP_In_Other_File_While_Debugging()
call ThisTestIsFlaky()
let moo = 'moo.py'
let cow = 'cow.py'
lcd ../support/test/python/multiple_files
exe 'edit' moo
call vimspector#Launch()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 1, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
call cursor( 6, 3 )
call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
call WaitForAssert( {->
\vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode',
\ 6,
\ 'vimspectorBP',
\ 9 ) } )
exe 'edit' cow
call cursor( 2, 1 )
call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode',
\ 2,
\ 'vimspectorBP',
\ 9 ) } )
call vimspector#Continue()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 6, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 6 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 2 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 6,
\ 'vimspectorBP',
\ 9 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 6,
\ 'vimspectorPCBP',
\ 200 )
call vimspector#Continue()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( cow, 2, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( cow, 2 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 2,
\ 'vimspectorBP',
\ 9 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 2,
\ 'vimspectorPCBP',
\ 200 )
lcd -
call vimspector#test#setup#Reset()
%bwipe!
endfunction

View file

@ -1,13 +1,44 @@
function! SetUp() function! SetUp()
set ambiwidth=double set ambiwidth=double
call vimspector#test#setup#SetUpWithMappings( v:none ) call vimspector#test#setup#SetUpWithMappings( v:none )
call ThisTestIsFlaky()
endfunction endfunction
function! ClearDown() function! ClearDown()
call vimspector#test#setup#ClearDown() call vimspector#test#setup#ClearDown()
endfunction endfunction
function! SetUp_Test_Mappings_Are_Added_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Mappings_Are_Added_HUMAN()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Mappings_Are_Added_VISUAL_STUDIO()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
function! Test_Mappings_Are_Added_VISUAL_STUDIO()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Signs_Placed_Using_API_Are_Shown() function! SetUp_Test_Signs_Placed_Using_API_Are_Shown()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO' let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction endfunction
@ -101,7 +132,7 @@ function! Test_Use_Mappings_HUMAN()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {-> call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 ) \ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cp', 16 )
\ } ) \ } )
call vimspector#test#setup#Reset() call vimspector#test#setup#Reset()
@ -293,8 +324,8 @@ function! Test_Conditional_Line_Breakpoint()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 ) call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 ) call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 )
" Add the conditional breakpoint (, is mapleader) " Add the conditional breakpoint
call feedkeys( ",\<F9>argc==0\<CR>\<CR>", 'xt' ) call feedkeys( "\\\<F9>argc==0\<CR>\<CR>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP', call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 16, \ 16,
\ 'vimspectorBPCond', \ 'vimspectorBPCond',
@ -370,8 +401,8 @@ function! Test_Conditional_Line_Breakpoint_Hit()
exe 'edit' fn exe 'edit' fn
call setpos( '.', [ 0, 14, 1 ] ) call setpos( '.', [ 0, 14, 1 ] )
" Add the conditional breakpoint (3 times) (, is mapleader) " Add the conditional breakpoint (3 times)
call feedkeys( ",\<F9>\<CR>3\<CR>", 'xt' ) call feedkeys( "\\\<F9>\<CR>3\<CR>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP', \ 'VimspectorBP',
\ 14, \ 14,
@ -546,7 +577,7 @@ function! Test_Custom_Breakpoint_Priority()
\ 'vimspectorBPDisabled', \ 'vimspectorBPDisabled',
\ 4 ) \ 4 )
call vimspector#ToggleBreakpoint() call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 ) call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
call setpos( '.', [ 0, 17, 1 ] ) call setpos( '.', [ 0, 17, 1 ] )
call vimspector#ToggleBreakpoint( { 'condition': '1' } ) call vimspector#ToggleBreakpoint( { 'condition': '1' } )
@ -633,7 +664,7 @@ function! Test_Custom_Breakpoint_Priority_Partial()
\ 'vimspectorBPDisabled', \ 'vimspectorBPDisabled',
\ 4 ) \ 4 )
call vimspector#ToggleBreakpoint() call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 16 ) call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
call setpos( '.', [ 0, 17, 1 ] ) call setpos( '.', [ 0, 17, 1 ] )
call vimspector#ToggleBreakpoint( { 'condition': '1' } ) call vimspector#ToggleBreakpoint( { 'condition': '1' } )
@ -693,73 +724,3 @@ function! Test_Custom_Breakpoint_Priority_Partial()
%bwipeout! %bwipeout!
unlet! g:vimspector_sign_priority unlet! g:vimspector_sign_priority
endfunction endfunction
function! Test_Add_Line_BP_In_Other_File_While_Debugging()
call ThisTestIsFlaky()
let moo = 'moo.py'
let cow = 'cow.py'
lcd ../support/test/python/multiple_files
exe 'edit' moo
call vimspector#Launch()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 1, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
call cursor( 6, 3 )
call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 1 )
call WaitForAssert( {->
\vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode',
\ 6,
\ 'vimspectorBP',
\ 9 ) } )
exe 'edit' cow
call cursor( 2, 1 )
call vimspector#ToggleBreakpoint()
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorCode',
\ 2,
\ 'vimspectorBP',
\ 9 ) } )
call vimspector#Continue()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( moo, 6, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( moo, 6 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 2 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 6,
\ 'vimspectorBP',
\ 9 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 6,
\ 'vimspectorPCBP',
\ 200 )
call vimspector#Continue()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( cow, 2, 1 )
call vimspector#test#signs#AssertPCIsAtLineInBuffer( cow, 2 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorCode', 6 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 2,
\ 'vimspectorBP',
\ 9 )
call vimspector#test#signs#AssertSignAtLine(
\ 'VimspectorCode',
\ 2,
\ 'vimspectorPCBP',
\ 200 )
lcd -
call vimspector#test#setup#Reset()
%bwipe!
endfunction

View file

@ -4,19 +4,8 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL C.UTF-8 ENV LC_ALL C.UTF-8
RUN apt-get update && \ RUN apt-get update && \
apt-get 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 dist-upgrade && \
apt-get -y install gcc-8 \ apt-get -y install python3-dev \
g++-8 \
python3-dev \
python3-pip \ python3-pip \
python3-venv \ python3-venv \
ca-cacert \ ca-cacert \
@ -28,18 +17,14 @@ RUN apt-get update && \
tcllib \ tcllib \
gdb \ gdb \
lldb \ lldb \
curl \
nodejs \ nodejs \
lua5.1 \ npm && \
luajit \
love && \
apt-get -y autoremove apt-get -y autoremove
RUN ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \ RUN ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \
dpkg-reconfigure --frontend noninteractive tzdata dpkg-reconfigure --frontend noninteractive tzdata
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 1 \
--slave /usr/bin/g++ g++ /usr/bin/g++-8
## cleanup of files from setup ## cleanup of files from setup
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
@ -70,12 +55,6 @@ RUN mkdir -p /home/linuxbrew/.linuxbrew &&\
RUN /home/linuxbrew/.linuxbrew/bin/brew install golang RUN /home/linuxbrew/.linuxbrew/bin/brew install golang
# dotnet
RUN curl -sSL https://dot.net/v1/dotnet-install.sh \
| bash /dev/stdin --channel LTS --install-dir /usr/share/dotnet && \
update-alternatives --install /usr/bin/dotnet dotnet \
/usr/share/dotnet/dotnet 1
# clean up # clean up
RUN /home/linuxbrew/.linuxbrew/bin/brew cleanup && \ RUN /home/linuxbrew/.linuxbrew/bin/brew cleanup && \
rm -rf ~/.cache && \ rm -rf ~/.cache && \

View file

@ -1,22 +0,0 @@
function! SetUp()
call vimspector#test#setup#SetUpWithMappings( v:none )
endfunction
function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function Test_Get_Configurations()
lcd ../support/test/csharp/
let configs = vimspector#GetConfigurations()
call assert_equal([
\ 'launch - netcoredbg',
\ 'launch - netcoredbg - with debug log',
\ 'launch - mono',
\ ], configs)
lcd -
%bwipe!
endfunction

View file

@ -1,65 +0,0 @@
function! SetUp()
call vimspector#test#setup#SetUpWithMappings( v:none )
endfunction
function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function! SetUp_Test_Go_Simple()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_CSharp_Simple()
let fn='Program.cs'
lcd ../support/test/csharp
exe 'edit ' . fn
call vimspector#SetLineBreakpoint( fn, 31 )
call vimspector#LaunchWithSettings( {
\ 'configuration': 'launch - netcoredbg'
\ } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 31, 7 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 31 )
\ } )
call vimspector#StepOver()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 32, 12 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 32 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! Test_Run_To_Cursor()
let fn='Program.cs'
lcd ../support/test/csharp
exe 'edit ' . fn
call vimspector#SetLineBreakpoint( fn, 31 )
call vimspector#LaunchWithSettings( {
\ 'configuration': 'launch - netcoredbg'
\ } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 31, 7 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 31 )
\ } )
call cursor( 33, 1 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 33, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 33 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction

View file

@ -45,28 +45,3 @@ function! Test_Go_Simple()
lcd - lcd -
%bwipeout! %bwipeout!
endfunction endfunction
function! Test_Run_To_Cursor()
let fn='hello-world.go'
lcd ../support/test/go/hello_world
exe 'edit ' . fn
call vimspector#SetLineBreakpoint( fn, 4 )
call vimspector#Launch()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 4, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 4 )
\ } )
call cursor( 5, 1 )
call vimspector#RunToCursor()
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 5, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 5 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction

View file

@ -1,74 +0,0 @@
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, 5 )
call vimspector#LaunchWithSettings( { 'configuration': a:configuration } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 5, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 5 )
\ } )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 6, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 6 )
\ } )
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( "\<F10>", '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

View file

@ -50,59 +50,3 @@ function! vimspector#test#setup#Reset() abort
call popup_clear() call popup_clear()
endfunction endfunction
let s:g_stack = {}
function! vimspector#test#setup#PushGlobal( name, value ) abort
if !has_key( s:g_stack, a:name )
let s:g_stack[ a:name ] = []
endif
let old_value = get( g:, a:name, v:null )
call add( s:g_stack[ a:name ], old_value )
let g:[ a:name ] = a:value
return old_value
endfunction
function! vimspector#test#setup#PopGlobal( name ) abort
if !has_key( s:g_stack, a:name ) || len( s:g_stack[ a:name ] ) == 0
return v:null
endif
let old_value = s:g_stack[ a:name ][ -1 ]
call remove( s:g_stack[ a:name ], -1 )
if old_value is v:null
silent! call remove( g:, a:name )
else
let g:[ a:name ] = old_value
endif
return old_value
endfunction
let s:o_stack = {}
function! vimspector#test#setup#PushOption( name, value ) abort
if !has_key( s:o_stack, a:name )
let s:o_stack[ a:name ] = []
endif
let old_value = v:null
execute 'let old_value = &' . a:name
call add( s:o_stack[ a:name ], old_value )
execute 'set ' . a:name . '=' . a:value
return old_value
endfunction
function! vimspector#test#setup#PopOption( name ) abort
if !has_key( s:o_stack, a:name ) || len( s:o_stack[ a:name ] ) == 0
return v:null
endif
let old_value = s:o_stack[ a:name ][ -1 ]
call remove( s:o_stack[ a:name ], -1 )
execute 'set ' . a:name . '=' . old_value
return old_value
endfunction

View file

@ -1,7 +1,6 @@
function! vimspector#test#signs#AssertCursorIsAtLineInBuffer( buffer, function! vimspector#test#signs#AssertCursorIsAtLineInBuffer( buffer,
\ line, \ line,
\ column ) abort \ column ) abort
call WaitFor( {-> bufexists( a:buffer ) } )
call WaitForAssert( {-> call WaitForAssert( {->
\ assert_equal( fnamemodify( a:buffer, ':p' ), \ assert_equal( fnamemodify( a:buffer, ':p' ),
\ fnamemodify( bufname( '%' ), ':p' ), \ fnamemodify( bufname( '%' ), ':p' ),
@ -16,7 +15,6 @@ function! vimspector#test#signs#AssertCursorIsAtLineInBuffer( buffer,
endfunction endfunction
function! vimspector#test#signs#AssertPCIsAtLineInBuffer( buffer, line ) abort function! vimspector#test#signs#AssertPCIsAtLineInBuffer( buffer, line ) abort
call WaitFor( {-> bufexists( a:buffer ) } )
let signs = sign_getplaced( a:buffer, { let signs = sign_getplaced( a:buffer, {
\ 'group': 'VimspectorCode', \ 'group': 'VimspectorCode',
\ } ) \ } )
@ -72,11 +70,7 @@ function! vimspector#test#signs#AssertSignGroupSingletonAtLine( group,
endfunction endfunction
function! vimspector#test#signs#AssertSignAtLine( function! vimspector#test#signs#AssertSignAtLine( group, line, sign_name, priority ) abort
\ group,
\ line,
\ sign_name,
\ priority ) abort
let signs = sign_getplaced( '%', { let signs = sign_getplaced( '%', {
\ 'group': a:group, \ 'group': a:group,
@ -112,7 +106,7 @@ endfunction
function! vimspector#test#signs#AssertSignGroupEmptyAtLine( group, line ) abort function! vimspector#test#signs#AssertSignGroupEmptyAtLine( group, line ) abort
let signs = sign_getplaced( '%', { let signs = sign_getplaced( '%', {
\ 'group': a:group, \ 'group': a:group,
\ 'lnum': a:line, \ 'lnum': line( '.' )
\ } ) \ } )
return assert_equal( 1, return assert_equal( 1,

View file

@ -51,10 +51,7 @@ func s:WaitForCommon(expr, assert, timeout)
let start = reltime() let start = reltime()
endif endif
let iters = 0
while 1 while 1
let iters += 1
let errors_before = len( v:errors ) let errors_before = len( v:errors )
if type(a:expr) == v:t_func if type(a:expr) == v:t_func
let success = a:expr() let success = a:expr()
@ -68,10 +65,6 @@ func s:WaitForCommon(expr, assert, timeout)
return slept return slept
endif endif
if iters % 20 == 0
redraw!
endif
if slept >= a:timeout if slept >= a:timeout
break break
endif endif
@ -98,31 +91,3 @@ endfunc
function! ThisTestIsFlaky() function! ThisTestIsFlaky()
let g:test_is_flaky = v:true let g:test_is_flaky = v:true
endfunction endfunction
function! AssertMatchList( expected, actual ) abort
let ret = assert_equal( len( a:expected ), len( a:actual ) )
let len = min( [ len( a:expected ), len( a:actual ) ] )
let idx = 0
while idx < len
let ret += assert_match( a:expected[ idx ], a:actual[ idx ] )
let idx += 1
endwhile
return ret
endfunction
function! GetBufLine( buf, start, end = '$' )
if type( a:start ) != v:t_string && a:start < 0
let start = getbufinfo( a:buf )[ 0 ].linecount + a:start
else
let start = a:start
endif
if type( a:end ) != v:t_string && a:end < 0
let end = getbufinfo( a:buf )[ 0 ].linecount + a:end
else
let end = a:end
endif
return getbufline( a:buf, start, end )
endfunction

View file

@ -82,16 +82,6 @@ func! Abort( timer_id )
qa! qa!
endfunc endfunc
func! TestLog( msg )
if type( a:msg ) == v:t_string
let msg = [ a:msg ]
else
let msg = a:msg
endif
call extend( s:messages, msg )
endfunc
func RunTheTest(test) func RunTheTest(test)
echo 'Executing ' . a:test echo 'Executing ' . a:test
@ -162,6 +152,8 @@ func RunTheTest(test)
augroup END augroup END
exe 'call ' . a:test exe 'call ' . a:test
au! EarlyExit
catch /^\cskipped/ catch /^\cskipped/
call add(s:messages, ' Skipped') call add(s:messages, ' Skipped')
call add(s:skipped, call add(s:skipped,
@ -201,8 +193,6 @@ func RunTheTest(test)
call s:TestFailed() call s:TestFailed()
endtry endtry
au! EarlyExit
call timer_stop( timer ) call timer_stop( timer )
" In case 'insertmode' was set and something went wrong, make sure it is " In case 'insertmode' was set and something went wrong, make sure it is
@ -381,7 +371,7 @@ for s:test in sort(s:tests)
if len(v:errors) > 0 if len(v:errors) > 0
\ && $TEST_NO_RETRY == '' \ && $TEST_NO_RETRY == ''
\ && g:test_is_flaky \ && g:test_is_flaky
for retry in range( 10 ) for retry in range( 5 )
call add( s:messages, 'Found errors in ' . s:test . '. Retrying.' ) call add( s:messages, 'Found errors in ' . s:test . '. Retrying.' )
call extend( s:messages, v:errors ) call extend( s:messages, v:errors )

View file

@ -1,143 +0,0 @@
function! SetUp()
call vimspector#test#setup#SetUpWithMappings( v:none )
endfunction
function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function! SetUp_Test_Mappings_Are_Added_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Mappings_Are_Added_HUMAN()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
call assert_true( hasmapto( 'vimspector#RunToCursor()' ) )
endfunction
function! SetUp_Test_Mappings_Are_Added_VISUAL_STUDIO()
let g:vimspector_enable_mappings = 'VISUAL_STUDIO'
endfunction
function! Test_Mappings_Are_Added_VISUAL_STUDIO()
call assert_true( hasmapto( 'vimspector#Continue()' ) )
call assert_false( hasmapto( 'vimspector#Launch()' ) )
call assert_true( hasmapto( 'vimspector#Stop()' ) )
call assert_true( hasmapto( 'vimspector#Restart()' ) )
call assert_true( hasmapto( 'vimspector#ToggleBreakpoint()' ) )
call assert_true( hasmapto( 'vimspector#AddFunctionBreakpoint' ) )
call assert_true( hasmapto( 'vimspector#StepOver()' ) )
call assert_true( hasmapto( 'vimspector#StepInto()' ) )
call assert_true( hasmapto( 'vimspector#StepOut()' ) )
endfunction
function! SetUp_Test_Use_Mappings_HUMAN()
let g:vimspector_enable_mappings = 'HUMAN'
endfunction
function! Test_Use_Mappings_HUMAN()
call ThisTestIsFlaky()
lcd testdata/cpp/simple
edit simple.cpp
call setpos( '.', [ 0, 15, 1 ] )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Disable the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBPDisabled',
\ 9 )
" Delete the breakpoint
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add and clear using API
call vimspector#SetLineBreakpoint( 'simple.cpp', 15 )
call vimspector#test#signs#AssertSignGroupSingletonAtLine( 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
call vimspector#ClearLineBreakpoint( 'simple.cpp', 15 )
call vimspector#test#signs#AssertSignGroupEmptyAtLine( 'VimspectorBP', 15 )
" Add it again
call feedkeys( "\<F9>", 'xt' )
call vimspector#test#signs#AssertSignGroupSingletonAtLine(
\ 'VimspectorBP',
\ 15,
\ 'vimspectorBP',
\ 9 )
" Here we go. Start Debugging
call feedkeys( "\<F5>", 'xt' )
call assert_equal( 2, len( gettabinfo() ) )
let cur_tabnr = tabpagenr()
call assert_equal( 5, len( gettabinfo( cur_tabnr )[ 0 ].windows ) )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 15, 1 )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 16, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 16 )
\ } )
" Run to cursor (note , is the mapleader)
call cursor( 9, 1 )
call feedkeys( ",\<F8>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( 'simple.cpp', 9, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( 'simple.cpp', 9 )
\ } )
" Stop
call feedkeys( "\<F3>", 'xt' )
call WaitForAssert( {->
\ assert_equal( [],
\ getbufline( g:vimspector_session_windows.variables,
\ 1,
\ '$' ) )
\ } )
call WaitForAssert( {->
\ assert_equal( [],
\ getbufline( g:vimspector_session_windows.stack_trace,
\ 1,
\ '$' ) )
\ } )
call WaitForAssert( {->
\ assert_equal( [],
\ getbufline( g:vimspector_session_windows.watches,
\ 1,
\ '$' ) )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction

Some files were not shown because too many files have changed in this diff Show more