scnvim icon indicating copy to clipboard operation
scnvim copied to clipboard

[BUG] Problems installing on Windows 10

Open jpdrecourt opened this issue 3 years ago • 14 comments

Describe the bug After installing scnvim, running :checkhealth scnvim outputs this:

scnvim: health#scnvim#check
========================================================================
  - ERROR: Failed to run healthcheck for "scnvim" plugin. Exception:
    function health#check[24]..health#scnvim#check[3]..<SNR>63_check_linkage, line 1
    Vim(let):E5108: Error executing lua ...-data\site\pack\packer\start\scnvim/lua/scnvim/utils.lua:107: [scnvim] could not find plugin root dir
    stack traceback:
    [C]: in function 'error'
    ...-data\site\pack\packer\start\scnvim/lua/scnvim/utils.lua:107: in function 'get_scnvim_root_dir'
    ...ata\site\pack\packer\start\scnvim/lua/scnvim/install.lua:12: in main chunk
    [C]: in function 'require'

Running the same command a second time leads a different result:

scnvim: health#scnvim#check
========================================================================
  - ERROR: Failed to run healthcheck for "scnvim" plugin. Exception:
    function health#check[24]..health#scnvim#check[3]..<SNR>69_check_linkage, line 1
    Vim(let):E5108: Error executing lua [string "luaeval()"]:1: loop or previous error loading module 'scnvim/install'
    stack traceback:
    [C]: in function 'require'
    [string "luaeval()"]:1: in main chunk

Despite this, I can run SCNvimStart on a .scd file and it starts sclang and reads the startup file (in which I’ve added the code snippet for Windows). But it doesn’t find scsynth.exe when I evaluate s.boot, which is in the same non-standard directory as sclang. Here's the output:

*** Welcome to SuperCollider 3.12.1. *** For help press F1.
ERROR: Class not defined.
  in interpreted text
  line 1 char 6:

  SCNvim.port = 60925 
        
-----------------------------------
ERROR: Class not defined.
  in interpreted text
  line 1 char 6:

  SCNvim.currentPath = "C:\\WINDOWS\\system32\\test.scd" 
        
-----------------------------------
-> localhost
Booting server 'localhost' on address 127.0.0.1:57110.
'scsynth.exe' is not recognized as an internal or external command,
operable program or batch file.
Server 'localhost' exited with exit code 1.

Expected behavior Startup of scsynth when evaluating s.boot.

Steps to reproduce

  • Load scnvim using Packer
  • Open an empty .scd file
  • Run SCNvimStart
  • Evaluate s.boot

Additional context

Information

  • Operating system Windows 10 64bits

  • SuperCollider version 3.12.1

  • nvim --version NVIM v0.6.0 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

  • Package manager packer.nvim >

jpdrecourt avatar Dec 17 '21 18:12 jpdrecourt

@jpdrecourt Hi! Thanks for the report.

Did you run the post-install hook scnvim#install() after installing the plugin with packer? You can run it manually after installing the plugin with :call scnvim#install() or use this declaration with packer

use { 'davidgranstrom/scnvim', run = ':call scnvim#install()' }

davidgranstrom avatar Dec 18 '21 10:12 davidgranstrom

To make sure, I uninstalled and reinstalled the plugin, and the install fails. checkhealth scnvim throws the second error message above. Despite that, after restarting nvim I can run :SCNvimStart with the same error messages as above. I've also tried to run SCNvimTags and I get the following error:

-----------------------------------
ERROR: Class not defined.
  in interpreted text
  line 1 char 6:

  SCNvim.generateAssets("C:\\Users\\jpdre\\AppData\\Local\\nvim-data\\site\\pack\\packer\\start\\scnvim", "ultisnips") 
        
-----------------------------------

jpdrecourt avatar Dec 18 '21 13:12 jpdrecourt

Hmm, looks like it could be a problem with the scnvim installer module then. I don't have access to a windows machine at the moment so debugging will be tricky. If you'd like I could provide you with instructions on where to look and what to test?

It is however possible to solve the issue on your end without any debugging involved. You need to create a symbolic link (or "soft" link) from the scide_scnvim directory of the scnvim plugin to your SuperCollider Extensions directory.

The extensions directory is usually found at: <HOME>\AppData\Local\SuperCollider\Extensions on windows. And the scnvim plugin should be at <HOME>\AppData\Local\nvim-data\site\pack\packer\start\scnvim. Hope that helps!

davidgranstrom avatar Dec 20 '21 09:12 davidgranstrom

Thanks, the fix works, I've got sound. For info, here's the command I issued to produce the link, from a Command Prompt with Admin privileges:

mklink /D "%HOMEPATH%\AppData\Local\SuperCollider\Extensions\scide_scnvim" "%HOMEPATH%\AppData\Local\nvim-data\site\pack\packer\start\scnvim\scide_scnvim"

I'm happy to help with the debugging if you have the time to guide me through it.

jpdrecourt avatar Dec 20 '21 15:12 jpdrecourt

@jpdrecourt Good to hear!

If you find the time, please post the output of this command. (You can run it on the neovim command line)

:lua print(vim.loop.os_uname().sysname)

davidgranstrom avatar Dec 20 '21 22:12 davidgranstrom

The output is Windows_NT.

jpdrecourt avatar Dec 21 '21 13:12 jpdrecourt

There is definitely a problem with paths. When I try to call a help file with vim.g.scnvim_scdoc = 1, I get a blank buffer and the following error message: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

With vim.g.scnvim_scdoc = 0, nothing happens, even if I point to my browser in vim.g.scnvim_scdoc_render_prg.

pandoc is installed and in my PATH environment variable.

jpdrecourt avatar Dec 22 '21 21:12 jpdrecourt

Sorry to hear that you're still experiencing problems. I'm not a Windows user myself so I really appreciate these reports since it would otherwise go unnoticed!

Could you post the relevant part of your scnvim config here? (Or link to it if you already have it on github or elsewhere)

And a follow up question, do you set the shellslash option in you init.vim?

Btw, a web browser is not a valid scnvim_scdoc_render_prg. It needs to be a command line tool that can convert HTML to plain text (such as pandoc). If you set g:scnvim_scdoc = 0 (the default) then the built-in (SuperCollider) HelpBrowser should be displayed.

davidgranstrom avatar Dec 23 '21 09:12 davidgranstrom

Hi David, thanks for following up and sorry for the slow reply.

Here are the relevant parts of my config. With this config, I can run Supercollider scripts, but I can't display the help with the built-in help browser. I've tried setting the shellslash option, but it creates all sorts of problems, in particular with Packer.

-- Packer
require('packer').startup(function()
  use 'wbthomason/packer.nvim'
  use {
    'nvim-treesitter/nvim-treesitter',
    run = ':TSUpdate'
  }
  use 'navarasu/onedark.nvim'
  use 'AndrewRadev/bufferize.vim'
  use { 'davidgranstrom/scnvim', run = ':call scnvim#install()' }
end)

-- Setup nvim-treesitter
require('nvim-treesitter.configs').setup {
  ensure_installed = "maintained",
  indent = {
    enable = {},
    disable = {"supercollider"}
  },
  highlight = {
    enable = true,              -- false will disable the whole extension
  }
}

-- Onedark theme
vim.g.onedark_style = 'darker'
vim.g.onedark_italic_comment = false
require('onedark').setup()

-- scnvim options
vim.g.scnvim_sclang_executable = 'D:\\Program Files\\SuperCollider-3.12.1\\sclang.exe'
vim.g.scnvim_postwin_syntax_hl = 1
-- scnvim neovim docs !
vim.g.scnvim_scdoc = 0
-- vertical 'v' or horizontal 'h' split
vim.g.scnvim_postwin_orientation = 'v'
-- position of the post window 'right' or 'left'
vim.g.scnvim_postwin_direction = 'right'
-- default is half the terminal size for vertical and a third for horizontal
--vim.g.scnvim_postwin_size = 50
-- automatically open post window on a SuperCollider error
vim.g.scnvim_postwin_auto_toggle = 1
--	-- duration of the highlight
vim.g.scnvim_eval_flash_duration = 100
-- number of flashes. A value of 0 disables this feature.
vim.g.scnvim_eval_flash_repeats = 2
-- Configure the color of the evaluation flash
vim.cmd([[ highlight SCNvimEval guifg=black guibg=white ctermfg=black ctermbg=white ]])

jpdrecourt avatar Jan 02 '22 14:01 jpdrecourt

Thanks! Your config looks alright to me.

Could you post the output of :echo exepath('pandoc')?

Also, you could try and set g:scnvim_scdoc_render_prg to the absolute path of your pandoc executable to see if that works. On my system it would be vim.g.scnvim_scdoc_render_prg = '/usr/local/bin/pandoc' for instance.

davidgranstrom avatar Jan 02 '22 15:01 davidgranstrom

:echo exepath('pandoc') returns the path of pandoc, no problem. But if I set:

vim.g.scnvim_scdoc = 1
vim.g.scnvim_scdoc_render_prg = 'C:\\Program Files\\Pandoc\\pandoc.exe'

Then I get this message again: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.`

Thank you for taking the time to help me David, but I think I'm not competent enough to help you debug this efficiently, as I'm a beginner in Nvim. I'll set this aside for now and maybe come back to it later. For now I'll stick the IDE.

jpdrecourt avatar Jan 02 '22 15:01 jpdrecourt

@jpdrecourt Thanks for testing! I'll let you know once I try this out on Windows to see if I can replicate this. I'll leave this issue open for now to see if anyone else has any input.

davidgranstrom avatar Jan 02 '22 16:01 davidgranstrom

Hey all, I submitted a pull request (#167) that hopefully will solve some of the Windows-specific issues here (bonus points if it didn't break anything on Linux). Please check it out and let me know if I need to fix anything to get it working for you.

One issue I have run into is that the Help browser gui doesn't open unless I send the :SCNvimRecompile command first. Not sure if this is specific to Windows, but I haven't been able to track down why this is happening yet.

sadguitarius avatar Mar 05 '22 07:03 sadguitarius

There is definitely a problem with paths. When I try to call a help file with vim.g.scnvim_scdoc = 1, I get a blank buffer and the following error message: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.

With vim.g.scnvim_scdoc = 0, nothing happens, even if I point to my browser in vim.g.scnvim_scdoc_render_prg.

You could try to troubleshoot this using Improper-Quotes-Monitor

ItsIgnacioPortal avatar Jun 04 '22 23:06 ItsIgnacioPortal