GithubHelp home page GithubHelp logo

yi-tseng / p4ls Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmakarov/p4ls

0.0 1.0 0.0 1.08 MB

LSP server for P4 language

License: MIT License

CMake 6.12% C++ 78.15% Emacs Lisp 2.57% P4 2.34% Groovy 0.36% Java 10.46%

p4ls's Introduction

P4LS

MIT License Join the chat at https://gitter.im/p4ls/Lobby Build Status codecov

P4LS is an implementation of an LSP server for the P4 programming language.

Install

P4LSD Server

MacOS

Prebuilt binary packages for installing p4lsd server are available for MacOS. To install the homebrew package use the following command

brew install dmakarov/homebrew-p4/p4ls

Linux

See Build section in this document for instructions on how to build from source.

Clients

Eclipse P4lang plugin

In addition to the P4 language server, the repository includes two LSP clients, one for Eclipse and another for Emacs. To build and install the Eclipse P4lang LSP client plugin follow these steps

cd clients/eclipse
mvn clean verify

If maven finished running without any error there should have been created a subdirectory repository/target/repository in clients/eclipse directory that contains the plugin jar file along with the required dependencies. To install the plugin in Eclipse

  1. open the Eclipse menu Help >> Install New Software...
  2. Type or paste the absolute path to repository/target/repository directory, e.g. /Users/dmakarov/work/try/p4ls/clients/eclipse/repository/target/repository in the Work with: text entry field and click Add... button.
  3. Check Dependencies and P4lang: P4 editing in Eclipse IDE checkboxes and finish installing.

After restarting the Eclipse a new P4 perspective should be available via Window >> Perspective >> Open Perspective >> Other... menu. If p4lsd is in one of the known paths, p4lang plugin should be able to find it, otherwise set the path to the p4lsd executable in P4 Preferences.

P4lsd searches for compile_commands.json in subdirectory hierarchy for each P4 source file it is processing. If you don't use cmake or similar tool to build your P4 project, you can create compile_commands.json file manually in an editor. For each file you want p4lsd to analyze there should be an entry like the following

[
{
  "directory": "/Users/dmakarov/work/try/p4ls/test",
  "command": "/Users/dmakarov/work/try/opt/bin/p4c /Users/dmakarov/work/try/p4ls/test/main.p4",
  "file": "/Users/dmakarov/work/try/p4ls/test/main.p4"
},
{
  "directory": "/Users/dmakarov/work/try/p4ls/test",
  "command": "/Users/dmakarov/work/try/opt/bin/p4c -I ../include /Users/dmakarov/work/try/p4ls/test/switch.p4",
  "file": "/Users/dmakarov/work/try/p4ls/test/switch.p4"
}
]

There can be any number of {} blocks between the top-level brackets []. Usually the compile_commands.json is created by running cmake with -DCMAKE_EXPORT_COMPILE_COMMANDS command line option, if a project build is managed by cmake.

Emacs LSP mode client

Install melpa lsp-p4 package

Contribute

Build

brew install boost cmake ninja pkg-config rapidjson
git clone https://github.com/dmakarov/p4ls.git
cd p4ls
mkdir -p build/ninja/release
cd build/ninja/release
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DHUNTER_ENABLED=OFF -DUNITTESTS_ENABLED=OFF <path to p4ls repository>
cmake --build . --target server/daemon/install

p4ls's People

Contributors

dmakarov avatar gitter-badger avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.