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

Auto-completion doesn't work #87

Open
kgrzywacz opened this issue May 27, 2017 · 7 comments
Open

Auto-completion doesn't work #87

kgrzywacz opened this issue May 27, 2017 · 7 comments

Comments

@kgrzywacz
Copy link
Contributor

In theory I have everything set up correctly(I think) because whenever I use omni competition on small project (Developer Edition org with few classes) it works.

But when I switch to my company's organizastion I'm getting following errors:

Operation failed
Error detected while processing function apexComplete#Complete[9]..<SNR>93_listOptions[13]..apexTooling#listCompletions[13]..apexToolingAsync#executeBlocking[17]..280[52]..<SNR>108_parseErrorLog[42]..apexMessages#process:
line    8:
E121: Undefined variable: null
Error detected while processing function apexComplete#Complete[9]..<SNR>93_listOptions[13]..apexTooling#listCompletions[13]..apexToolingAsync#executeBlocking[17]..280[52]..<SNR>108_parseErrorLog[42]..apexMessages#process:
line    8:
E15: Invalid expression: {"id":1,"text":null,"type":"ERROR"}
Error detected while processing function apexComplete#Complete[9]..<SNR>93_listOptions[13]..apexTooling#listCompletions[13]..apexToolingAsync#executeBlocking[17]..280[52]..<SNR>108_parseErrorLog[42]..apexMessages#process:
line    9:
E715: Dictionary required
0

When trying to use omni-completition with pressing Ctrl-x,Ctrl-o in insert mode with following text before cursor:
system.

Any idea what it might be?

@neowit
Copy link
Owner

neowit commented May 28, 2017

Before you add system. - does the file where you are trying to execute completion pass :ApexCheckSyntax ?

If it does pass syntax check - can you extract this file into its own local project (i.e. remove all other files except the class where you get the error) and check if you get same error ?

If you still get the error - it would be interesting to see what you file looks like. Perhaps you could try to reduce the file in question to bare minimum - remove everything you can while error still happens so you could share it here.

Can you also share the content of path-to-project/.vim-force.com/response_listCompletions generated when you executed failed call to auto completion ?

Thanks

@kgrzywacz
Copy link
Contributor Author

:ApexCheckSyntax doesn't return any message, but contents of project/.vim-force.com/response_checkSyntax is following:
RESULT=SUCCESS

Contents of project/.vim-force.com/response_listCompletions:

RESULT=FAILURE
MESSAGE: {"id":7,"text":null,"type":"ERROR"}

For this test I've created and deployed new file in this project:

public class SyntaxTest {
	public static void method() {
	}
}

Problem occurs in this file as well.

@neowit
Copy link
Owner

neowit commented May 28, 2017

Interesting... looks like grammar/syntax is not an issue in your case. Must be something config related.

if you move that test "SyntaxTest.cls" to your small "Developer Edition" project - do you get completion or do you get an error ?

If you do not get the error - perhaps path or file permissions of your work project cause a problem somehow. Can you try moving your "work" project to a simpler path to see if this makes a difference ?

Also, please post here:

  • your java version
  • your OS/version
  • in vim :ApexToolingVersion output
  • in vim :version output
  • full content of your :ApexMessages buffer, including completion related stuff
    feel free to change names in paths but please keep all "spaces", slashes, punctuation and any non alphanumeric/ASCII characters. If path is indeed a problem it would be good to figure out what part of path causes the issue.

Thanks

@kgrzywacz
Copy link
Contributor Author

All my projects are in the same path
dev project:
projects/project_test1 working
projects/project_test2 not-working

Just to double check, I've just inited both work org and dev org with :ApexInitProject and the result is as before.

Java:

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

OS:
macOS Sierra v10.12.4
ApexTooling:
INFO: tooling-force.com - version: 0.3.8.0; SFDC API Version: 38.0
vim version:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled May 25 2017 08:55:37)
MacOS X (unix) version
Included patches: 1-604
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             -clientserver    +cursorbind      +ex_extra        -gettext         +libcall         +mouse           +mouse_xterm     +persistent_undo +ruby            +tag_old_static  -toolbar         +wildmenu        -xterm_save
+arabic          +clipboard       +cursorshape     +extra_search    -hangul_input    +linebreak       -mouseshape      +multi_byte      +postscript      +scrollbind      -tag_any_white   +user_commands   +windows
+autocmd         +cmdline_compl   +dialog_con      +farsi           +iconv           +lispindent      +mouse_dec       +multi_lang      +printer         +signs           -tcl             +vertsplit       +writebackup
-balloon_eval    +cmdline_hist    +diff            +file_in_path    +insert_expand   +listcmds        -mouse_gpm       -mzscheme        +profile         +smartindent     +termguicolors   +virtualedit     -X11
-browse          +cmdline_info    +digraphs        +find_in_path    +job             +localmap        -mouse_jsbterm   +netbeans_intg   +python          +startuptime     +terminfo        +visual          -xfontset
++builtin_terms  +comments        -dnd             +float           +jumplist        -lua             +mouse_netterm   +num64           -python3         +statusline      +termresponse    +visualextra     -xim
+byte_offset     +conceal         -ebcdic          +folding         +keymap          +menu            +mouse_sgr       +packages        +quickfix        -sun_workshop    +textobjects     +viminfo         -xpm
+channel         +cryptv          +emacs_tags      -footer          +lambda          +mksession       -mouse_sysmouse  +path_extra      +reltime         +syntax          +timers          +vreplace        -xsmp
+cindent         +cscope          +eval            +fork()          +langmap         +modify_fname    +mouse_urxvt     +perl            +rightleft       +tag_binary      +title           +wildignore      -xterm_clipboard
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework Cocoa   -mmacosx-version-min=10.1
2 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/opt/python/Frameworks -framework Python   -lruby.2.4.1 -lobjc

ApexMessages:

************************************
 press 'q' to close this buffer
************************************
 
  --action=listCompletions --tempFolderPath='temp_path/temp' --config='projects_path/.settings/work_project.properties' --projectPath='projects_path/work_project' --column=10 --line=3 --currentFilePath='projects_path/work_project/src/classes/SyntaxTest.cls' --currentFileContentPath='/var/folders/3z/w10m48r534lb31p9gzpnky6c0000gn/T/vaFR4P9/16SyntaxTest.cls' --responseFilePath='projects_path/work_project/.vim-force.com/response_listCompletions' --pollWaitMillis=1000 --maxPollRequests=1000
ERROR: Operation failed
INFO: 0

@neowit
Copy link
Owner

neowit commented May 28, 2017

Thanks for the details.

Everything looks in order at first glance.

Have you tried moving that test "SyntaxTest.cls" into your small "Developer Edition" project - do you get completion or do you get an error ?

If you do not get an error - can you also try renaming:
projects/project_test1 (the working one) to something else temporarily, and rename
projects/project_test2 (non working one) to projects/project_test1
then kill all java processes (to make sure tooling-force.com.jar) is not running and try to call completion in SyntaxTest class (which is now in new location) again.

If that still does not work then next I would try to see if there is a file (or files) in the current project which make apex code scanner crash. This can be checked by gradually removing groups of files from project folder and trying completion in SyntaxTest after each removal.

@kgrzywacz
Copy link
Contributor Author

Hey, moving this class to another project worked, renaming didn't.

I've removed all classes except SyntaxtTest.cls from the project and it works.
So my next question is:
Is there a better way to identify faulty fields than removing them randomly and checking if code-completition works in other file? What exactly does :ApexCheckSyntax do?

@neowit
Copy link
Owner

neowit commented Jun 1, 2017

What exactly does :ApexCheckSyntax do?

It checks syntax of a given file against the grammar.

Most problems with code completion relate to things in the source files which current grammar does not handle properly.

Is there a better way to identify faulty fields than removing them randomly and checking if code-completition works in other file?

Did you mean "identify faulty files" ? In the current version it is a manual process unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants