efm-langserver icon indicating copy to clipboard operation
efm-langserver copied to clipboard

format for LanguageID not supported: yaml

Open horseinthesky opened this issue 4 years ago • 1 comments

Here is my efm.lua:

local M = {}

M.luafmt = {
  formatCommand = "luafmt -i 2 --stdin",
  formatStdin = true
}

M.flake8 = {
  lintCommand = "flake8 --ignore=E501 --stdin-display-name ${INPUT} -",
  lintStdin = true,
  lintIgnoreExitCode = true,
  lintFormats = {"%f:%l:%c: %m"}
}

M.isort = {
  formatCommand = "isort -",
  formatStdin = true
}

M.autopep8 = {
  formatCommand = "autopep8 --ignore E501 -",
  formatStdin = true
}

M.yapf = {
  formatCommand = "yapf",
  formatStdin = true
}

M.black = {
  formatCommand = "black --quiet -",
  formatStdin = true
}

M.mypy = {
  lintCommand = "mypy --show-column-numbers --ignore-missing-imports",
  lintFormats = {"%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m"}
}

M.prettier = {
  formatCommand = "prettier --stdin-filepath ${INPUT}",
  formatStdin = true
}

return M

And hehe is lsp config:

local efm = require "efm"
local flake8 = efm.flake8
local isort = efm.isort
local black = efm.black
local mypy = efm.mypy
local luafmt = efm.luafmt
local prettier = efm.prettier

local languages = {
  python = {isort, flake8, black, mypy},
  lua = {luafmt},
  yaml = {prettier},
  json = {prettier},
  html = {prettier},
  css = {prettier},
  markdown = {prettier}
}

When I try to run lua vim.lsp.buf.formatting() on the file bla.yml:

bla:
  a: 1
    b: 2
    c: 3

I get RPC[Error] code_name = unknown, code = 0, message = "format for LanguageID not supported: yaml" message.

The same prettier formatter works great for JSON.

horseinthesky avatar Jun 17 '21 16:06 horseinthesky

~~I'm having exactly the same issue.~~ Update: Seems I had installed efm-langserver via Homebrew and then again via lspinstall plugin. Removing the Homebrew install and restarting cleared the issue for me.

zeitchef avatar Jun 30 '21 09:06 zeitchef

try installing pritterd or stylua manully with Mason and config accordingly say in lspsaga.nvim.

gmhpfc avatar Nov 08 '23 15:11 gmhpfc

Not relevant anymore. Disregard.

horseinthesky avatar Nov 08 '23 18:11 horseinthesky