CeleritasCelery / company-plsense

company backend for plsense
GNU General Public License v3.0
14 stars 2 forks source link

odd issue with starting it and then when it starts it does nothing #9

Open VVelox opened 6 years ago

VVelox commented 6 years ago

So I generally have to kick start it via M-x company-mode-plsense-setup and then run M-x company-plsense-start-server. This will likely get everything up and running to the point that M-x company-plsense-buffer-ready fails... at which point rerunning M-x company-mode-plsense-setup fixes that.

Atleast that was what was happening. Been poking my init.el a bit. It starts after loading a Perl file after a few seconds. The buffer says it is ready. Nothing seems different than before with out.

https://www.pastebin.ca/3952089 is my current config.

On another note, what is company-doc-buffer? I just have company-show-doc-buffer, which does nothing of use. Just says it has nothing at this point.

VVelox commented 6 years ago

Hmm.... just noticed it throwing this message...

Argument "__Positional_0001" isn t numeric in postincrement (++) at /usr/local/lib/perl5/site_perl/Class/Std/Storable.pm line 51.

CeleritasCelery commented 6 years ago

I am using Storable.pm v2.27. maybe your version is really old/new?

First let's make sure the server is working

  1. Pick a test file to verify config is correct.
  2. Start PlSense with plsense -i, which should start an interactive PlSense session.
  3. Start the PlSense server with > serverstart
  4. Verify server started with > serverstatus it should show all servers running.
  5. Open your test file with > open /path/to/test/file
  6. verify that the file is loaded with > ready /path/to/test/file. If everything went well it should reply Yes.
  7. Attempt file completion by giving a partial symbol name like > assist $foo. If your file has a variable called $foo_bar you should see that suggestion in the reply.
  8. close the server with > serverstop and > exit.

As far as the kick-starting issue goes. Try this:

If all the above working you should be good to go. If one of the steps above fails, report back here.

Also note that you can start the plsense server outside of Emacs using the numerical steps above then Emacs will connect to it when ever it starts up. Really useful if you close Emacs often.

VVelox commented 6 years ago

Installed Storable as that was missing.

Hmm... (add-to-list 'company-backends 'company-plsense) I found that if I manually start it and put it in the heap via going to the config group for it and adding company-plsense it will say it is using it when I check company-diag, but it behaves just as I was before with out it.

Seems to result in this according to --debug-init...

Debugger entered--Lisp error: (void-variable company-backends) (member (quote company-plsense) company-backends) (if (member (quote company-plsense) company-backends) company-backends (setq company-backends (cons (quote company-plsense) company-backends))) eval-buffer(#<buffer load> nil "/home/kitsune/.emacs.d/init.el" nil t) ; Reading at buffer position 3022 load-with-code-conversion("/home/kitsune/.emacs.d/init.el" "/home/kitsune/.emacs.d/init.el" t t) load("/home/kitsune/.emacs.d/init" t t)

[0 "\205\266

CeleritasCelery commented 6 years ago

your pastbin link is not working, but it sounds like you need to add (require 'company) so that the variables will be loaded by the time you add it to the list.

VVelox commented 6 years ago

(require 'company) fixes it starting and the buffer ready bit returns yes now. Does not appear to do anything more useful still than regular company-mode.

Strange the pastebin link is not working. Just threw it on my web server(not sure why I did not do that in the first place now).

https://vvelox.net/init.el

CeleritasCelery commented 6 years ago

Can you confirm that company-plsense is first in the list of company-backends? Also use company-diag to verify that it is using company-plsense as the backend.

CeleritasCelery commented 6 years ago

On a seperate note, you shouldn’t need to define the checker for perlcritic in flycheck. That is included in the package.

VVelox commented 6 years ago

hmm.... just noticed something interesting this time starting it it said...

ERROR: Can't connect work server : Connection refused

I am seeing the three procs below running...

PID   User    CPU% Mem% VM Size RSS   Info      Nice Start Time Command                                                                                                                        
90539 kitsune 0.00 0.19 36396   30968 S+ accept 5    14:34 0    /usr/local/bin/perl /usr/local/bin/plsense-server-resolve --cachedir /home/kitsune/.plsense.d --port1 33333 --port2 33334 --por
90528 kitsune 0.00 0.18 34348   30808 S+ accept 5    14:34 0    /usr/local/bin/perl /usr/local/bin/plsense-server-main --cachedir /home/kitsune/.plsense.d --port1 33333 --port2 33334 --port3 
90530 kitsune 0.00 0.12 23860   19784 S+ accept 5    14:34 0    /usr/local/bin/perl /usr/local/bin/plsense-server-work --cachedir /home/kitsune/.plsense.d --port1 33333 --port2 33334 --port3 
90502 kitsune 0.00 0.08 17584   13380 Ss+ ttyin 5    14:34 0    /usr/local/bin/perl /usr/local/bin/plsense --interactive                                                                       

Diags as below...

Emacs 25.3.1 (amd64-portbld-freebsd11.1) of 2017-09-29 on vixen42.vulpes.vvelox.net
Company 0.9.4

company-backends: (company-plsense php-extras-company company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files
                 (company-dabbrev-code company-gtags company-etags company-keywords)
                 company-oddmuse company-dabbrev)

Used backend: company-plsense
Major mode: perl-mode
Prefix: stop
Completions: none
VVelox commented 6 years ago

Also even though it shows up with that company-plsense-server-status shows up as Running.

It also threw the item below a few times, before finally returning "Yes" for "company-plsense-buffer-ready".

Argument "__Positional_0001" isn t numeric in postincrement (++) at /usr/local/lib/perl5/site_perl/Class/Std/Storable.pm line 51.

CeleritasCelery commented 6 years ago

What is the output of company-plsense-status? I have never seen the storable error before. Can you confirm that the server is working using the steps I outlined above?

VVelox commented 6 years ago

The output from company-plsense-status is...

Main Server is Running.
Work Server is Running.
Resolve Server is Running.
CeleritasCelery commented 6 years ago

If the server is running, call company-plsense-update to make sure the location is on the file you want (Though normally it will do that automatically). Then run company-plsense-command and enter the command location to confirm it is on the file you want. If that is the case try company-plsense-command and run assist <some partially completed variable name. e.g. $foo>. It should reply back with all variables that begin with that prefix ($foo in this case). If so you should be good to go.