typedb-osi / typeql-plugin-jetbrains

TypeQL plugin for JetBrains
MIT License
10 stars 6 forks source link

Plugin 0.3 version features #15

Open farost opened 4 months ago

farost commented 4 months ago

We suggest to use this issue as a storage for the most needed features and hottest bugs introduced in the latest version. We may fix the whole bunch of it within the next update or consider creating a separate issue for global and long-lasting issues.

Features

Enhance code completion

Right now it works pretty good, but is really hardcoded. We'd like to spend more time exploring what's going on inside the logic and how to make it cleaner and more efficient.

Enhance name validation

It has been turned off as the generic one does it work well, but we are still interested in exploring the benefits we could get from a custom one.

Return and enhance inspection (unused things)

We disabled it until it works more consistent. Requires refactoring and reconsideration.

Cover everything we can with tests

Right now we only have tests for parsing, but we can do better.

Bugs

Cannot reference relations inside "plays" constraints.

For example, we have these relations and an entity, playing their roles. The highlighting for the role itself works well, which is shown below. However, we cannot highlight the reference to the relation.

Screenshot 2024-02-26 at 09 23 33 Screenshot 2024-02-26 at 09 24 49

This is an additional issue because of the renaming feature: as we don't have a reference, we cannot rename it: Before renaming:

Screenshot 2024-02-26 at 09 25 56 Screenshot 2024-02-26 at 09 26 19

After renaming: image

It looks like a grammar-based inconvenience right now as for plays constraints leafs (the minimal entities of the trees without children) are scoped labels without more specification for the labels it consists of. image

I haven't tried to make two references on one token, though, maybe there is a way to do it. I could also just use children of the entity for additional names, which wouldn't be that generic and clean, but it should work. But right now it just doesn't look that fast, so I wanted to highlight it.

Do not resolve ambiguity well.

For example, we have an incorrect define statement with two concepts with the same name and an entity which "owns" one of these concepts: image

Even if we don't highlight an error (as we are not a compiler itself), we could at least make referencing based on types. For example, we can store the type of the original concept and also use a "preferable" type for references:

farost commented 4 months ago
farost commented 3 months ago

Name validations are buggy now as they use the standard Java naming convention, which restricts such-names. To restore the name validator, we also need to restrict the main part of the special symbols and basically depend on our vocabulary. We also need to restrict using some of the keywords, but let the devs use RULE_unreserved tokens! So fixing it properly requires time.