[P4-dev] LSP server for P4? Good P4 Outline View in VSCode?

4 views
Skip to first unread message

Andy Fingerhut

unread,
Jan 10, 2022, 9:47:59 AM1/10/22
to p4-...@lists.p4.org
Is there an open source LSP server for P4?

I know there are at least 2 or 3 different add-ons for P4 in VSCode.  Does anyone know if any of them support a nice "Outline View" that shows tables, actions, control, parsers, etc. in the outline view?  https://code.visualstudio.com/docs/getstarted/userinterface#_outline-view

Similarly if there is some Elisp code or package that causes Emacs to show a good outline in ECB (Emacs Code Browser), or some other similar Emacs package that has similarities to VSCode's outline view?  http://ecb.sourceforge.net/

Thanks,
Andy Fingerhut

Radostin Stoyanov

unread,
Jan 10, 2022, 11:21:06 AM1/10/22
to p4-...@lists.p4.org
Hi Andy,

There is one open-source LSP server for P4 available at
https://github.com/dmakarov/p4ls

Best wishes,
Radostin

> _______________________________________________
> P4-dev mailing list -- p4-...@lists.p4.org
> To unsubscribe send an email to p4-dev...@lists.p4.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s


Andy Fingerhut

unread,
Jan 12, 2022, 12:27:35 AM1/12/22
to p4-...@lists.p4.org
Thanks for that pointer, Radostin.

Has anyone used this LSP server with Emacs or VSCode, and written up step-by-step instructions they succeeded at in getting that to work?

In particular, I'd love to be able to see an outline/browser view of a big P4_16 source file (or multiple files with #include between them) that gave all control/parser/table/action/etc. names in the outline/browser window on the side, and clicking on any of those would jump to its definition in the main editor window.

I will probably spend some hobby time somewhere down the road trying again, but the 30 minutes or so I dedicated to the task so far didn't give good results yet.

Thanks,
Andy

Andy Fingerhut

unread,
Jan 22, 2022, 7:28:39 AM1/22/22
to p4-...@lists.p4.org
I have published a small bash script that successfully compiles the p4ls code on an Ubuntu 20.04 system here: https://github.com/jafingerhut/p4-guide/blob/master/bin/build-p4ls.sh

I do not know how to do anything useful with the p4lsd binary program built yet, though.  I am publishing the build steps in case anyone else wants to tinker with it and see if they can make it do something useful.

Andy

Reply all
Reply to author
Forward
0 new messages