nvim taplo toml format error

# nvim(lazyvim)에 .air.toml 처럼 air 이름의 toml 파일을 열면 다음과 같은 diagnostics 에러가 발생한다.
additional properties are not allowed

# 다른 이름의 toml 파일은 문제가 없다.
# lazyvim 에서 기본적으로 toml 파일에 대해 lsp(Language Server Protocol), lint, format 을 위해 taplo(https://github.com/tamasfe/taplo, even better toml) 툴을 설치해 사용한다.
{ import = "lazyvim.plugins.extras.lang.toml" },

# toml 파일을 열면 taplo lsp 프로세스가 생성되어 처리한다.
hwatch -n 1 "ps -ef | rg -i taplo"
/Users/ysoftman/.local/share/nvim/mason/bin/taplo lsp stdio --log-spans

# lsp 사용 정보
:LspInfo

# 해결방법
# nvim-lspconfig > schema 를 비활성화
return {
  {
    "neovim/nvim-lspconfig",
    -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
    opts = {
      servers = {
        taplo = {
          enabled = true,
          settings = {
            evenBetterToml = {
              -- .air.toml 에서 diagnostics 에러가 발생해 비활성화
              schema = { enabled = false },
              formatter = {
                indentString = "  ",
              },
            },
          },
        },
...

# 참고
# toml 파일들 일괄 포멧팅
fd .toml | ~/.local/share/nvim/mason/bin/taplo format --log-spans

# toml 내용 stdin 입력 포맷팅
cat typos.toml | ~/.local/share/nvim/mason/bin/taplo format -

comments:

댓글 쓰기