Revamp Jelly completion suggestions#197
Revamp Jelly completion suggestions#197janfaracik wants to merge 32 commits intojenkinsci:masterfrom
Conversation
| public class NamespaceUtil { | ||
|
|
||
| /** Collects all namespaces (and prefixes) from .jelly files in the project */ | ||
| public static Map<String, String> collectProjectNamespaces(Project project) { |
There was a problem hiding this comment.
Need to check the performance of this and how often its called and if there's any caching
There was a problem hiding this comment.
Aye, need to see if there's any performance regressions, and if so how we can avoid them with cache.
There was a problem hiding this comment.
this seems to be called on every key press although I didn't notice any delay... might be worth optimising if it doesn't cause other issues
|
I've tested this out and it worked really nicely |
| classLoader.getResourceAsStream("org/kohsuke/stapler/idea/resources/schemas/" + file + ".xsd"); | ||
|
|
||
| if (inputStream == null) { | ||
| throw new RuntimeException("Schema not found: " + file + ".xsd"); |
There was a problem hiding this comment.
I'm able to trigger this in Jenkins core with this error message:
Error parsing XSD: Schema not found: hudson.util.jelly.MorphTagLibrary.xsd
Testing with f:textarea
| * namespaces, and namespaces declared in the current file, in that order of precedence. | ||
| */ | ||
| private static Map<String, String> createMergedNamespaceMap(XmlTag tag) { | ||
| Map<String, String> projectNamespaces = collectProjectNamespaces(tag.getProject()); |
|
This is too much, IMO. The built-in XSD-based completion just works. JetBrains maintains it. And as you said, it works better than what we've got. It already knows about required attributes (and more) and adds them automatically. If there duplicates some time, I'd say figure out why and stop showing the duplicates. Don't reinvent the wheel. |
They are all from this plugin. If descriptors and |

This PR sets out to revamp the completion suggestions for
.jellyfiles. It aims to fix several existing issues, as well as add new features.Existing issues
What's new
.jellyfiles from scratch and having to manually add namespaces was a pain, now once you select a completion suggestion the namespace will get automatically imported.Screen.Recording.2024-12-03.at.08.35.57.mov
Testing done
Submitter checklist