You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
10:25:45[ERROR] Formatter 'prettierd' error:
10:25:45[ERROR] Formatter 'prettierd' error:
10:25:57[ERROR] Formatter 'prettierd' error:
10:25:57[ERROR] Formatter 'prettierd' error:
10:26:16[ERROR] Formatter 'prettierd' error:
10:26:16[ERROR] Formatter 'prettierd' error:
10:38:30[DEBUG] Running formatters on /home/rileyb/Documents/Homework/118cs-hw/6/md.md: { "prettierd", "injected" }
10:38:30[INFO] Run prettierd on /home/rileyb/Documents/Homework/118cs-hw/6/md.md
10:38:30[DEBUG] Run command: { "prettierd", "/home/rileyb/Documents/Homework/118cs-hw/6/md.md" }
10:38:30[DEBUG] prettierd exited with code 0
10:38:30[INFO] Run injected on /home/rileyb/Documents/Homework/118cs-hw/6/md.md
10:38:30[DEBUG] Injected format html:3:24: { "prettierd" }
10:38:30[INFO] Run prettierd on /home/rileyb/Documents/Homework/118cs-hw/6/md.md.html
10:38:30[DEBUG] Run command: { "prettierd", "/home/rileyb/Documents/Homework/118cs-hw/6/md.md.html" }
10:38:30[DEBUG] prettierd exited with code 0
Formatters for this buffer:
prettierd ready (markdown, html, css)
injected ready (markdown)
Other formatters:
clang_format ready (cpp, c)
deno_fmt ready (javascript, typescript, javascriptreact, typescriptreact, json, jsonc)
stylua ready (luau, lua)
Describe the bug
Basically, Markdown comments are treated like HTML injections by the Tree-sitter parser and I believe this causes some issues with the formatter now. This has only started since e2b889e. At least with prettierd as an HTML formatter, the Markdown comments will cause paragraphs above them to be joined on the same line with the paragraphs above them (example shown below).
Steps To Reproduce
nvim -u repro.lua example.md
:lua require('conform').format()
Expected Behavior
Expected file formatting:
# Homework 6<!-- vim: set spell: -->## Problem 1> Quote here<!-- Beginning of first paragraph -->
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet.
Volutpat diam ut venenatis tellus in. Egestas sed sed risus pretium quam
vulputate dignissim suspendisse. Sapien pellentesque habitant morbi tristique
senectus et netus et malesuada. Eu feugiat pretium nibh ipsum. Convallis aenean
et tortor at risus viverra. Libero volutpat sed cras ornare arcu. Pharetra vel
turpis nunc eget lorem dolor sed viverra. Lacus laoreet non curabitur gravida
arcu ac tortor dignissim. Ut eu sem integer vitae justo eget magna fermentum.
Leo duis ut diam quam nulla porttitor massa id. Purus sit amet volutpat
consequat mauris nunc congue. Eget lorem dolor sed viverra ipsum nunc aliquet
bibendum. Cursus risus at ultrices mi.
- Bullet here
<!-- End of data -->
Actual formatting:
# Homework 6<!-- vim: set spell: -->## Problem 1 > Quote here<!-- Beginning of first paragraph -->
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet.
Volutpat diam ut venenatis tellus in. Egestas sed sed risus pretium quam
vulputate dignissim suspendisse. Sapien pellentesque habitant morbi tristique
senectus et netus et malesuada. Eu feugiat pretium nibh ipsum. Convallis aenean
et tortor at risus viverra. Libero volutpat sed cras ornare arcu. Pharetra vel
turpis nunc eget lorem dolor sed viverra. Lacus laoreet non curabitur gravida
arcu ac tortor dignissim. Ut eu sem integer vitae justo eget magna fermentum.
Leo duis ut diam quam nulla porttitor massa id. Purus sit amet volutpat
consequat mauris nunc congue. Eget lorem dolor sed viverra ipsum nunc aliquet
bibendum. Cursus risus at ultrices mi. - Bullet here
<!-- End of data -->
Minimal example file
example.md
# Homework 6<!-- vim: set spell: -->## Problem 1> Quote here<!-- Beginning of first paragraph -->
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Aliquet nec ullamcorper sit amet.
Volutpat diam ut venenatis tellus in. Egestas sed sed risus pretium quam
vulputate dignissim suspendisse. Sapien pellentesque habitant morbi tristique
senectus et netus et malesuada. Eu feugiat pretium nibh ipsum. Convallis aenean
et tortor at risus viverra. Libero volutpat sed cras ornare arcu. Pharetra vel
turpis nunc eget lorem dolor sed viverra. Lacus laoreet non curabitur gravida
arcu ac tortor dignissim. Ut eu sem integer vitae justo eget magna fermentum.
Leo duis ut diam quam nulla porttitor massa id. Purus sit amet volutpat
consequat mauris nunc congue. Eget lorem dolor sed viverra ipsum nunc aliquet
bibendum. Cursus risus at ultrices mi.
- Bullet here
<!-- End of data -->
Minimal init.lua
-- DO NOT change the paths and don't remove the colorschemelocalroot=vim.fn.fnamemodify('./.repro', ':p')
-- set stdpaths to use .reprofor_, nameinipairs { 'config', 'data', 'state', 'cache' } dovim.env[('XDG_%s_HOME'):format(name:upper())] =root..'/' ..nameend-- bootstrap lazylocallazypath=root..'/plugins/lazy.nvim'ifnotvim.loop.fs_stat(lazypath) thenvim.fn.system {
'git',
'clone',
'--filter=blob:none',
'--single-branch',
'https://github.com/folke/lazy.nvim.git',
lazypath,
}
endvim.opt.runtimepath:prepend(lazypath)
-- install pluginslocalplugins= {
{
'nvim-treesitter/nvim-treesitter',
build=':TSUpdate',
event= { 'BufReadPost', 'BufNewFile' },
config=function()
require('nvim-treesitter.configs').setup {
ensure_installed= {
'markdown',
'html',
'comment',
},
highlight= {
enable=true,
},
}
end,
},
'folke/tokyonight.nvim',
{
'stevearc/conform.nvim',
config=function()
require('conform').setup {
log_level=vim.log.levels.DEBUG,
-- add your config hereformatters_by_ft= {
html= { 'prettierd' },
markdown= { 'prettierd', 'injected' },
},
}
end,
},
-- add any other plugins here
}
require('lazy').setup(plugins, {
root=root..'/plugins',
})
vim.cmd.colorscheme('tokyonight')
-- add anything else here
Additional context
This only occurs when the injected formatter is also used with a Markdown file, and a formatter is used for HTML files (I have only tested with prettierd). I have observed this issue with prettierd as well as deno_fmt as a Markdown formatter.
The text was updated successfully, but these errors were encountered:
Neovim version (nvim -v)
NVIM v0.9.4 Build type: Release LuaJIT 2.1.1699392533
Operating system/version
Arch Linux 6.6.1-arch1-1
Add the debug logs
log_level = vim.log.levels.DEBUG
and pasted the log contents below.Log file
Log file: /home/rileyb/.local/state/nvim/conform.log
~
Formatters for this buffer:
prettierd ready (markdown, html, css)
injected ready (markdown)
Other formatters:
clang_format ready (cpp, c)
deno_fmt ready (javascript, typescript, javascriptreact, typescriptreact, json, jsonc)
stylua ready (luau, lua)
Describe the bug
Basically, Markdown comments are treated like HTML injections by the Tree-sitter parser and I believe this causes some issues with the formatter now. This has only started since e2b889e. At least with
prettierd
as an HTML formatter, the Markdown comments will cause paragraphs above them to be joined on the same line with the paragraphs above them (example shown below).Steps To Reproduce
nvim -u repro.lua example.md
:lua require('conform').format()
Expected Behavior
Expected file formatting:
Actual formatting:
Minimal example file
example.md
Minimal init.lua
Additional context
This only occurs when the
injected
formatter is also used with a Markdown file, and a formatter is used for HTML files (I have only tested withprettierd
). I have observed this issue withprettierd
as well asdeno_fmt
as a Markdown formatter.The text was updated successfully, but these errors were encountered: