Martins3 / My-Linux-Config

:clap: Modern neovim configuration based on native lsp
https://martins3.github.io/My-Linux-Config/
GNU General Public License v3.0
337 stars 63 forks source link

How to disable java supporting? #41

Closed marryton007 closed 2 years ago

marryton007 commented 2 years ago

In my environment, I don't need java support, and it modifies my project files.

 ❯ git status tools 
On branch develop
Your branch is up to date with 'origin/develop'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   tools/loganalysis/.project
        modified:   tools/loganalysis/tests/.project
        modified:   tools/tradefederation/contrib/.project
        modified:   tools/tradefederation/contrib/tests/.project
        modified:   tools/tradefederation/core/.project
        modified:   tools/tradefederation/core/remote/.project
        modified:   tools/tradefederation/core/tests/.project

the file content is modified like below:

diff --git a/tools/loganalysis/.project b/tools/loganalysis/.project
index 427863301a..2ec530659f 100644
--- a/tools/loganalysis/.project
+++ b/tools/loganalysis/.project
@@ -14,4 +14,15 @@
        <natures>
                <nature>org.eclipse.jdt.core.javanature</nature>
        </natures>
+       <filteredResources>
+               <filter>
+                       <id>1639035297888</id>
+                       <name></name>
+                       <type>30</type>
+                       <matcher>
+                               <id>org.eclipse.core.resources.regexFilterMatcher</id>
+                               <arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
+                       </matcher>
+               </filter>
+       </filteredResources>
 </projectDescription>

So, How can I totally disable java support?

marryton007 commented 2 years ago

I have modified 'plugin/coc.vim'

_ " coc.nvim 插件    
  " \ 'coc-css',    
  " \ 'coc-html',    
  " \ 'coc-java',    
  " \ 'coc-lua',    
  " \ 'coc-xml'    
  let s:coc_extensions = [    
        \ 'coc-pyright',    
        \ 'coc-explorer',       
        \ 'coc-word',    
        \ 'coc-cmake',    
        \ 'coc-dictionary',    
        \ 'coc-rust-analyzer',    
        \ 'coc-vimlsp',    
        \ 'coc-ci',    
        \ 'coc-snippets',    
        \ 'coc-vimtex',    
        \ 'coc-smartf',    
        \ 'coc-go',    
        \ 'coc-sh',    
        \ 'coc-git',    
        \ 'coc-diagnostic'    
        \]  

I also ran the commands

:CocUninstall  coc-lua coc-java coc-xml coc-jedi
:CocRebuild
:CocRestart

But it useless.

Martins3 commented 2 years ago

I'm not a Java expert and I'll try my best to solve your problem.

Firstly:

  1. I think the modifications are caused by Java language server: https://github.com/eclipse/eclipse.jdt.ls
  2. your modifications and commands to get rid of coc-java is correct, as far as I know.

There are my immature assumptions may helpful for your problem:

  1. maybe it's not neovim's problem, have you ever opened the project with vscode
  2. now that these files are caused by Java language server and you need the lsp, maybe just uninsall the lsp
  3. make the modified files readonly temporally to find out which program caused the problem
marryton007 commented 2 years ago

I tried two methods:

  1. according to the coc-java quick start, remove directory "~/.config/coc/extensions/coc-java-data.
  2. add "java.enabled: false" in coc config file.

It seems the problem is going away. but I don't know which one is right.