Skip to content

Commit

Permalink
Add more debugging info
Browse files Browse the repository at this point in the history
  • Loading branch information
epwalsh committed Feb 18, 2024
1 parent e8c9f09 commit 8635361
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
20 changes: 14 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,34 @@ body:
error("Oh no!")
```
If the code is too long (hopefully, it isn't), feel free to put it in a public gist and link it in the issue: https://gist.github.com.
Please also paste or describe the results you observe instead of the expected results. If you observe an error, please paste the error message including the **full** traceback of the exception. It may be relevant to wrap error messages in ```` ```triple quotes blocks``` ````.
Please also paste or describe the results you observe instead of the expected results. If you observe an error, please paste the error message including the **full** traceback of the exception. It may be relevant to wrap error messages in ```` ```triple quotes``` ````.
placeholder: |
A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Versions
label: Config
description: |
Please paste your obsidian.nvim config below, wrapped in ```` ```triple quotes``` ````.
placeholder: |
Your config wrapped in a triple quotes block...
validations:
required: true
- type: textarea
attributes:
label: Environment
description: |
Please run the following and paste the output below.
Please run the following and paste the output below, wrapped in ```` ```triple quotes``` ````.
```sh
nvim --version
nvim --headless -c 'lua require("obsidian").info()' -c q
```
Note that you'll have to ensure obsidian.nvim loads up front for that command to be able to gather all of the information it needs, which means ensuring your plugin manager does not load obsidian.nvim lazily.
Alternatively, if you use [lazy.nvim](https://github.com/folke/lazy.nvim) as your plugin manager you can simply include your `lazy-lock.json` file.
placeholder: |
Output wrapped in a triple quotes block...
validations:
required: true
- type: markdown
Expand Down
5 changes: 4 additions & 1 deletion lua/obsidian/commands/debug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ local log = require "obsidian.log"

---@param client obsidian.Client
return function(client)
log.lazy_info("Current buffer directory: '%s'", client.buf_dir)
log.lazy_info "Status:"
log.lazy_info(" Buffer directory: '%s'", client.buf_dir)
log.lazy_info(" Working directory: '%s'", vim.fn.getcwd())

log.lazy_info "Workspaces:"
local cur_workspace = Workspace.get_workspace_for_dir(client.buf_dir, client.opts.workspaces)
if cur_workspace ~= nil then
Expand Down
15 changes: 11 additions & 4 deletions lua/obsidian/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ obsidian.info = function()

local info = obsidian.util.get_plugin_info()
if info ~= nil then
print("[obsidian.nvim (v" .. obsidian.VERSION .. ")] " .. info)
print "Plugins:"
print(" [obsidian.nvim (v" .. obsidian.VERSION .. ")] " .. info)
else
print(
"ERROR: could not find path to obsidian.nvim installation.\n"
Expand All @@ -68,19 +69,25 @@ obsidian.info = function()
return
end

for plugin in iter { "plenary.nvim", "nvim-cmp", "telescope.nvim", "fzf-lua", "fzf.vim", "mini.pick", "vim-markdown" } do
for plugin in iter { "plenary.nvim", "nvim-cmp", "telescope.nvim", "fzf-lua", "mini.pick" } do
local plugin_info = obsidian.util.get_plugin_info(plugin)
if plugin_info ~= nil then
print("[" .. plugin .. "] " .. plugin_info)
print(" [" .. plugin .. "] " .. plugin_info)
end
end

print "Tools:"
for cmd in iter { "rg" } do
local cmd_info = obsidian.util.get_external_dependency_info(cmd)
if cmd_info ~= nil then
print(cmd_info)
print(" [" .. cmd .. "] " .. cmd_info)
else
print(" [" .. cmd .. "] " .. "not found")
end
end

print "Environment:"
print(" [OS] " .. obsidian.util.get_os())
end

---Create a new Obsidian client without additional setup.
Expand Down

0 comments on commit 8635361

Please sign in to comment.