Skip to content

Commit

Permalink
gen_vimdoc.py: mpack: collect functions in 1 dict
Browse files Browse the repository at this point in the history
All Nvim API, core Vimscript, and core Lua functions are globally
unique, so there is no need for per-module nested dicts.

BEFORE (generated mpack structure):
    [
      {
        "buffer.c": {
          "nvim__buf_stats": { ... },
          ...
        },
        "window.c": {
          "nvim_win_close": { ... },
          ...
        },
        ...
      }
    ]

AFTER (generated mpack structure):
    [
      {
        "nvim__buf_stats": {
          ...
        },
        "nvim_buf_attach": {
          ...
        },
        "nvim_tabpage_set_var": {
          ...
        },
        "nvim_ui_attach": {
          ...
        },
        "nvim_win_close": {
          ...
        }
      }
    ]
  • Loading branch information
justinmk committed Dec 22, 2019
1 parent f968dad commit 4657819
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions scripts/gen_vimdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ def gen_docs(config):
if p.returncode:
sys.exit(p.returncode)

fn_maps = {}
fn_map_full = {} # Collects all functions as each module is processed.
sections = {}
intros = {}
sep = '=' * text_width
Expand Down Expand Up @@ -800,7 +800,7 @@ def gen_docs(config):
title = '{} Functions'.format(name)
helptag = '*api-{}*'.format(name.lower())
sections[filename] = (title, helptag, doc)
fn_maps[filename] = fn_map
fn_map_full.update(fn_map)

if not sections:
return
Expand Down Expand Up @@ -833,7 +833,7 @@ def gen_docs(config):
fp.write(docs.encode('utf8'))

with open(mpack_file, 'wb') as fp:
fp.write(msgpack.packb(fn_maps, use_bin_type=True))
fp.write(msgpack.packb(fn_map_full, use_bin_type=True))

shutil.rmtree(output_dir)

Expand Down

0 comments on commit 4657819

Please sign in to comment.