Closed slinky07 closed 2 years ago
there are a couple of workarounds, one of them is to make sure your project folder is git managed the other one is to override the java lang server to make sure it supports a single file or ...
Hello sorry for the long time to answer; my midterms are a bit crazy.
When you say the project would need to be git-managed where is that exactly at the project main folder that contains both out
and src
? my folder formatting was a bit destroyed when the issue got posted. my project is as follow, for the project mentioned in the issue:
~/dev/Assignment1 CCCS 301/out, src/[...]
where the comma dictates 2 folder children of the same parent. both out and src have multiple folders for the java packages.
would it need to be under "Assignment1 CCCS 301" which I make a repo? or the folder that contains the code itself?
Because the way I was doing things, temporarily for school, is I was just making the dev folder itself a repository for every project I have.
I would gladly change my git workflow if it means making this work.
Let's say that Assignment1 CCCS 301
is the project folder(i.e it contains all the code for the project, the test etc.
According to lspconfig
, it would require one of the following files to be in the root folder of the project before it runs the LSP:
'build.gradle', 'pom.xml', '.git'.
@slinky07 You can remove the bug label from your issue, this is a user-error.
So to fix the issue, you can do the following:
Thanks a lot, @Uzaaft , I modified my workflow accordingly, and after It recognized my maven project correctly with the pom.xml but not .git
projects. It took me a while to figure it out but I understand better now. somehow nvim only use jdtls for java, which apparently only uses pom.xml , build.xml , settings.graddle
and settings.graddle.kts
Idk if that's on purpose .git
not being there but after I added it, it recognizes my git projects now.
Little question, I modified the jdtls.lua
file directly by adding the git line on the table of root_files
. would I have been able to directly add .git
in my main config file? I am not sure which syntax to use there to directly modify jdtls instead of project's detection_methods
.
I am trying to make java_language_server
work but I am okay for now with jdtls I guess. Thanks for the help.
@slinky07 You can directly add .git
into your main config file, although I am not sure why it didn't just default to that.
Could you paste your config.lua
in a gist and provide the link?
Also, I don't think there is a java_language_server
LSP, at least I can't seem to find it here https://langserver.org
Hello @Uzaaft Thanks again for your patience, I had another midterm this week.
I put here the config.lua
you wanted; plus the jdtls.lua
that I had actually modified to get LSP to work.
config.lua
the git-related lines are lines 61 and 62
. There have been more tries of different styles but I deleted them. Nothing I wrote there affected LSP not recognizing .git. I was thinking maybe I did not write the correct syntax but it seems weird as apparently it is supposed to be automatic.
Unless it is jdtls
which is why i ended up adding the line there. The jdtls.lua
modified line is line 86
. included it just in case.
https://gist.github.com/slinky07/e5a4cd5b399f48227e658261160fe20c
Last thing, if I understand how github works, then I cannot remove the bug
label as I am not a contributor yet.
Thanks a lot for your time.
@slinky07 No worries, I am a student myself, so I understand that 😂 I'll look into it.
Problem description
Most of the time i use Intelleji. When I go use lvim I get " ____.java is a non-project file, only syntax errors are reported."
my usual project folders goes like this:
Assignment1 CCCS 301 ├── Assignment1 CCCS 301.iml ├── out │ └── production │ └── Assignment1 CCCS 301 │ └── com │ └── dsa │ └── COVID.class └── src └── com └── dsa ├── COVID.class └── COVID.java
I am aware it is probably a configuration issue. but I get this error even if I am in a lone folder like :
arrTest ├── Array.class └── Array.java
from what I understand, this is from the plugin called projects? I tried to set the configuration to recognize the src folder that is usually created from intelleji. but that doesn't seem to work.
here is my config.lua as of now:
i only put the lines uncommented.
if anyone can help me understand this I would greatly appreciate it.
I am new to lvim and nvim. I am trying to understand how to set it correctly and understand what I'm doing wrong. been reading documentation everywhere to understand a bit of everything including the plugins. I was reading the documentation of the projects plugin which is why I added the line at 61 in the hope it would solve the issue.
LunarVim version
2fa176f
Neovim version (>= 0.6.1)
NVIM v0.6.1
Operating system/version
macOS 12.2.1
Relevant log output
Screenshots