LuaLS / LuaLS/lua-language-server

Formatting is not working

Offen
#2,191 5 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Info Needed
Vorherrschende Sprache
Lua
Sterne
4.4k
Forks
442
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

How are you using the lua-language-server?

NeoVim

Which OS are you using?

Linux

What is the issue affecting?

Formatting

Expected Behaviour

The document gets formatted.

Actual Behaviour

I get [LSP] Format request failed, no matching language servers. logged. Formatters for other lsps are working. :LspInfo shows lua_ls is running.

Reproduction steps
  1. I installed lua-language-server 3.6.22 via nix
  2. Here is my lspconfig:
require'lspconfig'.lua_ls.setup{
    settings = {
    Lua = {
      runtime = {
        -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
        version = 'LuaJIT',
      },
      diagnostics = {
        -- Get the language server to recognize the `vim` global
        globals = {'vim'},
      },
      workspace = {
        -- Make the server aware of Neovim runtime files
        library = vim.api.nvim_get_runtime_file("", true),
      },
      -- Do not send telemetry data containing a randomized but unique identifier
      telemetry = {
        enable = false,
      },
      format = {
        enable = true,
        defaultConfig = {
          indent_style = "tab",
        },
      },
    },
  },
}
Additional Notes

:LspInfo:

 Press q or <Esc> to close this window. Press <Tab> to view server doc.
 
 Language client log: /home/marcel/.local/state/nvim/lsp.log
 Detected filetype:   lua
 
 0 client(s) attached to this buffer: 
 
 Other clients that match the filetype: lua
 
 Config: lua_ls
 	filetypes:         lua
 	root directory:    /home/marcel/.dotfiles
 	cmd:               /nix/var/nix/profiles/default/bin/lua-language-server
 	cmd is executable: true
 	autostart:         true
 	custom handlers:   
 
 Configured servers list: phpactor, tsserver, lua_ls, ccls, elmls, rust_analyzer, pyright, vuels, texlab
Log File
[START][2023-02-22 23:00:05] LSP logging initiated
[INFO][2023-02-22 23:01:41] .../lua/vim/lsp.lua:1392    "exit_handler"  {}
[START][2023-02-22 23:01:42] LSP logging initiated
[START][2023-02-22 23:03:42] LSP logging initiated
[START][2023-02-22 23:04:00] LSP logging initiated
[START][2023-02-22 23:05:11] LSP logging initiated
[START][2023-02-22 23:06:26] LSP logging initiated

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, den Fehler in NeoVim mit der gezeigten lspconfig.lua_ls.setup-Konfiguration zu reproduzieren, und untersuche anschließend :LspInfo sowie die referenzierte Datei /home/marcel/.local/state/nvim/lsp.log. Erledigt ist die Aufgabe, wenn ein Lua-Puffer an lua_ls angehängt wird und eine Formatierungsanfrage ohne den Fehler „no matching language servers“ erfolgreich ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
lua, neovim
Bereich
developer-experience, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.