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
Im seeing inconsistent formatting for json files vs json codeblocks in markdown.
When editing a standard json file, I get things appropriately mapped with my editorconfig settings of
[*.json]
indent_style = space
indent_size = 4
[*.yaml]
indent_style = space
indent_size = 2
So everything when I run an lsp format is properly formatting with 4 spaces.
But if I bring the same exact json content into a markdown codeblock wrapped with a json type and I do an lsp format I get the same data but it is expanded with tabs, not spaces. This makes it awkward when I check in a file and it is viewed in Github preview, the tabs are then expanded out to 8 spaces and it looks awful.
yaml ironically works identically for formatting a native file or within a code block. That is the behavior I would expect for json as well.
Steps to Reproduce
Load a vanilla astrovim with the included community.lua file
utilize any small json file, and compare its formatting between a native file and the same content in a markdown json codeblock
Expected behavior
I would expect the same formatting (ie. spaces) that I see when editing a json file natively
Screenshots
No response
Additional Context
-- AstroCommunity: import any community modules here
-- We import this file in lazy_setup.lua before the plugins/ folder.
-- This guarantees that the specs are processed before any user plugins.
-- save as repro.lua-- run with nvim -u repro.lua-- DO NOT change the pathslocalroot=vim.fn.fnamemodify("./.repro", ":p")
-- set stdpaths to use .reprofor_, nameinipairs({ "config", "data", "state", "runtime", "cache" }) dovim.env[("XDG_%s_HOME"):format(name:upper())] =root.."/" ..nameend-- bootstrap lazylocallazypath=root.."/plugins/lazy.nvim"ifnotvim.loop.fs_stat(lazypath) then-- stylua: ignorevim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
endvim.opt.rtp:prepend(vim.env.LAZYorlazypath)
-- install pluginslocalplugins= {
{ "AstroNvim/AstroNvim", import="astronvim.plugins" },
{ "AstroNvim/astrocommunity" },
-- add any other plugins/customizations here
}
require("lazy").setup(plugins, {
root=root.."/plugins",
})
-- ONLY THING IS THE community.lua file I listed in additional context
The text was updated successfully, but these errors were encountered:
I dont think this can be attributed as a bug in the pack, or just a limitation to the upstream plugins that the pack is using. The Json lsp isnt running when editing a markdown file, so its seems like its either markdown-oxide, or perhaps treesitter(Dont see how but just leaving this here) thats formatting the buffer and the code blocks.
Checklist
repro.lua
provided belowNeovim version (nvim -v)
NVIM v0.10.2 Build type: Release LuaJIT 2.1.1727870382
Operating system/version
debian linux
Terminal/GUI
windows terminal
Describe the bug
Im seeing inconsistent formatting for json files vs json codeblocks in markdown.
When editing a standard json file, I get things appropriately mapped with my editorconfig settings of
So everything when I run an lsp format is properly formatting with 4 spaces.
But if I bring the same exact json content into a markdown codeblock wrapped with a json type and I do an lsp format I get the same data but it is expanded with tabs, not spaces. This makes it awkward when I check in a file and it is viewed in Github preview, the tabs are then expanded out to 8 spaces and it looks awful.
yaml ironically works identically for formatting a native file or within a code block. That is the behavior I would expect for json as well.
Steps to Reproduce
Load a vanilla astrovim with the included community.lua file
utilize any small json file, and compare its formatting between a native file and the same content in a markdown json codeblock
Expected behavior
I would expect the same formatting (ie. spaces) that I see when editing a json file natively
Screenshots
No response
Additional Context
-- AstroCommunity: import any community modules here
-- We import this file in
lazy_setup.lua
before theplugins/
folder.-- This guarantees that the specs are processed before any user plugins.
---@type LazySpec
return {
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.lua" },
{ import = "astrocommunity.pack.markdown" },
{ import = "astrocommunity.pack.json" },
{ import = "astrocommunity.pack.yaml" },
-- import/override with your plugins folder
}
Minimal configuration
The text was updated successfully, but these errors were encountered: