#๐Ÿ”’ ruff-lsp in nvim

4 messages ยท Page 1 of 1 (latest)

coral scarab
#

Greetings, so I installed manim via uv. after some dust it seems to work. now I setup my LSP config within nvim which looks like this:

vim.lsp.config("ruff", {
  init_options = {
    settings = {
      -- Ruff language server settings go here
    },
  },
})

require("conform").setup({
  formatters_by_ft = {
    python = {
      -- To fix auto-fixable lint errors.
      "ruff_fix",
      -- To run the Ruff formatter.
      "ruff_format",
      -- To organize the imports.
      "ruff_organize_imports",
    },
  },
})

require("lint").linters_by_ft = {
  python = { "ruff" },
}

vim.api.nvim_create_autocmd("LspAttach", {
  group = vim.api.nvim_create_augroup("lsp_attach_disable_ruff_hover", { clear = true }),
  callback = function(args)
    local client = vim.lsp.get_client_by_id(args.data.client_id)
    if client == nil then
      return
    end
    if client.name == "ruff" then
      -- Disable hover in favor of Pyright
      client.server_capabilities.hoverProvider = false
    end
  end,
  desc = "LSP: Disable hover capability from Ruff",
})

vim.lsp.enable("ruff")

return {
  -- Manim oder so
}

the LspInfo says ruff and pyright is running. unfortunatly i get some errors from the LSP that manim wasnt imported, but if i run my minimalscript, it works as intended.

     โ”œโ•ด๏ฑ  `from manim import *` used; unable to detect undefined names Ruff (F403) [1, 1]
     โ”œโ•ด๏ฑ  `Scene` may be undefined, or defined from star imports Ruff (F405) [4, 20]
     โ”œโ•ด๏ฑ  `Circle` may be undefined, or defined from star imports Ruff (F405) [6, 18]
     โ”œโ•ด๏ฑ  `PINK` may be undefined, or defined from star imports Ruff (F405) [7, 25]
     โ””โ•ด๏ฑ  `Create` may be undefined, or defined from star imports Ruff (F405) [8, 19]

does anyone know how to import it directly? do i have to add the manim path in my config?

thanks in advance!

azure driftBOT
#

@coral scarab

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

azure driftBOT
#

@coral scarab

Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.