Skip to content

BytecodeDL/intellij-datalog

 
 

Repository files navigation

Datalog IntelliJ


Datalog Plugin for the IntelliJ Platform

For a list of changes in the newest version, please refer to the changelog.

安装

目前只支持离线安装,安装包从release下载

改进

  1. 增加了multi head的支持
  2. 增加了ByteCodeDL用到的一些语法比如#if #pragma contains
  3. 增加了relation全部参数的自动补全 relation_completion
  4. 修复了参数提示 parameterinfo

遗留问题

  1. 本来想支持cat等内置的函数,但是和MacroExpr冲突了,不知道怎么解决
  2. 在实现参数提示时,由于最初的bnf有问题,直接用了offset实现相关功能,虽然能用,但是一点都不优雅(本着又不是不能用的原则,先暂时就这样了)

Features

Syntax Highlighting

The plugin features extensive syntax highlighting. In addition renders identifiers differently based on the semantic information inferred from your code. For instance, variables in relations will use a italic font while instances of components will use an underscore effect.

Syntax Highlighting

As with all common language plugins for JetBrains IDEs, the syntax highlighting is fully customizable and can even be disabled entirely if you like to keep it plain.

Highlighting Options

Reference Resolution

The plugin keeps track of all identifiers and their corresponding declaration-sites, which enables a lot of advanced code editing goodies.

Want to jump to an identifier's definition? Just click it while pressing CTRL! As you can see in the following example, this also works in the reverse direction: CTRL-click a definition to see a list of its usages.

Reference Resolution

In addition, the plugin also supports most of the common reference-resolution related features found in Jetbrains IDEs which can be triggered by various keyboard shortcuts.

Refactoring

Not happy with your identifiers' names? Press SHIFT-F6 and rename it in no time!

Refactoring 1

Of course refactoring also works over multiple files, as well as for relations that within components.

Refactoring 2

Quick Definition and Documentation

Use the IDEs quick-definition keyboard shortcuts to view an identifiers definition, without jumping to a different code section.

Quick-Definition

Annotate your code with JavaDoc-style comments to provide documentation for relations, components and even preprocessor definitions.

Quick-Documentation 1

The documentation for an identifier can be queried by the IDEs quick-documentation keyboard shortcut.

Quick-Documentation 2

Code Completion and Parameter Hints

One of the features I love most about IDEs from JetBrains is their context-sensitive auto-completion. While typing, the IDE will show you a list of suggestions that might complete your current input. Wherever possible, it will only suggest completions that make sense semantically.

Code Completion

When filling in the parameters of a function or relation and unsure, press CTRL-P to see the signature of the relation.

Parameter Hints

Code Analysis

In order to find bugs in the code before it is passed to Soufflé, the plugin will highlight potential errors.

For instance, undefined identifiers will be highlighted.

Missing Declaration

Missing parameters will be reported...

Missing Parameter

...as will be superfluous parameters.

Superfluous Parameter

Furthermore, the IDE will issue a warning when variables are used only once in a relation rule.

Unused Variable

Automatic Formatting

Admittedly, this feature is not quite mature yet, but the plugin also supports automatic code formatting. For instance, new lines will be correctly indented when defining rules for a relation.

Formatting 1

Code formatting can also be triggered manually for a whole file.

Formatting 2

How to Get It

The plugin supports all JetBrains IDEs (i.e. IntelliJ, PyCharm, WebStorm, etc.) and can be obtained via their built-in plugin manager. Just search for Datalog Language Support in the marketplace section of the plugin dialog.

The plugin is listed on the JetBrains plugin repo.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 93.9%
  • Lex 5.2%
  • HTML 0.9%