linux-china / jetbrains-just-plugin

JetBrains Just Command Runner Plugin
https://plugins.jetbrains.com/plugin/18658-just
Apache License 2.0
35 stars 6 forks source link

Feature request: syntax highlighting / inspection for inline shell scripts #6

Closed nem75 closed 2 years ago

nem75 commented 2 years ago

The Jetbrains Makefile plugin uses the "Shell script" language syntax highlighting and inspections for inline shell scripts in recipes.

Would be neat if this plugin could do the same.

Unfortunately I have no clue about programming Jetbrains plugins, but some relevant piece of code in the Makefile plugin seems to be this:

https://github.com/JetBrains/intellij-plugins/blob/0f07ca63355d5530b441ca566c98f17c560e77f8/makefile/src/com/jetbrains/lang/makefile/MakefileShellLanguageInjector.kt#L11

nem75 commented 2 years ago

Rendered with Makefile plugin:

image

Rendered with just-plugin:

image

linux-china commented 2 years ago

Yes, it's a required feature. I have implemented it https://github.com/linux-china/jetbrains-just-plugin/blob/master/src/test/kotlin/org/jetbrains/plugins/template/JustCodeBlockLanguageInjector.kt and I should do more testing, for example recipes with python. I will enable it on next version, and it's a trial feature.

nem75 commented 2 years ago

Ooh, shiny. Should've checked the branches I guess. Thanks in advance! :)

linux-china commented 2 years ago

@nem75 done with version 0.2.4

nem75 commented 2 years ago

Hey @linux-china, thanks a lot.

Just noticed though, syntax highlighting only seems to work for implicit shell scripts. As soon es I define a script explicitly via shebang, the highlighting is gone. :/

Any chance this could be fixed?

image

linux-china commented 2 years ago

@nem75 :) my fault, and you should use #!/usr/bin/env sh now. I will add bash, zsh, fish and nu support :)

nem75 commented 2 years ago

Can't, we use bash syntax by default. But I'm happy to wait. :)