IDEA-314508 Support external snippets in @snippet
Helps partially for IDEA-314510 Impossible to create snippet-files directory
GitOrigin-RevId: 0a891fe7cfafa93d814edf865b0bfbb9bc6e9e2a
Usually leading asterisks of a javadoc are aligned so the common indent for the lines in a snippet's body is obvious,
but nevertheless javadoc can have multiple leading asterisks, and they don't have to be aligned.
This patch fixes the indent stripping: if the indent is too short, which will result in leaving some leading
asterisks after stripping the indent from the line, the indent gets increased, so it goes after the last leading asterisk in the line.
GitOrigin-RevId: c79bcb3e25b96b5b1ff52da350f926673d155199
Implement updating the content of a snippet tag with the help from a method implementer. A snippet might invoke overriding a method though a completion and when a parent method is inserted it might contain javadoc. In this case it's impossible to recreate a snippet tag because the new text for the tag contains "/**" and "*/" that come from the parent method's javadoc. The implemented method implementer helps to strip a method's javadoc if it's present.
Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>
GitOrigin-RevId: 42b315ed2670701e50574a383f0442df69accd35
Fix injection for empty snippets. The range to inject is now starts after the colon and ends when the body ends. If no colon exist, then use the whole body as an injection point.
GitOrigin-RevId: c7961f13c30212f52aad45a121bcf11b70ce8f2b
Add an enclosing class for snippets in order not to make users define a class in a snippet code to eliminate syntax errors when the code consists of a set of instructions
GitOrigin-RevId: c6f52f94d51fdc6393c8a9fdc0ddb615e8d37b17
JEP-413 says that by default a snippet tag's body is in JAVA language, so JavadocInjector injects JAVA into a snippet tag automatically. The injector relies on the lang attribute to inject a language, if the attribute is not present, then JAVA is used.
In order to make a user's live easier the injector doesn't make user guess the correct language name, instead if the injector didn't find a language by the value from the `lang` attribute it traverses throughout all the registered languages and looks for the one the name of which matches the specified ignoring case. That is the case for java: in our code base the language goes by the `JAVA` id, but users tend to write the language name in lowercase ("java") or with only the first letter in the capital case ("Java")
Signed-off-by: Nikita Eshkeev <nikita.eshkeev@jetbrains.com>
GitOrigin-RevId: cca8c90bb5ad04485f1bf4119b9936114e5492e4