GithubHelp home page GithubHelp logo

jdaridis / souffle-lsp-plugin Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 3.0 41.17 MB

Soufflé Datalog Language Server. Add smart features to the Soufflé Datalog Language with the help of LSP in a VS code plugin

Home Page: https://pergamos.lib.uoa.gr/uoa/dl/object/3242355

ANTLR 3.14% Java 96.04% TypeScript 0.54% JavaScript 0.27%
antlr4 datalog lsp-server vscode-extension language-server souffle ide static-analysis

souffle-lsp-plugin's Introduction

Soufflé Datalog Language Server README

Soufflé is a logic programming language inspired by Datalog. Soufflé was initially designed for static program analysis and since then, there have been many other applications written in the Soufflé language, including applications in reverse engineering, network analysis and data analytics.

This is a plugin adding basic smart features to the Soufflé language, using the Language Server Protocol.

For syntax highlighting refer to: https://marketplace.visualstudio.com/items?itemName=W4RH4WK.souffle-syntax

The user needs to set the JAVA_HOME variable in settings for the plugin to work properly.

Features

  • Automatic reparsing when saving the file.

  • Syntax error reporting

Syntax error message

  • Integration with souffle-lint (If available on user system)

Souffle-lint message

  • Hover (Provide declaration info on hovers)

Hover example

  • Go to definition

Go to definition example

  • Go to Type Definition

Go to type definition example

  • Autocomplete

Autocomplete example

  • Signature Help

Signature Help example

  • Rename

Rename example

  • Find all references

References example

  • Find all rules for relation

Rule references example

  • Generate .input/.output for relation

Genarate I/O example

  • Extract type

Extract example

  • Snippets for fact / rule templates

  • Snippets for decl / comp generation

  • Deprecated code warning and quickfixes

  • Reformat documentation comments

Reformat comments example

  • Document symbols

Outline example

Requirements

The user needs to have Java installed on their system.

Build from source

To build the server jar file yourself just run ./gradlew jar on the top level and the resulting jar will be under build/libs.

To run the server run java -jar with the name of the generated jar file.

For the VS Code plugin run npm run package and the resulting .js file will be under dist/extension.js

Known Issues

In libraries with heavy use of the C preprocessor macros, sometimes parsing fails giving a false syntax error.

Release Notes

0.3.1

Minor fix in type autocomplete suggestions

0.3.0

  • Added primitive type list autocomplete
  • Added relation data structure list
  • Better type documentation (include super types)
  • Added deprecated code warnings

0.2.5

  • Added support for snippets
    • fact / rule template
    • decl / comp generation

0.2.1

  • Added support for slow rules in souffle-lint
  • Added support for many one-line // style comments.

0.2.0

  • Added integration with souffle-lint.
  • Added source code action to trigger souffle-lint
  • Added code action to extract types

0.1.6

Added code actions for reformatting documentation comments.

0.1.5

Added code actions for generating .input/.output for relations.

0.1.2

Updated README

0.1.1

  • Changed the grammar to be on par with Souffle.
  • Added icon.

0.1.0

Initial release of Soufflé Datalog Language Server.

souffle-lsp-plugin's People

Contributors

dependabot[bot] avatar fe1w0 avatar jdaridis avatar snf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

souffle-lsp-plugin's Issues

Build the server locally

I want to use the language server with vim, is there any way I can build the project locally?

I have no experience with Gradle-based projects and had no luck with gradle build or gradlew wrapper.

* What went wrong:
Could not open settings generic class cache for settings file '/home/xiaowen/souffle-lsp-plugin/settings.gradle' (/home/xiaowen/.gradle/caches/7.5.1/scripts/1lepdxfcl23lx79rdpsew90n).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 63

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 325ms

gradle --version:


------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-06 13:53:45 UTC
Revision:     <unknown>

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          19.0.1 (Oracle Corporation 19.0.1+10)
OS:           Linux 5.19.7-arch1-1 amd64

Integration with souffle-lint?

I'm not very familiar with LSP, so I don't know if language servers usually integrate with linters - but I think it would be nice to have the little editor squiggles for souffle-lint lints! Perhaps the LSP server could execute souffle-lint if it's on the $PATH, and souffle-lint could print source spans and messages as JSON that the LSP server could consume? Maybe something like:

{ 
  "begin": {"line": 1, "col": 1}
  "end": {"line": 2, "col": 12}
  "message": "Redundant fact [...]"
}

What do you think?

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.