-
Notifications
You must be signed in to change notification settings - Fork 13
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
ZEN-4367, ZEN-3845 - Resource templates don't populate schema reference correctly #473
Conversation
Bug: stray quote in 2nd variable occurrence - If we leave the quotes in, we see this bug. It may be a KZOE bug, in which case we should aim to fix it. Bug: code assist prepends reference to selected text instead of replacing it. We only see this bug when we do not surround the template variable with quotes.
This reverts commit 62cc24b.
@ghillairet , this PR is ready for your review |
|
||
} | ||
|
||
/*============ Code below copied from utils.Cursors, otherwise Xtend won't compile ============= */ |
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.
@tfesenko Any clue why it does not compile for you? I have it working.
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.
@tfesenko Looks good. It works as expected, although I would prefer we remove the duplicate in the tests.
Covered by https://modelsolv.atlassian.net/browse/ZEN-4428, will be fixed later. Merging. |
Problem
ZEN-3845: Code assist should replace selected text
KZOE doesn't seem to have an option to overwrite the selected text. The CTRL key doesn't seem to have any effect.
I would even go further and say that the idea of an "insert" mode is quite counterintuitive. If I have text selected when I invoke code assist, I would fully expect that whatever I select from the suggestion list will replace the selected text. If it doesn't, it seems like a bug. I would never think to hold down the CTRL key, even if it worked. And I would not think to look for an option in preferences to make code assist replace instead of insert. I would just assume it's a bug. Apparently Andy Lowry make the same assumption in ZEN-4367 .
I think "replace mode" should be at least the default mode, and probably the only mode. It's not worth any extra effort to provide an option key (like Ctrl) or a preference setting for "insert mode" in code assist; I don't see the point.
ZEN-4367: Resource templates don't populate schema reference correctly
I tried inserting and filling in the collection resource code template, and found that there were warnings due to invalid references.
The first $ref variable is between single quotes; the second is within double quotes. After using code assist to choose a valid reference, the second one looks like this:
$ref: "'#/components/schemas/TaxFiling"
There is a stray single quote after the opening double quote.
The Object Resource template has a similar problem.
Changes Overview
The major changes are done in
StyledCompletionProposal
andProposalDescriptor
Proposal
->ProposalDescriptor
with fluent syntax to set all the values, addedtoString()
StyledCompletionProposal
instancesStyledCompletionProposal
: added newpreSelectedRegionLength
to address ZEN-3845 Code assist should replace selected textTests
JsonReferenceProposalProvider_Quotes_Test
provides integration tests for code assist for elements with quotes (references), it also checks the document state after the code assist proposal have been applied.