Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recognize .pebble files, and customize recognized extensions #56

Closed
xenoterracide opened this issue Dec 7, 2020 · 5 comments
Closed

Comments

@xenoterracide
Copy link

xenoterracide commented Dec 7, 2020

see PebbleTemplates/pebble#553 .pebble is the default for spring, I'm not using spring, but I'm using pebble for scaffolding, with files such as java templates. Since the extension is customizable, it makes sense to allow a list of file extensions as well (since you may have more than one engine active).

Lastly like SQL in Intellij IDEA ultimate, if it's not possible yet, allow highlighting of pebble in strings in a given file extension (for tests and such), I think this could/should be configurable per file, or maybe from a root path (my entire project doesn't use pebble). If you want I can make another ticket for this, but since I'm not certain if it's already possible I haven't.

@bjansen
Copy link
Owner

bjansen commented Dec 7, 2020

Most of the tests and documentation in https://github.com/PebbleTemplates/pebble use the .peb extension, which is also the default in this plugin. You can already registers other extensions to be recognized as Pebble templates in Preferences | Editor | File Types.

allow highlighting of pebble in strings in a given file extension

Not sure I understand your use case. The only case I'm aware of is com.mitchellbosecke.pebble.loader.StringLoader which loads templates from hard-coded strings instead of external files. Is this what you are talking about?

@xenoterracide
Copy link
Author

which loads templates from hard-coded strings instead of external files. Is this what you are talking about?

yes

use the .peb

hmm... then it's unfortunate that spring uses .pebble, still might be good to support it out of the box

@bjansen
Copy link
Owner

bjansen commented Dec 7, 2020

You might be looking for language injection, which I just tested on a random test class in the Pebble repo.

Put your cursor on the String argument passed to getTemplate(), for example pebble.getTemplate("{{ foo }}"), then press Alt-Enter, select Inject language or reference, then select Pebble.

This can be modified later on in Preferences | Editor | Language Injections.

@xenoterracide
Copy link
Author

since pebble doesn't document .peb which I'm arguing for documenting a standard file extension in that upstream ticket. It might be good to document it somewhere visible in the plugin itself. Outside of this and supporting .pebble out of the box, which is up to you, you can close this ticket.

@bjansen
Copy link
Owner

bjansen commented Dec 7, 2020

I can definitely pre-configure the missing extension + language injection in StringLoader, sure. Thanks for your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants