Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to print unsaved text #31

Closed
CheckeredFlag opened this issue Jun 19, 2019 · 5 comments
Closed

Add ability to print unsaved text #31

CheckeredFlag opened this issue Jun 19, 2019 · 5 comments

Comments

@CheckeredFlag
Copy link

It appears that saving a file is required before the print icon becomes available. However, there are times when I simply need to print a temporary snippet of text (e.g. sql query results, error message) and I don't need nor want to save the file. If a file on disk is absolutely necessary, perhaps it can save it to a temp file that it can delete later.

@PeterWone
Copy link
Collaborator

PeterWone commented Jun 19, 2019

I have reproduced this behaviour.

I don't use a file directly unless you print a document other than the active document using the file explorer. The problem you are seeing is a consequence of the way VS Code manages menus and toolbars -- it needs to know the file type, and this is inferred from the file extension, which depends on the file existing.

Think through the behaviour you expect in the absence of a file type, and we can discuss supporting your use case.

Without type you won't get syntax colouring. This is why I usually create a file called junk.sql and paste snippets of SQL into it, then select them and print the selection. This gives me syntax colouring.

Currently this produces line numbers matching the junk file unless I turn off numbering. If you do it a lot and you don't want numbering I could add a context menu item Print without numbers

@CheckeredFlag
Copy link
Author

It should print without syntax coloring by default (i.e. Plain Text). If I want language support such as syntax coloring, then I just click "Plain Text" in the lower right corner next to the smiley face and select the desired language.

I think by default unsaved buffers ought to print without line numbers. Perhaps a context menu option or a default setting would be good.

@PeterWone
Copy link
Collaborator

I'm currently in the middle of internationalising the extension so it may be a while before I have time to deal with this. I have a feeling it's one of those small things with far-reaching effects -- I will no longer be able to let VS Code manage the UI automatically.

@PeterWone
Copy link
Collaborator

I think I may have a solution. Would you mind testing 0.7.5 and if it solves your problem let me know by closing this issue.

@CheckeredFlag
Copy link
Author

Perfect - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants