-
Notifications
You must be signed in to change notification settings - Fork 21
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
Revamp Jelly completion suggestions #197
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.jelly
files. It aims to fix several existing issues, as well as add new features.Existing issues
What's new
.jelly
files 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