Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No autocompletion on neovim with nvim-lspconfig #89

Open
glyh opened this issue May 15, 2024 · 6 comments
Open

No autocompletion on neovim with nvim-lspconfig #89

glyh opened this issue May 15, 2024 · 6 comments

Comments

@glyh
Copy link

glyh commented May 15, 2024

I've tried to use crystalline multiple times on neovim with nvim-lspconfig, and I get no autocomplete. Is there any information on troubleshooting crystalline?

@glyh
Copy link
Author

glyh commented Oct 13, 2024

Hello, I would like to help with this.

I'm on crystal 1.14.0, LLVM: 18.1.8 with crystalline built from 4bac680

Here's what I have with LSPInfo:
image

As for LSP log it's empty.

The config is the default given by nvim-lspconfig:

https://github.com/neovim/nvim-lspconfig/blob/d141895d1d9f41048fff201d62a2d6e96d299e32/lua/lspconfig/configs/crystalline.lua#L5

Could you tell me how should I troubleshoot?

@glyh
Copy link
Author

glyh commented Oct 13, 2024

Also there's even more weird behavior as this LSP delete some of my code on save when save-on-format is enabled with some other plugins on neovim.

@glyh
Copy link
Author

glyh commented Oct 13, 2024

Here's a tmp fix so I can see linting, I'm still having issues with auto formatting/auto completion , though.

lspconfig.crystalline.setup {
  cmd = { "crystalline", "--stdio" },
}

@and3md
Copy link

and3md commented Oct 13, 2024

Hi I have the same problem with lsp based autoformat so I start using vim-crystal for auto format:

-- turn on auto format with vim-crystal:
vim.g.crystal_auto_format = 1

add vim-crystal in lazy:

{
    'vim-crystal/vim-crystal',
},

and disable lsp_fallaback for crystal files (code form modified kickstart.nvim):

  { -- Autoformat
    'stevearc/conform.nvim',
    lazy = false,
    keys = {
      {
        '<leader>f',
        function()
          require('conform').format { async = true, lsp_fallback = true }
        end,
        mode = '',
        desc = '[F]ormat buffer',
      },
    },
    opts = {
      notify_on_error = false,
      format_on_save = function(bufnr)
        -- Disable "format_on_save lsp_fallback" for languages that don't
        -- have a well standardized coding style. You can add additional
        -- languages here or re-enable it for the disabled ones.
        local disable_filetypes = { c = true, cpp = true, crystal = true }
        return {
          timeout_ms = 500,
          lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
        }
      end,
      formatters_by_ft = {
        lua = { 'stylua' },
        -- Conform can also run multiple formatters sequentially
        -- python = { "isort", "black" },
        --
        -- You can use a sub-list to tell conform to run *until* a formatter
        -- is found.
        -- javascript = { { "prettierd", "prettier" } },
      },
    },
  },

@glyh
Copy link
Author

glyh commented Oct 14, 2024

Hello, thanks, that works now. Only thing that is broken is autocompletion now.

EDIT: it looks like we actually do have auto completion. It's just the quality of autocompletion is pretty bad.

@and3md
Copy link

and3md commented Oct 14, 2024

Hello, thanks, that works now. Only thing that is broken is autocompletion now.

EDIT: it looks like we actually do have auto completion. It's just the quality of autocompletion is pretty bad.

It seems to work in the main source file but in others it works quite randomly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants