michaelb / sniprun

A neovim plugin to run lines/blocs of code (independently of the rest of the file), supporting multiples languages
MIT License
1.43k stars 46 forks source link

SnipRun is not working on markdown .md files on MacOS #259

Closed jptechnical closed 10 months ago

jptechnical commented 10 months ago

Describe the bug SnipRun is not working on .md files on MacOS

To Reproduce

  1. Create test.md
  2. Populate with the following code
    
    # Test Python
    This is a code snippet
abc = "abc"
print(abc)
3. Run :SnipRun
4. Output is `Filetype not officially supported, nor configured for the Generic interpreter`

**Expected behavior**
If i create the same snippet of code in a .py file it works fine.

I have tried with this in my `set.lua`:

interpreter_options = { GFM_original = { use_on_filetypes = {"markdown", "md", "markdown.pandoc", "rstudio" } } }

as well as: 

interpreter_options = { GFM_original = { } }


**Screenshots**
![image](https://github.com/michaelb/sniprun/assets/12360898/eb43de9b-d3ac-4740-9b96-736ba7dcfb6b)

I also tried the healthcheck with no success.

SnipRun: health#SnipRun#check

Environment:

michaelb commented 10 months ago

run = 'sh ./install.sh'

On ARM macOS ???? (Not "sh ./install.sh 1" ??) I'm flabbergasted it even works

As for your actual issue, neovim usually associate a 'filetype' to files. filetype is not necessary taken from the file extension.

Can you run :set ft? to determine which is the filetype of your buffer ?

Alternatively, :set ft=markdown should make it one of the default filetype for the wanted sniprun interpreter.

It might be necessary to add the filetype (if it's a strange one and you don't want to change it) to the interpreter's options like you have already done (but is your 'set.lua' actually used ?)

If you're still lost, there should be a log file in. $XDG_CACHE_DIR ( ~/Library/Caches on macos?) /sniprun/sniprun.log

PS: it's :checkhealth sniprun not checkhealth SnipRun

jptechnical commented 10 months ago

I'll be damned,filetype=vimwiki. Once I disabled the plugin (I was going to anyway), it worked just fine.

btw, my original post was incorrect, my config is sh ./install.sh 1 since it requires compiling. I hope you can un-flabber that gast. ;-)

Thank you so much. If someone else comes along and has this issue, here are the parts of the vimwiki config that were set. Perhaps if this is reproducible that vimiwiki format can be added. It is really odd that it tookover the filetype of markdown.

tenor-194483789

-- vim.g.vimwiki_list = {
--   {
--     path = '~/techdocs/',
--     syntax = 'markdown',
--     ext  = '.md',
--   }
-- }
-- vim.g.vimwiki_ext2syntax = {
--   ['.md'] = 'markdown',
--   ['.markdown'] = 'markdown',
--   ['.mdown'] = 'markdown',
-- }
-- use {
--     'vimwiki/vimwiki',
--     config = function()
--       -- vim.g.vimwiki_list = {
--       --   {
--       --     path = '~/techdocs/',
--       --     syntax = 'markdown',
--       --     ext  = '.md',
--       --   }
--       -- }
--       -- vim.g.vimwiki_ext2syntax = {
--       --   ['.md'] = 'markdown',
--       --   ['.markdown'] = 'markdown',
--       --   ['.mdown'] = 'markdown',
--       -- }
--     end
--   }