vimspector icon indicating copy to clipboard operation
vimspector copied to clipboard

Variables in nested block scopes not displaying as expected

Open gokullan opened this issue 1 year ago • 4 comments

Description

This issue is with respect to the vimspector.Variables window. If there is more than 1 block scope, the child scope is getting created, but the variables in that scope are not updated, (i.e.), the parent block scope variables are shown in the child scope as well. A screenshot is attached for your reference. Screenshot from 2023-11-01 17-15-46

Is it reproducible in vim?

Reproducible in Vim

Works with clean config?

Yes

Sample project works?

Not reproducible with sample project

Minimal Reproduction

List of steps to reproduce:

  1. Open the project vimspector/support/test/node/simple/
  2. In the simple.js file, write code that consists of multiple nested scopes (as shown in the screenshot)
  3. :call vimspector#Launch() to start the debugging.

Expected Behaviour

On stepping into a child scope, the variables of this scope should be shown in the vimspector.Variables window (below the parent scope).

Actual Behaviour

The child block is created, but the variables are not showing up in this scope.

Additional information

I used the vscode-js-debug adapter.

Installation Type

Plugin Manager (git clone)

Vimspector version

831530b85aad02f2c465047a21452409bfaaf784

Debug Info

I get the following error
AttributeError: 'DebugSession' object has no attribute '_workspace_root'

Log file

No response

Vim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1692716794

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Python version

3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]

Neovim diagnostics

==============================================================================
coc: health#coc#check

- OK nvim version satisfied
- OK Environment check passed
- OK Javascript bundle build/index.js found
- OK Service started

==============================================================================
mkdp: health#mkdp#check

- Platform: linux
- Nvim Version: NVIM v0.9.4
  Build type: Release
  LuaJIT 2.1.1692716794
  
  system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
  
  Run :checkhealth for more info
- Node version: v18.16.1
- Script: /home/d2c-gokulas/.local/share/nvim/plugged/markdown-preview.nvim/app/server.js
- Script exists: 1
- OK Using node

==============================================================================
nvim: require("nvim.health").check()

Configuration ~
- OK no issues found

Runtime ~
- OK $VIMRUNTIME: /home/d2c-gokulas/Applications/nvim-linux64/share/nvim/runtime

Performance ~
- OK Build type: Release

Remote Plugins ~
- OK Up to date

terminal ~
- key_backspace (kbs) terminfo entry: `key_backspace=\177`
- key_dc (kdch1) terminfo entry: `key_dc=\E[3~`
- $VTE_VERSION="6800"
- $COLORTERM="truecolor"

==============================================================================
provider: health#provider#check

Clipboard (optional) ~
- OK Clipboard tool found: xclip

Python 3 provider (optional) ~
- `g:python3_host_prog` is not set.  Searching for python3 in the environment.
- Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
- Executable: /usr/bin/python3
- Other python executable: /bin/python3
- Python version: 3.10.12
- pynvim version: 0.4.3
- OK Latest pynvim is installed.

Python virtualenv ~
- OK no $VIRTUAL_ENV

Ruby provider (optional) ~
- WARNING `ruby` and `gem` must be in $PATH.
  - ADVICE:
    - Install Ruby and verify that `ruby` and `gem` commands work.

Node.js provider (optional) ~
- Node.js: v18.16.1
- WARNING Missing "neovim" npm (or yarn, pnpm) package.
  - ADVICE:
    - Run in shell: npm install -g neovim
    - Run in shell (if you use yarn): yarn global add neovim
    - Run in shell (if you use pnpm): pnpm install -g neovim
    - You may disable this provider (and warning) by adding `let g:loaded_node_provider = 0` to your init.vim

Perl provider (optional) ~
- WARNING "Neovim::Ext" cpan module is not installed
  - ADVICE:
    - See :help |provider-perl| for more information.
    - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

==============================================================================
vim.lsp: require("vim.lsp.health").check()

- LSP log level : WARN
- Log path: /home/d2c-gokulas/.local/state/nvim/lsp.log
- Log size: 0 KB

vim.lsp: Active Clients ~
- No active clients

==============================================================================
vim.treesitter: require("vim.treesitter.health").check()

- Nvim runtime ABI version: 14
- OK Parser: c          ABI: 14, path: /home/d2c-gokulas/Applications/nvim-linux64/lib/nvim/parser/c.so
- OK Parser: lua        ABI: 14, path: /home/d2c-gokulas/Applications/nvim-linux64/lib/nvim/parser/lua.so
- OK Parser: query      ABI: 14, path: /home/d2c-gokulas/Applications/nvim-linux64/lib/nvim/parser/query.so
- OK Parser: vim        ABI: 14, path: /home/d2c-gokulas/Applications/nvim-linux64/lib/nvim/parser/vim.so
- OK Parser: vimdoc     ABI: 14, path: /home/d2c-gokulas/Applications/nvim-linux64/lib/nvim/parser/vimdoc.so

Operating System

Ubuntu 22.04.3 LTS (64-bit) - Jammy

Declaration

gokullan avatar Nov 01 '23 11:11 gokullan

Please can you provide the log file? It should be quick to check if this is a server issue or a vimspector issue.

puremourning avatar Nov 01 '23 11:11 puremourning

logs.txt I couldn't paste it as it exceeded the character limit.

gokullan avatar Nov 01 '23 11:11 gokullan

Thanks I can see that server is returning 2 blocks with same name. Maybe that messed us up. That's for the report will look into it.

puremourning avatar Nov 01 '23 12:11 puremourning

@puremourning This can also be observed on "variables" command with shadowed local variables. It looks like these objects are stored by their name instead of individually inside vimspector. Other clients (nvim and VSC) display it correctly.

{"type":"response","request_seq":17,"command":"variables","success":true,"body":{"variables":[{"variablesReference":2,"type":"table","name":"this","value":"0x011E49E8","evaluateName":"this"},{"variablesReference":-1,"type":"integer","name":"a","value":"1","evaluateName":"a"},{"variablesReference":-1,"type":"string","name":"a","value":"xxx","evaluateName":"a"}]}}
local a = 1
do
	local a = "xxx"
	print(a) -- breakpoint
end

samisalreadytaken avatar Apr 04 '24 19:04 samisalreadytaken