amazon-ion / ion-intellij-plugin

Support for Ion in Intellij IDEA.
Apache License 2.0
28 stars 22 forks source link

Add support for breadcrumbs in `.ion` files. #39

Closed popematt closed 2 years ago

popematt commented 2 years ago

Issue #, if available:

Fixes #38

Description of changes:

Adds breadcrumb support for .ion files.

I thought it would be convenient to disambiguate sexp and list in the breadcrumb info, hence the [] and ().

E.g.:

{
  exprs: [
    (
      aaa
      +
      bbb
    ),
    (
      ccc
      +
      ddd
    ),
  ]
}

If you have your cursor in bbb, the resulting breadcrumb is exprs > [0] > (3).

For comparison, Intellij's breadcrumbs for .json files provides property name for elements in an object, and unadorned index for position within an array.

In order to make this work, I had to refactor the plugin's bnf grammar because otherwise operator symbols were not parsed but not made available as a PsiElement—that's why the diff is so large. You can ignore all files with gen in the path since they are automatically generated from them contents of the .bnf file.

Finally, I also make a few adjustments to the workflow so that it wouldn't try to publish to the beta channels from a fork.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

rmarrowstone commented 2 years ago

Is there a particular reason the generated files are tracked in git?

popematt commented 2 years ago

Is there a particular reason the generated files are tracked in git?

Yes. The project was not set up so that the files are generated by the build process—they get generated by running the IntelliJ grammar-kit plugin on the .bnf file, so we have to commit them to keep them around.

It looks like it's (now) possible to use a gradle plugin instead, but that's a little beyond the effort I want to put into this right now.