vim-rfc icon indicating copy to clipboard operation
vim-rfc copied to clipboard

Suggest to support BCP

Open thawk opened this issue 3 years ago • 4 comments

Currently, vim-rfc supports RFCs and STDs. According to Best current practice - Wikipedia, there're BCPs, which refers to the most recent revision of the RFC/STD. I suggest to support BCPs.

thawk avatar May 05 '21 23:05 thawk

Is there evidence this doesn't presently support BCPs?

sigmavirus24 avatar May 06 '21 17:05 sigmavirus24

Yeah, only RFC and STDs so far.

But they really just get added as distinct entries, although STDs often refer to existing RFCs and vice versa (in that case they also have the same title):

    <std-entry>
        <doc-id>STD0006</doc-id>
        <title>User Datagram Protocol</title>
        <is-also>
            <doc-id>RFC0768</doc-id>
        </is-also>
    </std-entry>
[...]
    <rfc-entry>
        <doc-id>RFC0768</doc-id>
        <title>User Datagram Protocol</title>
        <is-also>
            <doc-id>STD0006</doc-id>
        </is-also>
    </rfc-entry>

Treating BCP entries as distinct makes even less sense, since they don't even have an own title anymore:

    <bcp-entry>
        <doc-id>BCP0006</doc-id>
        <is-also>
            <doc-id>RFC1930</doc-id>
            <doc-id>RFC6996</doc-id>
            <doc-id>RFC7300</doc-id>
        </is-also>
    </bcp-entry>

So, we'll need to come up with a good way to display these cross-references.

mhinz avatar May 06 '21 18:05 mhinz

Ah, didn't realize vim-rfc was going through the xml for this too. Thanks for the illustration

sigmavirus24 avatar May 06 '21 18:05 sigmavirus24

I feel urged to rework how this plugin works.

Nowadays, Vim/Nvim supports parsing JSON natively. The RFC index also changes really seldom.

What about just vendoring a properly parsed JSON cache file instead? Additionally, I'd put a Python script in the repo that's solely used for downloading the XML index file and building an updated JSON cache file from it.

For the user that would mean:

  1. No curl needed.
  2. No Python3 support in Vim needed.
  3. No cache file building.

Using the plugin for the first time in the Vim session, would make it load a huge glorius Vim dictionary from the JSON cache file.

The display wouldn't look different from what it looks right now. But entries with cross-references would be highlighted somehow or maybe a fancy Unicode character would make it clear that this entry has "more". Hitting <space> would then dynamically insert the cross-references below the current line (using the previously loaded Vim dictionary). Hitting <space> again would toggle it.

I could even add a GitHub Action that triggers via cron once a day, builds a cache file from a fresh index file and only if it differs to the vendored one, it automatically creates a new commit and pushes it. So, the users would always have an up-to-date cache file, as long as they keep their plugins updated.

Does this sound sane to you?

mhinz avatar May 06 '21 19:05 mhinz