Giter Club home page Giter Club logo

Comments (8)

VonHeikemen avatar VonHeikemen commented on September 24, 2024

First, you can check that lsp-zero's initial setup was executed. A global variable called loaded_lsp_zero should exists. Execute this command.

:echo g:loaded_lsp_zero

That should print the value 1.

Then you can check if the autocommand LspAttach was created.

:autocmd LspAttach

To verify that the autocommand was executed in the current buffer you can check if the command LspZeroFormat exists.

:command LspZeroFormat

from lsp-zero.nvim.

suvash avatar suvash commented on September 24, 2024

Thanks for the quick reply.

When checking if lsp-zero's initial setup was executed (via :echo g:loaded_lsp_zero), it's undefined.
Screen Shot 2023-11-05 at 22 01 36

However, when running :LspInfo right away, I see that 2 clients are attached to the buffer. Perhaps I'm missing something about how lsp-zero is initialised, (or how lsp servers are supposed to be initialised)
Screen Shot 2023-11-05 at 22 05 45

The next check :autocmd LspAttach does return some result, though a bit empty perhaps.
Screen Shot 2023-11-05 at 22 08 48

The final suggestion does not yield any result.
Screen Shot 2023-11-05 at 22 12 18

Where should I go from here ?

For some more context, I don't use mason & mason-lspconfig. The neovim plugins are pre-installed directly via nixpkgs(using home manager), and the same thing with the language server binaries.
I can confirm that the server binaries are on the path, and I've had no issues so far with any other plugins, so I'm sort of trusting that the installations are not messed up somehow.

One more question, when I manually trigger the :LspRestart, should I be expecting the "global" hook to be re-triggered as well, or is that only a one time thing per buffer ?

from lsp-zero.nvim.

VonHeikemen avatar VonHeikemen commented on September 24, 2024

The problem here is the initial setup of lsp-zero is not being executed. Neovim should execute this file automatically, but is not happening. You need the autocommand to exists so the "global hook" (and other features) can work.

The ideal solution to this would be figuring out why Neovim is skipping lsp-zero's plugin script, and then fix that.

The dirty hack that you can do to try to make it work is to load the module lsp-zero.setup manually.

require('lsp-zero.setup')

local lsp_zero = require('lsp-zero')
----
--- the rest of your config goes here...
---

You can check the state of the setup using this command.

:lua = require('lsp-zero.setup')

It should print this.

{
  done = true,
  extend_plugins = <function 1>,
  ok = true
}

If you don't get that output, something is wrong in the setup script or you are not using version 3 of lsp-zero.

from lsp-zero.nvim.

suvash avatar suvash commented on September 24, 2024

Thanks for the quick reply again.

I'll try your suggestions and follow up with the results. I'll also try to ensure that I'm running the 3.0 version of the plugin and see if it's still the case.

I'm on the road today, but will have some answers in a day or two. 🙌🏽

from lsp-zero.nvim.

VonHeikemen avatar VonHeikemen commented on September 24, 2024

I have a question:

The neovim plugins are pre-installed directly via nixpkgs(using home manager), and the same thing with the language server binaries.

Are you using this package from nixpkgs?

That is pinned to an old commit from the main branch. Versions in lsp-zero have their branch (I still push bug fixes to old versions).

Whoever packages lsp-zero for nixpkgs should update the commit hash to something in the v3.x branch.

from lsp-zero.nvim.

suvash avatar suvash commented on September 24, 2024

Are you using this package from nixpkgs?

Yes, that's the one. But, I'll try to get the plugin installed from the 3.x branch today and hopefully all will start working well.

from lsp-zero.nvim.

suvash avatar suvash commented on September 24, 2024

I just installed the plugin directly from the 3.x branch (using flake inputs to build the vimplugin via nix), and I can now confirm that all the debugging checks above works. And the global hook on attach also runs, given the print statement finally being emitted.
I'll do some more test and report back if something's not working as expected. But, for the time being, I'll close this issue. I'll also try to send a PR to update the nixpkgs upstream to use the 3.x branch.
Thanks for all the help. 🙌🏽

from lsp-zero.nvim.

suvash avatar suvash commented on September 24, 2024

@VonHeikemen Could you chime in the discussion above and let the maintainers in nixpkgs officially know that 3.x is the expected default branch to be packaged ?

from lsp-zero.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.