iqsharp icon indicating copy to clipboard operation
iqsharp copied to clipboard

Add type signatures to the built-in help command

Open guenp opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. Currently, the built-in help command invoked with ? only returns the Operation or Function name and docstring but not the type signature.

Describe the solution you'd like I'd like to be able to see the type signature in the notebook instead of having to browse the docs to find them.

Describe alternatives you've considered

Additional context Screenshot: MicrosoftTeams-image

guenp avatar Feb 22 '22 19:02 guenp

Thanks for filing this! I think we should do this, but that would take adding an API to the qsharp-compiler repo (or exposing it if it already exists) to reconstruct the declaration syntax from a CallableDeclarationHeader.

To drill down a bit, the way ? works in jupyter-core and hence IQ# is to return a code symbol as a displayable object, and then use display encoders to render that into HTML, plain text, and so forth. IQ# already has a display encoder for Q# symbols, formatting them from the metadata contained in IQSharpSymbol. That class includes metadata automatically generated from documentation comments (https://github.com/microsoft/iqsharp/pull/334), but at the moment there's no way to go back to Q# syntax data without using internal-only syntax generation methods.

@bettinaheim, would it be reasonable to expose some of the methods used in documentation generation for reproducing declaration syntax so that we can implement this suggestion?

Short of that, I think we should be able to pull at least some Markdown content from existing attributes and APIs:

image

cgranade avatar Feb 22 '22 21:02 cgranade