Skip to content

docgen should index importc name #16430

@timotheecour

Description

@timotheecour

docgen should index importc name (and importjs, importcpp etc)

Example

# main.nim
proc foo*(frmt: cstring): cint {.importc: "printf", header: "<stdio.h>", varargs, discardable.}

Current Output

nim doc --project --outdir:/tmp/d23 main
python3 -m http.server 7031 --directory /tmp/d23
open http://localhost:7031/t11555.html

  • P1: in search box, type printf: no search results
  • P2: use browser, search for printf: no search results unless you expand the pragma which is collapsed by default
  • P3: theindex.html has no entries for printf

Expected Output

printf shows up for P1, P2, P3

Possible Solution

automatically add importc name via idx: docgen feature or via some other way

Additional Information

1.5.1 297c8e4

This also came up here: I think official sdl2 nim lib is chaos. - Nim forum

with this feature, we'd be able to search for an importc name in docs (eg SDL_RenderSetLogicalSize) and it'd show the corresponding nim symbol setLogicalSize, defined as:

proc setLogicalSize*(renderer: RendererPtr; w, h: cint): cint {.
  importc: "SDL_RenderSetLogicalSize".}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions