nortakales / vs-code-qalc

Interactive scratchpad calculator for VS Code
MIT License
68 stars 2 forks source link

[Feature] Copy result #16

Closed shpoont closed 2 years ago

shpoont commented 2 years ago

Hi,

It would be great to be able to copy the result of calculation from a single line, it is currently a cumbersome process to get the value - we need to select the expression, copy with output to the clipboard, then copy to a different line, and then copy the result.

nortakales commented 2 years ago

Would your ideal solution be an action (with a keybinding) that copies only the result of the current line to the clipboard?

shpoont commented 2 years ago

I think the best solution would be if I could simply select and copy the result as with any other text.

nwehrle commented 2 years ago

All my development needs are satisfied with vscode and the right set of extensions. The only reason I prefer numi over qalc is the simple copy-to-clipboard mechanism. It does not have to be oneclick. But a simple select/copy would make your extension so much better. Can I bribe you with a coffee/beer?

nortakales commented 2 years ago

Due to how the results are displayed, I can't make them selectable (or, maybe I could, but through a pretty big refactor/rewrite of the entire extension). What I can do is look into including the results with the copied text as if it were selected. It could be controlled with a setting probably. I'm not yet sure if this is even feasible though. I'll have to see if VSCode has an extension API to access copy/paste. Would this be enough?

nwehrle commented 2 years ago

Hi and thank you for your anwer. How about a 2nd best or 3rd best option that may be easier to implement? 2nd: a command that copies only the result from the selected line (you seem to concatenate the copied line with the result in the code, maybe just omitting the line and the separator will do the trick) 3rd: typing "last" also copies the result to the clipboard

nortakales commented 2 years ago

A command to copy just the output to the clipboard will be in v0.1.11

nortakales commented 2 years ago

https://github.com/nortakales/vs-code-qalc/commit/3303711f8156ad079f8bd5fe6333aace50c933d5