Allaman / nvim

Straightforward and pure Lua based Neovim configuration for my work as DevOps/Cloud Engineer with batteries included for Python, Golang, and, of course, YAML
MIT License
613 stars 69 forks source link

Issues on latest version #76

Closed partounian closed 6 months ago

partounian commented 6 months ago

Error running selene: ENOENT: no such file or directory when saving a .lua file.

And the following on neovim startup

Error detected while processing /Users/patrick.artounian/nvim/init.lua:
Failed to load `core.plugins.lualine`

vim/shared.lua:0: after the second argument: expected table, got nil

# stacktrace:
  - vim/shared.lua:0 _in_ **validate**
  - vim/shared.lua:0 _in_ **tbl_deep_extend**
  - ~/.config/nvim/lua/core/plugins/lualine.lua:84
  - ~/.config/nvim/lua/config/lazy.lua:20
  - ~/.config/nvim/lua/config/init.lua:32 _in_ **init**
  - ~/.config/nvim/lua/config/init.lua:37
  - init.lua:3
Allaman commented 6 months ago

Hi @partounian ,

thanks for reporting! Can you please check if this commit fixes this issue?

partounian commented 6 months ago

That fixes my lualine issues, but seems like some linters are still reporting ENOENT: no such file or directory when saving?

Allaman commented 6 months ago

Hmm, I never stumbled over this error. Is it still the case? Which filetype?

partounian commented 6 months ago

hadolint for docker files & the lua file linter

Allaman commented 6 months ago

I work witch Dockerfiles and, of course, Lua 😆

image

How do you know linters and not formatters are responsible?

partounian commented 6 months ago
Screenshot 2024-03-17 at 1 30 28 PM

When I open a dockerfile, I get this message on the bottom right.

which hadolint doesn't show a result. Seems like mason-lspconfig isn't properly installing packages for me, because I don't see it here. Screenshot of mason/bin & ~/.nvim_config.lua below.

Apologies if I'm being a bother. Since this seems specific to me, I'll close this.

Screenshot 2024-03-17 at 1 38 07 PM
-- see ./lua/core/config/defaults.lua for all
-- possible values and a short description
return {
  options = {
    -- grepprg = "rg --hidden --vimgrep --smart-case --", -- use rg instead of grep
    pumblend = 0, -- Popup blend
    -- foldenable = true,
    -- foldnestmax = 1,
    -- foldcolumn = "1", -- '0' is not bad
    -- foldlevel = 99, -- Using ufo provider need a large value, feel free to decrease the value
    -- foldlevelstart = -1,
    -- relativenumber = false, -- set relative numbered lines
  },
  plugins = {
    alpha = {
      -- disable_dashboard_header = true,
    },
    conform = {
      -- https://github.com/stevearc/conform.nvim
      enable = true,
      opts = {
        format_on_save = function()
          -- Disable with a global variable
          if vim.g.disable_autoformat then
            return
          end
          return { async = false, timeout_ms = 500, lsp_fallback = false }
        end,
        -- log_level = vim.log.levels.TRACE,
        formatters_by_ft = {
          go = { "goimports", "gofmt" },
          javascript = { "prettier" },
          json = { "prettier" },
          lua = { "stylua" },
          markdown = { "prettier" },
          python = { "isort", "ruff_format" },
          sh = { "shfmt" },
          terraform = { "terraform_fmt" },
          -- tex = { "latexindent" },
          typst = { "typstfmt" },
          yaml = { "yamlfmt" },
        },
      },
    },
    copilot = {
      enable = true,
    },
    lazy = {
      -- dev = {
      --   path = "~/workspace/github.com/allaman/",
      -- },
      disabled_neovim_plugins = {
        -- "gzip",
        "netrwPlugin",
        "tarPlugin",
        "tohtml",
        "tutor",
        "zipPlugin",
      },
    },
    nvim_lint = {
      enable = true,
      opts = {
        events = { "BufWritePost", "BufReadPost", "InsertLeave" },
        linters_by_ft = {
          dockerfile = { "hadolint" },
          javascript = { "eslint_d" },
          go = { "golangcilint" },
          lua = { "selene" },
          ruby = { "solargraph" },
          sh = { "shellcheck" },
          typescript = { "eslint_d" },
          yaml = { "yamllint" },
        },
      },
    },
    git = {
      -- which tool to use for handling git merge conflicts
      -- choose between "git-conflict" and "diffview" or "both"
      merge_conflict_tool = "git-conflict",
    },
    gopher = {
      -- https://github.com/olexsmir/gopher.nvim
      enable = true,
    },
    harpoon = {
      -- https://github.com/ThePrimeagen/harpoon
      enable = true,
    },
    indent_blankline = {
      enable = true,
      -- copied from https://github.com/Allaman/dots/blob/46d42f7a8b75cb18a6961225c2f43370c24b9e22/dot_nvim_config.lua.tmpl#L71C1-L74C7
      enable_scope = false,
    },
    lf = {
      -- https://github.com/lmburns/lf.nvim
      enable = false,
      replace_ntrw = 0,
      key_mappings = function()
        vim.keymap.set("n", "<leader>lf", "<cmd>lua require('lf').start()<cr>", { desc = "LF" })
      end,
    },
    ltex = {
      additional_lang = "", -- manually set a language in ltex-ls
    },
    lualine = {
      extensions = { "fugitive", "lazy", "neo-tree", "nvim-dap-ui", "quickfix", "symbols-outline", "toggleterm" },
    },
    overseer = {
      -- https://github.com/stevearc/overseer.nvim
      enable = true,
      key_mappings = function()
        vim.keymap.set("n", "<leader>r", "<cmd>OverseerRun<cr>", { desc = "Overseer Run" })
        vim.keymap.set("n", "<leader>tr", "<cmd>OverseerToggle<cr>", { desc = "Overseer" })
      end,
    },
    symbol_usage = {
      opts = {
        vt_position = "end_of_line",
      },
    },
    telescope = {
      fzf_native = {
        enable = true,
      },
      show_untracked_files = true,
    },
    trouble = {
      enable = true,
      opts = {
        auto_preview = false,
      },
    },
    zenmode = {
      enable = true,
    },
  },
  theme = {
    name = "catppuccin",
    catppuccin = {
      -- dark
      -- variant = "catppuccin-macchiato",
      -- darkest
      variant = "catppuccin-mocha",
      -- light
      -- variant = "catppuccin-latte",
      -- in between-ish
      -- variant = "catppuccin-frappe",
    },
  },

  -- treesitter parsers to be installed
  -- one of "all", "maintained" (parsers with maintainers), or a list of languages
  treesitter_ensure_installed = {
    "bash",
    "cmake",
    "css",
    "dockerfile",
    "go",
    "graphql",
    "hcl",
    "html",
    "javascript",
    "json",
    "jsonc",
    "lua",
    "markdown",
    "markdown_inline",
    "query",
    "python",
    "regex",
    "ruby",
    "sql",
    "toml",
    "tsx",
    "typescript",
    "vim",
    "yaml",
  },

  -- LSPs that should be installed by Mason-lspconfig
  lsp_servers = {
    "bashls",
    -- "cssls",
    "dockerls",
    "jsonls",
    "gopls",
    "marksman",
    "pyright",
    "lua_ls",
    "ruby_ls",
    "solargraph",
    "tailwindcss",
    "tsserver",
    "typst_lsp",
    "yamlls",
  },

  -- Tools that should be installed by Mason
  tools = {
    -- Formatter
    "isort",
    "prettier",
    "prettierd",
    "stylua",
    "shfmt",
    -- Linter
    "hadolint",
    "eslint_d",
    "shellcheck",
    "selene",
    "staticcheck",
    "yamllint",
    "ruff",
    -- DAP
    "debugpy",
    "codelldb",
    -- Go
    "gofumpt",
    "goimports",
    "gomodifytags",
    "golangci-lint",
    "gotests",
    "iferr",
    "impl",
  },
}
partounian commented 6 months ago

I guess I manually needed to run Mason in vim

Allaman commented 6 months ago

Hello @partounian ,

Apologies if I'm being a bother. Since this seems specific to me, I'll close this.

No worries :)

I guess I manually needed to run Mason in vim

IIRC, only LSPs are handled automatically. Tools are installed only when calling Mason. Honestly, I can't tell you by hard why this is the case and why I separated "lsps" and "tools" ... At some point, this logic needs a little refactoring 😆