issue template

This commit is contained in:
Barrett Ruth 2023-01-07 20:46:16 -06:00
parent 894692f380
commit 46df6ae7e6
2 changed files with 60 additions and 18 deletions

46
.github/ISSUE_TEMPLATE/bug-report.md vendored Normal file
View file

@ -0,0 +1,46 @@
---
name: Bug Report
about: File a bug with live-server.nvim
title: "Bug Report"
labels: ""
assignees: ""
---
<!-- Be sure you can affirm the following: -->
<!-- 1. live-server is up to date and functioning correctly (run `live-server` in the terminal) -->
<!-- 2. I have searched the issue tracker and not found a similar issue -->
### Info
- Operating System:
- `nvim --version`:
- Node package manager:
- `<node-package-manager> --version`:
- `live-server --version`:
### Configuration
<!-- Replace the below with your live-server.nvim setup -->
```lua
require('live-server').setup {
}
```
<!-- Replace the below with your *neovim* package manager setup -->
```lua
require('nvim-package-manager').setup {
-- Any special plugin config
{
'barrett-ruth/live-server.nvim',
}
}
```
</details>
### Description
<!-- A clear and concise description of the bug -->

View file

@ -1,8 +1,8 @@
local M = {}
local function log(message, level)
vim.notify_once(
string.format('import-cost.nvim: %s', message),
vim.notify(
string.format('live-server.nvim: %s', message),
vim.log.levels[level]
)
end
@ -30,50 +30,46 @@ end
local job_cache = {}
M.start = function()
local bufnr = vim.api.nvim_get_current_buf()
local dir = vim.fn.expand '%:p:h'
local cmd = { 'live-server' }
vim.list_extend(cmd, M.config.args)
if job_cache[bufnr] then
if job_cache[dir] then
log('live-server instance already running', 'INFO')
return
end
local job_id = vim.fn.jobstart(cmd, {
on_stderr = function(_, data)
if data[1] == '' then
if not data or data[1] == '' then
return
end
-- Remove color from error
log(data[1]:match '.-m(.-)\27', 'ERROR')
end,
on_exit = function(_, exit_code)
job_cache[bufnr] = nil
job_cache[dir] = nil
if exit_code == 0 then
return
end
log(
string.format(
'live-server stopped unexpectedly with exit code %s',
exit_code
),
'ERROR'
)
log(string.format('stopped with code %s', exit_code), 'INFO')
end,
})
job_cache[bufnr] = job_id
log('live-server running', 'INFO')
job_cache[dir] = job_id
end
M.stop = function()
local bufnr = vim.api.nvim_get_current_buf()
local dir = vim.fn.expand '%:p:h'
if job_cache[bufnr] then
vim.fn.jobstop(job_cache[bufnr])
job_cache[bufnr] = nil
if job_cache[dir] then
vim.fn.jobstop(job_cache[dir])
job_cache[dir] = nil
else
log('no live-server instance running', 'INFO')
end