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

lsp: no root directory despite go.mod being present #452

Open
JulianH99 opened this issue Jan 22, 2024 · 7 comments
Open

lsp: no root directory despite go.mod being present #452

JulianH99 opened this issue Jan 22, 2024 · 7 comments
Labels
bug Something isn't working lsp NeedsInvestigation Issue needs some investigation before being fixed

Comments

@JulianH99
Copy link

JulianH99 commented Jan 22, 2024

On neovim, the lsp is starded but does not seem to work, and upon executing :LspInfo, this is the result I get
image

And this is my file structure
image

I already tried the code on the logging section as well to see if using root_patern would help, but it didn't

@a-h
Copy link
Owner

a-h commented Jan 23, 2024

From the information provided, I can't tell what file type is being detected.

This is what I see on screen.

Screenshot from 2024-01-23 12-23-41

@a-h
Copy link
Owner

a-h commented Jan 23, 2024

Is the filetype being correctly detected as templ? If not, that's the problem.

You need to show the whole screenshot.

@JulianH99
Copy link
Author

Hi @a-h sorry for the missing part of the sc, here it is
image
And as you can see, it is being detected as templ

@a-h
Copy link
Owner

a-h commented Jan 23, 2024

My understanding is that Neovim will only start the LSP is the root directory configuration matches. In the case of templ, having a go.mod file (which I can see from your project that you do).

Here's the exact part of my Neovim configuration that configures the root directory.

https://github.com/a-h/dotfiles/blob/7f9d98a2ee263bacd6728ae4d519ada5f71e4119/.config/nvim/lua/lsp.lua#L59-L67

I'm not sure where your config is going wrong. Maybe you could share a repo with the complete config in it?

@JulianH99
Copy link
Author

Only thing is I removed the root config after it didn't work, but sure, here's my config https://github.com/JulianH99/nvim/tree/lsp (already on the lsp branch which is the one I'm using)

@joerdav joerdav changed the title Lsp says no root directory despite go.mod being present lsp: no root directory despite go.mod being present Jan 29, 2024
@joerdav joerdav added bug Something isn't working lsp NeedsInvestigation Issue needs some investigation before being fixed labels Jan 29, 2024
@a-h
Copy link
Owner

a-h commented Jan 31, 2024

@JulianH99 - a recent PR just landed which contains a known working Neovim configuration with Lazyvim: #463

I can see that there's a number of extra settings related to cmp_nvim_lsp in the example config that you don't have in yours. Maybe you could try using that config as a base and building out from there?

@JulianH99
Copy link
Author

@a-h I tried that config and yours too, but nothing seems to be working. I use mason, I added a custom handler for the templ lsp, I put the default config before mason setup, inside the handler, after the setup, and nothing worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp NeedsInvestigation Issue needs some investigation before being fixed
Projects
None yet
Development

No branches or pull requests

3 participants