artur-shaik / vim-javacomplete2

DEPRECATED in favor of jc.nvim
Vim License
974 stars 83 forks source link

javacomplete#newclass#CreateClass parsing error #413

Closed MichaelCombs28 closed 5 years ago

MichaelCombs28 commented 5 years ago

Actual behavior (Required!)

enter new class name: Hello

Error detected while processing function javacomplete#newclass#CreateClass[11]..<SNR>26_ParseInput:
line    1:
E121: Undefined variable: g:RE_TYPE
E116: Invalid arguments for function matchlist(a:userinput, '^\([A-Za-z0-9_]*:\)\=\(\[.\{-}\]:\)\=\(\%(\/\|\/\.\|\)'. g:RE_TYPE. '\)\(\s\+extends\s\+'. g:RE_TYPE. '\)\=\(\s\+implements\s\+'. g:RE_TYPE. '\)\=\((.\{-})\|\)\(:.*\)\=$')
E15: Invalid expression: matchlist(a:userinput, '^\([A-Za-z0-9_]*:\)\=\(\[.\{-}\]:\)\=\(\%(\/\|\/\.\|\)'. g:RE_TYPE. '\)\(\s\+extends\s\+'. g:RE_TYPE. '\)\=\(\s\+implements\s\+'. g:RE_TYPE. '\)\=\((.\{-})\|\)\(:.*\)\=$')
line    2:
E121: Undefined variable: submatch
E116: Invalid arguments for function empty(submatch)
E15: Invalid expression: !empty(submatch)
^@
Error detected while processing function javacomplete#newclass#CreateClass:
line   15:
Error: could not parse input line

Expected behavior (Required!)

A new class file.

The steps to reproduce actual behavior (Required!)

  1. Call JCclassNew command
  2. Enter any string that should create a new class

Environment (Required!)

artur-shaik commented 5 years ago

I guess you have some conditions that give this issue. Can you create test project for me to reproduce it?

MichaelCombs28 commented 5 years ago

So I created a basic project using maven

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false

I realized I made a mistake and kept recreating it. If current buffer is not a java file it raises said error.

artur-shaik commented 5 years ago

So, this mean that jc2 plugin is not yet loaded, I guess. Not sure if we can do something here. Or, what if you let jc2 load for every file type in you bundle manager?

MichaelCombs28 commented 5 years ago

I'm a bit new to vimscript, I would assume some commands could be exposed to the global scope without the need to load the entire plugin. Potentially commands such as create class but if opened in a non java buffer would require users to enter the package string.

I honestly think this is more a non issue and more of a feature request, please feel free to close this issue.

artur-shaik commented 5 years ago

Class generation heavy depends on relative relation to other java files. If you trying to start new project you should open empty java file in vim, and run JCclassInFile. Than, you can relatively create classes with JCclassNew.

You can reopen this issue later, after some use of jc2, when you can shape you feature request better.