From: John Snow <jsnow@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: Call for Google Summer of Code 2021 project ideas
Date: Mon, 15 Feb 2021 16:47:05 -0500 [thread overview]
Message-ID: <1b44e8b8-62e8-876b-4bab-41645b1a52b9@redhat.com> (raw)
In-Reply-To: <cc4e606b-eb39-f423-f60b-fec7b622175c@redhat.com>
On 2/15/21 6:05 AM, Paolo Bonzini wrote:
> On 14/01/21 17:36, John Snow wrote:
>>
>>> The sane way to evade the language design problem is to use the existing
>>> QMP language.
>>
>> I wouldn't mind implementing this for version 0.1 -- just allow
>> copy-pasting JSON into the input bar -- it's a feature I wanted anyway.
>
> I think the only way out of language design is to instead design a TUI
> for inputting JSON. For example:
> > * after typing the ' for a key you can autocomplete the next field,
> using the TAB key similar to vi
>
> * after typing the : the TUI tells you the field type
>
> * after typing the ' for an enum, the TAB brings up a menu to pick an enum
>
> * after typing the last character in a key or value you automatically
> get a suggestion for what to type next (comma and next apostrophe after
> a value, colon and possible apostrophe/bracket/brace for a key)
>
> One idea that has worked for me in the past was to write a mockup that
> shows what things are going to look like, with fake user interaction.
> You would have something like
>
> // {
> keypress("{")
> show_suggestion("'")
> // '
> keypress("'")
> start_autocomplete_choices(["execute", "arguments"])
> // TAB
> await asyncio.sleep(1)
> do_autocomplete()
> // '
> await asyncio.sleep(1)
> keypress("'")
> // string argument, propose ' for the value automatically
> show_suggestion(": '")
> // TAB
> await asyncio.sleep(1)
> do_autocomplete()
> start_autocomplete_choices("query-status", "query-kvm") # many more
>
> etc.
>
> Then you plug in an incremental lexer, so that you can e.g. replace
>
> show_autocomplete(": '")
>
> with
>
> lex_state(Lexer.AFTER_KEY); // this would come from the lexer
> show_autocomplete("'") // this would come from the schema
>
> And then again plug the incremental visitor to autocomplete on the
> schema types.
>
> Another advantage of this approach is that you also have a natural API
> for the mocks, and thus it becomes easier to write testcases.
>
> Paolo
>
Yes, I follow.
I quite like the VSCode auto-suggest behavior for writing JSON when you
have a schema, but that's baked into their borg-cube, I assume.
I wonder if there's any libraries or more re-usable pieces out there
that would allow us to write a nice interactive TUI for complex
structures in Python, or if we'd have to design and build it ground-up.
Changes how willing I am to embark upon the quest.
--js
next prev parent reply other threads:[~2021-02-15 21:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 11:47 Call for Google Summer of Code 2021 project ideas Stefan Hajnoczi
2021-01-12 21:10 ` John Snow
2021-01-13 8:53 ` Stefan Hajnoczi
2021-01-13 18:59 ` qmp-shell TUI (was: Re: Call for Google Summer of Code 2021 project ideas) John Snow
2021-01-14 13:52 ` Stefan Hajnoczi
2021-01-14 13:59 ` Daniel P. Berrangé
2021-01-14 15:02 ` Kevin Wolf
2021-01-14 15:22 ` Daniel P. Berrangé
2021-01-14 16:49 ` Stefan Hajnoczi
2021-01-14 16:55 ` Daniel P. Berrangé
2021-01-14 17:14 ` Stefan Hajnoczi
2021-01-14 17:24 ` Daniel P. Berrangé
2021-01-14 16:48 ` Stefan Hajnoczi
2021-01-14 17:48 ` John Snow
2021-01-13 9:19 ` Call for Google Summer of Code 2021 project ideas Markus Armbruster
2021-01-13 19:05 ` John Snow
2021-01-14 12:29 ` Markus Armbruster
2021-01-14 14:57 ` Kevin Wolf
2021-01-14 16:36 ` John Snow
2021-01-15 16:31 ` Kashyap Chamarthy
2021-02-15 11:05 ` Paolo Bonzini
2021-02-15 21:47 ` John Snow [this message]
2021-02-12 13:22 ` [Rust-VMM] " Florescu, Andreea
2021-02-12 13:51 ` Sergio Lopez
2021-02-17 11:20 ` Stefan Hajnoczi
2021-02-18 11:49 ` Andreea Florescu
2021-02-18 17:43 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b44e8b8-62e8-876b-4bab-41645b1a52b9@redhat.com \
--to=jsnow@redhat.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).