Skip to content

Commit

Permalink
chore: improve health check and bug report templ (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas authored Dec 21, 2023
1 parent 427ecea commit b829b93
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 4 deletions.
27 changes: 26 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,31 @@ labels: bug
assignees: ''
---

_make sure to do the following:_
_read the README_
_check existing issues (the `config problem` tag is helpful)_
_try with the latest version of molten and image.nvim, latest releases and then main/master branches_
_run `:UpdateRemotePlugins`_

- OS:
- NeoVim Version:
- Python Version:
- Python is installed with:
- Health checks

<details>
<summary>`:checkhealth molten`</summary>

_text or screenshot_

</details>

<details>
<summary>`:checkhealth provider` (the python parts)</summary>

_text or screenshot_

</details>

## Description
_A clear and concise description of what the bug is._
Expand All @@ -17,6 +40,8 @@ _Screenshots can help explain the problem as well_
_Steps to reproduce the behavior._
_ie. open this file, run this code and wait for the output window to open, then do x_

_Optionally you can include a minimal config to reproduce the issue. This will help me figure things out much more quickly. You can find a sample minimal config [here](https://github.com/benlubas/molten-nvim/blob/main/docs/minimal.lua). If you include one, please also include the output of `pip freeze` from the python3 host program that you specify in the config._

## Expected Behavior
A clear and concise description of what you expected to happen.
_A clear and concise description of what you expected to happen._

99 changes: 99 additions & 0 deletions docs/minimal.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
-- Example for configuring Neovim to load user-installed installed Lua rocks:
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?/init.lua"
package.path = package.path .. ";" .. vim.fn.expand("$HOME") .. "/.luarocks/share/lua/5.1/?.lua"

-- You should specify your python3 path here \/.
vim.g.python3_host_prog = vim.fn.expand("$HOME") .. "/.virtualenvs/neovim/bin/python3"

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
{
"bluz71/vim-moonfly-colors",
lazy = false,
priority = 1000,
config = function()
vim.cmd.syntax("enable")
vim.cmd.colorscheme("moonfly")

vim.api.nvim_set_hl(0, "MoltenOutputBorder", { link = "Normal" })
vim.api.nvim_set_hl(0, "MoltenOutputBorderFail", { link = "MoonflyCrimson" })
vim.api.nvim_set_hl(0, "MoltenOutputBorderSuccess", { link = "MoonflyBlue" })
end,
},
{
"benlubas/molten-nvim",
dependencies = { "3rd/image.nvim" },
build = ":UpdateRemotePlugins",
init = function()
vim.g.molten_image_provider = "image.nvim"
vim.g.molten_use_border_highlights = true
-- add a few new things

-- don't change the mappings (unless it's related to your bug)
vim.keymap.set("n", "<localleader>mi", ":MoltenInit<CR>")
vim.keymap.set("n", "<localleader>e", ":MoltenEvaluateOperator<CR>")
vim.keymap.set("n", "<localleader>rr", ":MoltenReevaluateCell<CR>")
vim.keymap.set("v", "<localleader>r", ":<C-u>MoltenEvaluateVisual<CR>gv")
vim.keymap.set("n", "<localleader>os", ":noautocmd MoltenEnterOutput<CR>")
vim.keymap.set("n", "<localleader>oh", ":MoltenHideOutput<CR>")
vim.keymap.set("n", "<localleader>md", ":MoltenDelete<CR>")
end,
},
{
"3rd/image.nvim",
opts = {
backend = "kitty",
integrations = {},
max_width = 100,
max_height = 12,
max_height_window_percentage = math.huge,
max_width_window_percentage = math.huge,
window_overlap_clear_enabled = true,
window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs", "" },
},
version = "1.1.0", -- or comment out for latest
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"markdown",
"markdown_inline",
"python",
},
highlight = {
enable = true,
additional_vim_regex_highlighing = false,
},
})
end,
},
-- add any additional plugins here
}

require("lazy").setup(plugins, {
root = root .. "/plugins",
})
7 changes: 4 additions & 3 deletions lua/molten/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ end

local py_mod_check = function(mod, pip, required)
if has_py_mod(mod) then
vim.health.ok("Python package " .. pip .. " found")
vim.health.ok("Python module " .. pip .. " found")
elseif required then
vim.health.error("Python package " .. pip .. " not found", "pip install " .. pip)
vim.health.error("Required python module " .. pip .. " not found", "pip install " .. pip)
else
vim.health.warn("Python package " .. pip .. " not found", "pip install " .. pip)
vim.health.warn("Optional python module " .. pip .. " not found", "pip install " .. pip)
end
end

Expand Down Expand Up @@ -44,6 +44,7 @@ M.check = function()
py_mod_check("plotly", "plotly", false)
py_mod_check("kaleido", "kaleido", false)
py_mod_check("pyperclip", "pyperclip", false)
py_mod_check("nbformat", "nbformat", false)
end

return M

0 comments on commit b829b93

Please sign in to comment.