ci: format
This commit is contained in:
parent
e49a664d48
commit
b905ed04ed
4 changed files with 14 additions and 20 deletions
|
|
@ -3,15 +3,15 @@
|
|||
Async document compilation for Neovim.
|
||||
|
||||
A framework for compiling documents (LaTeX, Typst, Markdown, etc.)
|
||||
asynchronously with error diagnostics. Ships with zero defaults — you
|
||||
configure your own providers.
|
||||
asynchronously with error diagnostics. Ships with zero defaults — you configure
|
||||
your own providers.
|
||||
|
||||
## Features
|
||||
|
||||
- Async compilation via `vim.system()`
|
||||
- Compiler errors as native `vim.diagnostic`
|
||||
- User events for extensibility (`RenderCompileStarted`,
|
||||
`RenderCompileSuccess`, `RenderCompileFailed`)
|
||||
- User events for extensibility (`RenderCompileStarted`, `RenderCompileSuccess`,
|
||||
`RenderCompileFailed`)
|
||||
- `:checkhealth` integration
|
||||
- Zero dependencies beyond Neovim 0.10.0+
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
std = 'vim'
|
||||
exclude = ['.direnv', 'result', 'result-*', 'node_modules']
|
||||
exclude = ['.direnv/*', 'result/*', 'node_modules/*']
|
||||
|
||||
[lints]
|
||||
bad_string_escape = 'allow'
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ function M.delete_buffer(bufnr)
|
|||
end
|
||||
end
|
||||
|
||||
function M.reset_config()
|
||||
vim.g.render = nil
|
||||
function M.reset_config(opts)
|
||||
vim.g.render = opts
|
||||
require('render')._test.reset()
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -10,14 +10,12 @@ describe('render', function()
|
|||
|
||||
describe('config', function()
|
||||
it('accepts nil config', function()
|
||||
vim.g.render = nil
|
||||
assert.has_no.errors(function()
|
||||
render.get_config()
|
||||
end)
|
||||
end)
|
||||
|
||||
it('applies default values', function()
|
||||
vim.g.render = nil
|
||||
local config = render.get_config()
|
||||
assert.is_false(config.debug)
|
||||
assert.are.same({}, config.providers)
|
||||
|
|
@ -25,15 +23,14 @@ describe('render', function()
|
|||
end)
|
||||
|
||||
it('merges user config with defaults', function()
|
||||
vim.g.render = { debug = true }
|
||||
helpers.reset_config()
|
||||
helpers.reset_config({ debug = true })
|
||||
local config = require('render').get_config()
|
||||
assert.is_true(config.debug)
|
||||
assert.are.same({}, config.providers)
|
||||
end)
|
||||
|
||||
it('accepts full provider config', function()
|
||||
vim.g.render = {
|
||||
helpers.reset_config({
|
||||
providers = {
|
||||
typst = {
|
||||
cmd = { 'typst', 'compile' },
|
||||
|
|
@ -43,8 +40,7 @@ describe('render', function()
|
|||
providers_by_ft = {
|
||||
typst = 'typst',
|
||||
},
|
||||
}
|
||||
helpers.reset_config()
|
||||
})
|
||||
local config = require('render').get_config()
|
||||
assert.is_not_nil(config.providers.typst)
|
||||
assert.are.equal('typst', config.providers_by_ft.typst)
|
||||
|
|
@ -53,15 +49,14 @@ describe('render', function()
|
|||
|
||||
describe('resolve_provider', function()
|
||||
before_each(function()
|
||||
vim.g.render = {
|
||||
helpers.reset_config({
|
||||
providers = {
|
||||
typst = { cmd = { 'typst', 'compile' } },
|
||||
},
|
||||
providers_by_ft = {
|
||||
typst = 'typst',
|
||||
},
|
||||
}
|
||||
helpers.reset_config()
|
||||
})
|
||||
render = require('render')
|
||||
end)
|
||||
|
||||
|
|
@ -80,11 +75,10 @@ describe('render', function()
|
|||
end)
|
||||
|
||||
it('returns nil when provider name maps to missing config', function()
|
||||
vim.g.render = {
|
||||
helpers.reset_config({
|
||||
providers = {},
|
||||
providers_by_ft = { typst = 'typst' },
|
||||
}
|
||||
helpers.reset_config()
|
||||
})
|
||||
local bufnr = helpers.create_buffer({}, 'typst')
|
||||
local name = require('render').resolve_provider(bufnr)
|
||||
assert.is_nil(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue