vala-lang / vala-language-server

Code Intelligence for Vala & Genie
GNU Lesser General Public License v2.1
290 stars 43 forks source link

VLS not reading meson.build or compile_commands.json?? #290

Open Charadon opened 1 year ago

Charadon commented 1 year ago

Describe the bug For some reason, I keep getting the error: The namespace name 'Gtk' could not be found (vala) Even though it compiles correctly. I've tried copying the compile_commands.json into src and the root of the folder with no success.

Software OS and version (e.g. Ubuntu 20.04): Slackware 15.0 Code editor (e.g. VSCode): Vim with coc-nvim Vala Language Server (e.g. git commit, or PPA/AUR version): 0.48.7 Vala version (valac --version): 0.54.6

To Reproduce This code should replicate it. https://pagure.io/charadon/grpmi

Steps to reproduce the behavior:

  1. Open src/main.vala in vim
  2. You should get the error

Any help for trying to figure out what's wrong would be appreciated, as this is the first time i've ran into this issue. And what's more odd, is that this bug doesn't affect my other vala project: https://pagure.io/charadon/Dungeon-Vala

Me not get it

Charadon commented 1 year ago

I think I figured it out. It fails if the project hasn't been set up with git yet.

Prince781 commented 1 year ago

git shouldn't have anything to do with this. I can't reproduce your issue.

Charadon commented 1 year ago

git shouldn't have anything to do with this. I can't reproduce your issue.

I've managed to reproduce it by not using git. If I don't have a git repo initialized (renaming .git to .git_backup for example), it won't work anymore, but if I have git, it will work again. Is git being used to find the top level of the project directory?

Prince781 commented 1 year ago

No. We don't use git for that.

Charadon commented 1 year ago

No. We don't use git for that.

Then I dunno. I can keep reproducing it by just getting rid of the git repo. It might be something with coc-nvim maybe?

Prince781 commented 1 year ago

A few questions:

  1. What's the working directory that you open the file from?
  2. Can you send a log of VLS's output?
Charadon commented 1 year ago

I think I figured it out. And it's most likely a quirk in coc-nvim. Basically, I had a recursive git repo thing going on (Git repo inside a git repo). And in the sub directory I had the program in, it didn't have it's own git repo set up yet. So coc-nvim was probably look at the toplevel of the git repo (which would be the "meta" repo) and couldn't find meson.build or compile_commands.json and would as such, fail.

Now as for the questions above. I can really only tell you i'm opening the source file from the directory that the meson.build is in. As for VLS's output, I don't know how to get that from coc-nvim. I've checked every log command coc-nvim has, and vala appears to not spew any errors (Or any output aside from the fact it launched)