puremourning / vimspector

vimspector - A multi-language debugging system for Vim
http://puremourning.github.io/vimspector-web
Apache License 2.0
4.1k stars 173 forks source link

Cannot run tests under NeoVim #640

Closed dkaszews closed 2 years ago

dkaszews commented 2 years ago

Description

I know NeoVim support is experimental, but developing #639 I wanted to also test it aside from regular vim and noticed some very simple issues:

  1. Unknown option: --not-a-term - from my observations can be omitted, neovim has similar option --headless but it does not render the window at all, which may break some tests
  2. Unknown functions: ch_logfile, test_override, popup_close - non-critical, can be omited if not exist
  3. Unknown variable: v:none - use v:null supported by both vim and Neovim

Fixing those couple things allowed me to pass most tests on NeoVim. Some still fail on asserting current buffer or line for unclear reasons, but it's still better than nothing.

Works in vim?

Only broken in Neovim

Works with clean config?

Yes

Sample project works?

No sample project for this filetype

Minimal Reproduction

  1. alias vim to neovim or modify run_tests:RUN_VIM
  2. Add minimal test `tests/neovim.test.vim:

    function! SetUp() abort
      call vimspector#test#setup#SetUpWithMappings( v:null )
    endfunction
    
    function! Test_Can_Run_In_NeoVim()
      call assert_true( 1 )
    endfunction
  3. run_tests neovim.test.vim

Expected Behaviour

Test passes

Actual Behaviour

Multiple errors in order of fixes:

  1. vim: Unknown option argument "--not-a-term"
  2. E117: Unknown function: ch_logfile
  3. E117: Unknown function: test_override
  4. E121: Unknown variable: v:none
  5. E117: Unknown function: popup_close

Additional information

No response

Installation Type

Plugin Manager (git clone)

Vimspector version

ce7ae8b

Debug Info

No response

Log file

No response

Vim version

NVIM v0.6.1
Build type: Release
Lua 5.1
Compiled by team+vim@tracker.debian.org

Features: +acl +iconv +tui
See ":help feature-compile"

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

Run :checkhealth for more info

### Python version

_No response_

### Neovim diagnostics

```Text
nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='tmux'
  - INFO: $SSH_TTY='/dev/pts/0'

## tmux
  - OK: escape-time: 0
  - INFO: Checking stuff
  - WARNING: focus-events is not enabled. 'autoread' may not work.
    - ADVICE:
      - (tmux 1.9+ only) Set focus-events in ~/.tmux.conf:
          set-option -g focus-events on
  - INFO: $TERM: tmux-256color
  - WARNING: Neither Tc nor RGB capability set. True colors are disabled. 'termguicolors' won't work properly.
    - ADVICE:
      - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
          set-option -sa terminal-overrides ',XXX:RGB'
      - For older tmux versions use this instead:
          set-option -ga terminal-overrides ',XXX:Tc'

provider: health#provider#check
========================================================================
## Clipboard (optional)      
  - OK: Clipboard tool found: tmux      

## Python 2 provider (optional)      
  - WARNING: No Python executable found that can import neovim. Using the first available executable for diagnostics.      
  - ERROR: Python provider error:      
    - ADVICE:      
      - provider/pythonx: Could not load Python 2:      
          python2 not found in search path or not executable.      
          python2.7 not found in search path or not executable.    
          python2.6 not found in search path or not executable.      
          /usr/bin/python is Python 3.10 and cannot provide Python 2.      
  - INFO: Executable: Not found      

## Python 3 provider (optional)      
  - INFO: g:python3_host_prog is not set.  Searching for python3 in the environment.      
  - INFO: Multiple python3 executables found.  Set g:python3_host_prog to avoid surprises.
  - INFO: Executable: /usr/bin/python3
  - INFO: Other python executable: /bin/python3
  - INFO: Python version: 3.10.4
  - INFO: pynvim version: 0.4.2 (outdated; from /usr/lib/python3/dist-packages/neovim)
  - WARNING: Latest pynvim is NOT installed: 0.4.3

## 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)
  - WARNING: node and npm (or yarn) must be in $PATH.
    - ADVICE:
      - Install Node.js and verify that node and npm (or yarn) commands work.

## Perl provider (optional)
  - ERROR: perl provider error:
    - ADVICE:
      - "Neovim::Ext" cpan module is not installed

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /home/dkaszews/.cache/nvim/lsp.log
  - INFO: Log size: 1 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 13


### Operating System

Linux Cuddles-Berry 5.15.0-1011-raspi #13-Ubuntu SMP PREEMPT Thu Jun 2 11:44:34 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

### Declaration

- [X] I have read and understood [CONTRIBUTING.md](https://github.com/puremourning/vimspector/blob/master/CONTRIBUTING.md#diagnostics)
- [X] I have read and understood the [CODE_OF_CONDUCT.md](https://github.com/puremourning/vimspector/blob/master/CODE_OF_CONDUCT.md)
puremourning commented 2 years ago

There's no way I'm going to make the tests work in neovim.

dkaszews commented 2 years ago

Why not? Even if passing all the tests is not realistic, the changes I listed are enough to pass most of them. The PR contribution guidelines already ask if you have tested your changes on vim and neovim, so not being able to run anything over such small issues is a bit weird. We can still treat testing on neovim as optional, but being able to write a new test for small change definitely improves developer experience.

I will create a PR to show the changes I needed for #639 tests to pass.

dkaszews commented 2 years ago

Added PR. Also, I understand your attitude that since you don't use NeoVim yourself, you don't have incentive to fix it. But that's what open source is for - just allow me to help where I can 🙂

puremourning commented 2 years ago

Apologies I didn't realise you were sending a PR. I read this as "Bug in Vimspector: tests don't work in neovim" which is not a bug, because they were never intended to! My position on neovim support is that if someone wants to contribute and maintain support, then I'm OPEN ARMS, but I have little time or impetus to do so myself - I simply have to draw the line somewhere - I maintain vimspector and YCM in very limited free time.

Regarding supporting neovim tests, then I would like the CI system to run them in a repeatable container (like the vim tests) and for them to all pass, or be skipped. I'll take a look at the PR, thanks!

dkaszews commented 2 years ago

It may be a culture issue - at my company every PR must be linked with an issue. Maybe I should have used the feature template but I thought bug is more appropriate as the feature already exists, just doesn't work on some configs.

I take it that if I don't need to discuss something beforehand, I can just create a PR and skip the issue?

puremourning commented 2 years ago

at my company every PR must be linked with an issue

sure it makes sense, and I thank you for doing it! I only saw the issue not the PR.

if you want to discuss changes, then you can reach me direct on matrix/gitter - usually easier to chat in my experience :)