lunisolar / LNKD.tech-Editor

Editor for Turtle (Terse RDF Triple Language, TTL) files. This is a plugin for IntelliJ IDEA, IDEA Community Edition and others IDE environments based on IntelliJ Platform (also described here)
https://plugins.jetbrains.com/plugin/12802-lnkd-tech-editor
4 stars 0 forks source link

support language tag with upper-case Turtle #56

Open osi opened 2 weeks ago

osi commented 2 weeks ago

I'm using this plugin, while some of my team-mates are using the paid "RDF and SPARQL" plugin.

We make use of the @Language tag to get syntax highlighting in strings.

Unfortunately, the other plugin uses @Language("Turtle"), while this one uses @Language("turtle").

Would it be feasible to support an upper-case Turtle as well?

jak-ub commented 2 weeks ago

Thanks, for reporting this.

IntelliJ seems to be inflexible with this feature combining technical language ID and display name into one value (thus no support for case-insensitivity, and no aliases, no MIME support).

I have following options:

  1. Change my ID to "Turtle", it actually will be more consistent with other languages.
  2. Spend spend some time on search, maybe some invisible possibility exists to influence language injection mechanism.
  3. Write custom injection support for every place injection is supported in every language it is supported in.

I will spend some time on p. 2. Then probably implement p.1 There is no point in having this ID just unique for one plugin vs the others (as having both plugins at the same time fails spectacularly with conflicts on file extensions).

jak-ub commented 2 weeks ago

Current findings: Point 2: seems to be plausible. I just need to check if it is not to much of a hack.

And by accident, I rediscovered that as alternative to language ID a file extension could be used, and both forms should work e.g. "TTL" and "ttl".

jak-ub commented 2 weeks ago

Current findings: Point 2. Alternative - plugin can register more than one file extension and one of them could be "turtle" this would solve the issue without hack.

@osi As a temporary solution you can add "*.turtle" extention in the settings (Settings/Editor/File Types). Then add file name pattern. It seems to work the same way as would plugin register the extension. Effectively making language injection actually somewhat flexible. I think you just need to potentially reopen the files for new run of auto-injection.

osi commented 2 weeks ago

thanks for the investigation! this is actually language injection into strings within code; i see that @Language("ttl") works with your plugin - i need to confirm with my colleagues that it also works with the other plugin