Comments (15)
There is a basic content-assist for top-level elements:
Content-assist to nested element to be done
from kaizen-openapi-editor.
Nice!
from kaizen-openapi-editor.
Some updates on the state of the content assist.
The content assist for a yaml editor will not be so easy to implement so I suggest that we start with basic, simple features, and start augment it once we understand how to really implement content assist.
Basic features to be implemented:
- allow content assist only on beginning of line
- start allow content assist after user enter a few letters, should provide possible matches to finish word
- start allow content assist on non beginning of line
Before starting on more advanced features, those 3 should be done. The challenge here is to adapt the result of the Yaml parser (snakeyaml), to give us useful data. The current problem with the Yaml parser is that it does not give us an easy to traverse/manipulate AST.
The other challenge for code assist is to use the information from the Swagger JSON Schema and merge it with the Yaml AST, to obtain somehow the type of elements the user would need.
from kaizen-openapi-editor.
This is one of those areas where Xtext makes things much easier. So I agree with the strategy of starting with a minimal code assist feature, and adding more as we learn how.
But keep in mind that, at some point, it might be best to stop work on this Swagger editor, which we regard as "tactical", and start work on an Xtext-based Swagger editor, with more long-term strategic value. We will need to decide together when we have gotten to the point of diminishing returns with YEdit.
Also, @ghillairet , can you please clarify:
start allow content assist after user enter a few letters, should provide possible matches to finish word
IIUC, this means we would display suggestions, but only after the user types a few letters.
Did you mean to display these suggestions automatically, as the user types? Or display them on explicit invocation, using Ctrl-space or a similar command?
Also, did you mean that this requirement of typing the first few letters would apply to beginning-of-line code assist, or only to mid-line code assist?
from kaizen-openapi-editor.
Suggestions would not appear automatically, but when the user does Ctrl-space, at least for now.
The goal would be first to do it for beginning-of-line code assist first and see then if it is easily doable for other parts of a document.
I agree also that using Xtext could simplify the development of the editor, especially if newer versions allow to implement whitespace indentation based languages.
from kaizen-openapi-editor.
I just checked RAML editor in AnypointStudio, it's based on snake-yaml. They only provide content-assist for the root-level elements (in the very beginning of the line)
from kaizen-openapi-editor.
I have added the completion for when the user starts to enter an input.
For the rest, when the user activates the completion, it will propose the list of keywords found in the swagger schema.
I also started to offer suggestions for values, it's quite limited for now.
For example if the user has enter
swagger:
and activates the code completion after the symbol :
it will propose '2.0'
as it is the only choice offer by the schema.
from kaizen-openapi-editor.
Also maybe it is worth looking at how content assist is implemented by the yaml editor in Spring IDE, see
https://github.com/spring-projects/spring-ide/tree/master/plugins/org.springframework.ide.eclipse.boot.properties.editor.yaml/src/org/springframework/ide/eclipse/boot/properties/editor/yaml/completions
from kaizen-openapi-editor.
Just for info, the spring ide yaml editor seems to be based on Yedit and does support some kind of content assist.
from kaizen-openapi-editor.
To update on the Spring Yaml Editor content assist. It looks like it proposes templates for properties. The implementation seems specific for their use case and also depends on other classes from the Spring IDE that are related to content assist.
from kaizen-openapi-editor.
The work that concerns the content assist will be done on the branch develop.
The approach that I investigate will work according to this high level flow:
- call content assist at line x
- find yaml path of element at line x
- find definition in schema for path
- find actual data matching the path in JSON representation of document
- create assist proposals from definitions and actual data (e.g. not propose already present properties)
Below some screenshots of this prototype (does not work for many cases)
from kaizen-openapi-editor.
Lots of improvements have been done on the content assist. The latest version is available in the branch develop.
Here is a preview of what it can do:
Under the hood it works as describe in my previous comment. There are still place for improvements and may have some bugs, but I think it is quite close to being ready.
from kaizen-openapi-editor.
Guillaume, this looks really good! Very glad to see that you have found a
way to address this challenge. Please keep it moving forward, do your best
to test & verify.
Hope you have a a good weekend, and we'll talk next week.
- Ted
from kaizen-openapi-editor.
I made some more improvements for the content assist, that includes case when user starts to enter letters, now the proposals are only the ones for the current context.
Still some things to improve, for example:
- content assist inside an object that only defines pattern properties.
- distinguishing required properties in the content assist popup.
- better looking labels in the popup (e.g. use of different colors)
from kaizen-openapi-editor.
There maybe some remaining minor issues, but the main part is done. Closing.
from kaizen-openapi-editor.
Related Issues (20)
- Failure running with java 11 HOT 2
- Code assist is missing properties named "default"
- Skip empty strings in formatter (customizable)
- File does not contain a valid swagger spec HOT 2
- Plugin not compatible with Eclipse 2019-06 release? HOT 3
- Memory leak in swagger editor
- YAML References in other files throws warning
- Internal error occurred during: "Update KaiZen Editor validation markers" HOT 4
- Only Swagger v2 features work, not OpenAPI v3 HOT 7
- Error updating Kaizen Editor to version 0.8.0.201909121743 HOT 3
- Unable to close eclipse properly because of Kaizen-OpenAPI-Editor HOT 1
- invalid character in reference
- Spell checker is not working on Swagger file editor HOT 1
- Add "./" for file completion on file $ref
- Doesn't follow the Eclipse Color Theme plugin (so black text on black background is a result of dark theme) HOT 3
- Installation in 2020-12 fails silently
- Avoid warning on inherited properties (allOf)
- description causes failed to match exactly one schema
- Update site returning HTTP status 504 HOT 5
- Update Site is down HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaizen-openapi-editor.