Skip to content
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

Select parent skeleton first before other properties are suggested #691

Conversation

p-spacek
Copy link
Contributor

@p-spacek p-spacek commented Apr 1, 2022

What does this PR do?

This functionality helps a less technical person not to get lost on completion when there are complicated schemas and many properties that can be used (see the last screen - there are too many options so the user should select the parent/skeleton first and don't have to care about all possible properties).

It little bit extends 'parent/skeleton' object completion.

This PR addsyaml.selectParentSkeletonFirst. If true, the user must select some parent skeleton first before autocompletion starts to suggest the rest of the properties.
When yaml object is not empty, autocompletion ignores this setting and returns all properties and skeletons.

Not sure if it's useful for your users but it can help others (less technical creators).

examples

suggest only skeletons because object is empty:
image

whit disabled property yaml.selectParentSkeletonFirst (default)
image

properties are suggested as usual when the user tries to write it:
image

when the object is not empty, standard completion is displayed
image

Note that I haven't created PR for yaml client yet. I can create it when you check this one.

@coveralls
Copy link

coveralls commented Apr 1, 2022

Coverage Status

Coverage increased (+3.4%) to 82.25% when pulling 1722770 on p-spacek:feat/select-parent-skeleton-first into c4f906e on redhat-developer:main.

@gorkem
Copy link
Collaborator

gorkem commented Apr 7, 2022

LGTM in general one minor comment on the code. However I would like to change the name of the setting. As we seem to be getting more settings related to completions. Can we start to group such settings under suggest ? For this setting it would be something like yaml.suggest.parentSkeletonSelectedFirst.

@@ -589,7 +591,8 @@ export class YamlCompletion {
const lineContent = textBuffer.getLineContent(overwriteRange.start.line);
const hasOnlyWhitespace = lineContent.trim().length === 0;
const hasColon = lineContent.indexOf(':') !== -1;

const isNodeNull =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we initalize isNodeNull this early? Are there other places it is used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved it down neer to usage

@gorkem
Copy link
Collaborator

gorkem commented Apr 7, 2022

Also this one needs a rebase

@p-spacek
Copy link
Contributor Author

p-spacek commented Apr 8, 2022

LGTM in general one minor comment on the code. However I would like to change the name of the setting. As we seem to be getting more settings related to completions. Can we start to group such settings under suggest ? For this setting it would be something like yaml.suggest.parentSkeletonSelectedFirst.

I moved parentSkeletonSelectedFirst into the new suggest object

@msivasubramaniaan msivasubramaniaan merged commit da6d9bf into redhat-developer:main Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants