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