LunarVim / LunarVim

🌙 LunarVim is an IDE layer for Neovim. Completely free and community driven.
https://www.lunarvim.org
GNU General Public License v3.0
18.36k stars 1.51k forks source link

Ruby LSPs can't decide on single or double quoted strings #4189

Closed dseravalli closed 1 year ago

dseravalli commented 1 year ago

Problem description

I get a message about both single and double quoted strings being wrong. See screenshot.

LunarVim version

release-1.3/neovim-0.9-0aea5a68

Neovim version (>= 0.9.0)

NVIM v0.9.0

Operating system/version

macOS 13.3.1

Affected language servers

standardrb, solargraph

Steps to reproduce

  1. Open a simple ruby file with both double and single quoted strings:
# frozen_string_literal: true

test = 'hello world'
test2 = "hello world"
print(test)
print(test2)

My config:

--[[
 THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
 `lvim` is the global options object
]]
-- vim options
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.relativenumber = true

vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufReadPost' }, {
  pattern = { '.env.*' },
  command = 'set filetype=sh'
})

-- general
lvim.log.level = "info"

lvim.format_on_save = {
  enabled = true,
  pattern = { "*.lua", "*.go" },
  timeout = 1000,
}
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false

-- keymappings <https://www.lunarvim.org/docs/configuration/keybindings>
lvim.leader = "space"
-- add your own keymapping
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"

-- -- Change theme settings
-- lvim.colorscheme = "lunar"

lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false

-- Automatically install missing parsers when entering buffer
lvim.builtin.treesitter.auto_install = true

-- lvim.builtin.treesitter.ignore_install = { "haskell" }

-- -- always installed on startup, useful for parsers without a strict filetype
lvim.builtin.treesitter.ensure_installed = {
  "comment",
  "markdown_inline",
  "regex",
  "bash",
  "javascript",
  "json",
  "lua",
  "python",
  "typescript",
  "tsx",
  "css",
  "yaml",
  "gomod",
  "go",
  "hcl",
  "markdown"
}

-- -- linters, formatters and code actions <https://www.lunarvim.org/docs/languages#lintingformatting>
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
  { command = "goimports", filetypes = { "go" } },
  { command = "gofumpt",   filetypes = { "go" } },
  {
    command = "prettier",
    extra_args = { "--print-width", "100" },
    filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
  },
}

local code_actions = require "lvim.lsp.null-ls.code_actions"
code_actions.setup {
  {
    exe = "eslint",
    filetypes = { "typescript", "typescriptreact" },
  },
}

lvim.lsp.installer.setup.ensure_installed = {
  "awk_ls",
  "bashls",
  "cssls",
  "dockerls",
  "gopls",
  "graphql",
  "html",
  "jsonls",
  "tsserver",
  "marksman",
  "pyright",
  "pylsp",
  "sqlls",
  "tailwindcss",
  "terraformls",
  "tflint",
  "vuels",
  "yamlls"
}

-- -- Additional Plugins <https://www.lunarvim.org/docs/plugins#user-plugins>
lvim.plugins = {
  {
    "olexsmir/gopher.nvim",
    config = function()
      require("gopher").setup {
        commands = {
          go = "go",
          gomodifytags = "gomodifytags",
          gotests = "gotests",
          impl = "impl",
          iferr = "iferr",
        },
      }
    end,
  },
  {
    "leoluz/nvim-dap-go",
    config = function()
      require("dap-go").setup()
    end,
  },
  "AndrewRadev/splitjoin.vim",
  {
    "tpope/vim-eunuch",
    cmd = {
      "Remove",
      "Delete",
      "Move"
    }
  },
  {
    "tpope/vim-bundler",
    cmd = { "Bundler", "Bopen", "Bsplit", "Btabedit" }
  },
  {
    "tpope/vim-rails",
    cmd = {
      "Eview",
      "Econtroller",
      "Emodel",
      "Smodel",
      "Sview",
      "Scontroller",
      "Vmodel",
      "Vview",
      "Vcontroller",
      "Tmodel",
      "Tview",
      "Tcontroller",
      "Rails",
      "Generate",
      "Runner",
      "Extract"
    }
  },
  {
    "tpope/vim-fugitive",
    cmd = {
      "G",
      "Git",
      "Gdiffsplit",
      "Gread",
      "Gwrite",
      "Ggrep",
      "GMove",
      "GDelete",
      "GBrowse",
      "GRemove",
      "GRename",
      "Glgrep",
      "Gedit"
    },
    ft = { "fugitive" }
  },
  {
    "zbirenbaum/copilot-cmp",
    event = "InsertEnter",
    dependencies = { "zbirenbaum/copilot.lua" },
    config = function()
      vim.defer_fn(function()
        require("copilot").setup()     -- https://github.com/zbirenbaum/copilot.lua/blob/master/README.md#setup-and-configuration
        require("copilot_cmp").setup() -- https://github.com/zbirenbaum/copilot-cmp/blob/master/README.md#configuration
      end, 100)
    end,
  }
}

Actual behavior

LSP warns about both string types

Expected behavior

No response

support info

 Language client log: /Users/danseravalli/.local/state/lvim/lsp.log
 Detected filetype:   ruby

 3 client(s) attached to this buffer: 

 Client: standardrb (id: 1, bufnr: [1])
    filetypes:       ruby
    autostart:       true
    root directory:  /Users/danseravalli/Desktop/test
    cmd:             standardrb --lsp

 Client: solargraph (id: 2, bufnr: [1])
    filetypes:       ruby
    autostart:       true
    root directory:  /Users/danseravalli/Desktop/test
    cmd:             solargraph stdio

 Client: copilot (id: 3, bufnr: [1])
    filetypes:       
    autostart:       false
    root directory:  /Users/danseravalli/Desktop/test
    cmd:             node /Users/danseravalli/.local/share/lunarvim/site/pack/lazy/opt/copilot.lua/copilot/index.js

 Configured servers list: standardrb, solargraph

    __                          _    ___         
   / /   __  ______  ____ _____| |  / (_)___ ___ 
  / /   / / / / __ \/ __ `/ ___/ | / / / __ `__ \
 / /___/ /_/ / / / / /_/ / /   | |/ / / / / / / /
/_____/\__,_/_/ /_/\__,_/_/    |___/_/_/ /_/ /_/ 

Buffer info
* filetype:                ruby
* bufnr:                   1
* treesitter status:       active

Active client(s)
* name:                      standardrb
* id:                        1
* supported filetype(s):     ruby
* attached buffers:          1
* root_dir pattern:          1
* capabilities:              diagnosticProvider | documentFormattingProvider
* name:                      solargraph
* id:                        2
* supported filetype(s):     ruby
* attached buffers:          1
* root_dir pattern:          1
* capabilities:              definitionProvider         | documentSymbolProvider  | referencesProvider
                             documentFormattingProvider | workspaceSymbolProvider | hoverProvider
                             documentHighlightProvider  | foldingRangeProvider
* name:                      copilot
* id:                        3
* supported filetype(s):     []
* attached buffers:          1
* root_dir pattern:          1

Automatic LSP info
* Skipped servers: [angularls, ansiblels, antlersls, azure_pipelines_ls, omnisharp, cssmodules_ls, denols, docker_compose_language_service, ember, emmet_ls, eslint, glint, golangci_lint_ls, gradle_ls, graphql, jedi_language_server, ltex, neocmake, phpactor, psalm, pylsp, pylyzer, pyre, quick_lint_js, reason_ls, rnix, rome, ruby_ls, ruff_lsp, solang, solc, sorbet, sourcery, spectral, sqlls, sqls, standardrb, stylelint_lsp, svlangserver, tflint, unocss, verible, vtsls, vuels]

Formatters info
* Active: 
* Supported: [rubocop, rubyfmt, rufo, standardrb]

Linters info
* Active: 
* Supported: [reek, rubocop, semgrep, standardrb]

Code actions info
* Active: 

logs

No response

Screenshots

Screenshot-2023-05-20-19 07 30

heberuriegas commented 1 year ago

Try disabling standardrb. It probably happened because solargraph and stardandrb are both installed.

dseravalli commented 1 year ago

Try disabling standardrb. It probably happened because solargraph and stardandrb are both installed.

Uninstalling either of them and adding it to lvim.lsp.automatic_configuration.skipped_servers to prevent it from automatically reinstalling works. Why is it the default behavior to auto-install both of them for Ruby?

LostNeophyte commented 1 year ago

Why is it the default behavior to auto-install both of them for Ruby?

it's not the default behavior, standardrb is in the skipped list by default

martindavid commented 8 months ago

Try disabling standardrb. It probably happened because solargraph and stardandrb are both installed.

Uninstalling either of them and adding it to lvim.lsp.automatic_configuration.skipped_servers to prevent it from automatically reinstalling works. Why is it the default behavior to auto-install both of them for Ruby?

@dseravalli do you mind to share what do you mean by uninstalling and add it?? So does that mean, I can't use standardrb if the project that I'm working on use it?