-
Notifications
You must be signed in to change notification settings - Fork 12
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
Better code completion proposal for name/key of patterned properties and array elements #227
Comments
@tfesenko , can the suggestion be context-sensitive, so we have something like |
@tfesenko , @ghillairet , I'm placing high priority on this one, though I don't necessarily think we should jump into implementation. There are some things we should probably do first, just to make sure that OpenAPI v3 support is complete. But this is a weak point in the usability of KaiZen editor right now. It's also closely related to #70, and maybe these two issues should be merged. Generally, the problem is with user-specified key names, represented in the schema as Basic Usability ImprovementsSo far, we've suggested the following improvements:
These would be a significant improvement, and are probably worth doing on their own merit. Name-Value Template AdapterI'd like to add another possible solution: suggest templates defined in the property value context, and add some logic to adapt the template, so it automatically adds a template variable for the property name. For example, indented one level under What's expected here is a property with a user-specified name, and value conforming to a schema object. So we could say that schema object is the property value context, and we could promote templates from that context into the proposal list for the overall property: To make this more interesting, we'll add a few schema template variants. And to make it more forward-looking, we'll add the first usability improvement suggested above: proposing If the user inserts the "object schema" template, we would automatically adapt the template to provide a This should not require creating and maintaining a separate set of templates for the definitions context. We are just intelligently adapting templates from the property value context, so the expanded template includes the property name and the property value, indented underneath. Context-SensitivityTemplate adaptation should be context-sensitive:
Array Item Template AdapterWe could use similar logic for array elements, like the |
@tedepstein I have a prototype (available on task/227) implementing the Basic Usability Improvements: It's almost ready, just need to clean up the code. |
@tedepstein I added code templates for named schemas. They are generated by Java code from code templates for schema bodies defined in templates.xml . |
@tfesenko , this looks good! We have to somehow communicate that "schema" in the proposal list is not a keyword; it's a placeholder for a schema name that the user needs to type in. We provide a hint after insertion, by selecting the text so the user can overwrite, but I think it should also be more obvious in the proposal list. Please try using |
@tfesenko, this should also work for properties of object schemas. Same problem in the current editor: In this context, we want to propose And we should take a look at the other "Patterned Fields" in the OAS2 and OAS3 specs, to see where else we can apply this same usability improvement. In OAS3 it looks like callbacks and security schemes are similarly named elements that could benefit from Name-Value Template Adapters. There may be others as well. Finally, there are similar opportunities for array items. @tfesenko , if you want, you can split this into separate issues for OAS2 vs. OAS3., separate issues for individual contexts, and/or separate issues for Name/Value contexts vs. Array Item contexts. |
@tfesenko , I updated the spec above with additional context-sensitivity requirements. We will need to discuss the timing of this, as the full scope of work to be done is more than I originally thought through. |
…tes) caused by invalid tab width pref
… format '(schema name)' and select it for editing
Generated using commit 83638080c70784ca84fcfbf86af948c6e98bcbba on https://github.com/RepreZen/gnostic/tree/task/KZOE-227
…perties Add test to show that _key_ is still present in content assist for response content schema.
#227 Better code completion proposal for name/key of additional properties
We use the
_key_
as a code assist proposal for the "no proposal" case, usually it means property name, or some other named element, represented asadditionalProperties
orpatternProperties
in the schema:and
It can be easily changed as it's defined in com.reprezen.swagedit.assist.SwaggerProposalProvider.createObjectProposals(ObjectTypeDefinition, AbstractNode, String):
Note that we can change the label, the replacement text, or both.
@tedepstein , we wonder if you have ideas how to improve it, which labels/replacement use in this case.
The text was updated successfully, but these errors were encountered: