iqsharp
iqsharp copied to clipboard
In Python+Q# notebooks, error messages point to line numbers off-by-one
Describe the bug
In Python+Q# notebooks (both local and hosted on Azure Quantum), error message points to the line number off-by-one due to %%qsharp magic command taking up the first line. (Same as https://github.com/microsoft/QuantumKatas/issues/658.)
To Reproduce
Run any %%qsharp cell with a compilation error in it.
Expected behavior Displayed line numbers should match the ones where the error is.
Thanks for pointing this out. At the moment, we don't have a mechanism to set the line offset based on how the code was passed. I agree it'd be worth adding, but it may take a little bit of work to plumb that through Jupyter executions so as to make sure that the final compilation has that context. We'll try to take a look at this, then. Thanks!
Would a simple workaround like appending an empty string to the code in the %%qsharp magic command before it's passed on to compilation work?
Ah, fair point— it may yeah... can look at that soon, then, hopefully.