vscode.printcode
vscode.printcode copied to clipboard
Added possibility to print only a part of document
New feature allows defining a region to be printed instead of a whole document. If tags are added in document (for example inside a comment) those tags mark region boundaries for printing.
- Using skip-before tag the code lines after the tag string will be printed.
- Using skip-after tag the start of the code will be printed up to but not including the tag string.
- Using both tags it's possible to print a specified region.
The tags can, but are not forced to, be inside a code comment. Currently following characters preceding the tags are understood as being part of the comment syntax: /*#'%!-
.
New settings:
-
useTrueLineNumbers
: When printing a region, don't start numbering from 1, instead show original line numbers (default:true
) -
skipBeforeTag
: Don't print anything before this string (default:PRINTCODE_SKIPBEFORE
) -
skipAfterTag
: Don't print anything after this string (default:PRINTCODE_SKIPAFTER
)
Thank you for creating a patch.
but, I think that we can not get the expected effect with this correction. There is no way to directly manipulate DOM with JS and CSS, but I do not want to do that.
see https://github.com/nobuhito/vscode.printcode/issues/15#issuecomment-425770890
This PR was not to mimick folding, but to give users an option to print a specific region. Currently there're two other ways to do it, but they are both cumbersome and give only partial solutions:
- Just hit print and try to guess (may take several guesses to get it right) which pages you need to select for printing. That way you get the code you wanted and some surrounding code on the first and last page you selected.
- Select a region, copy and paste to new document, hit save and give a name for this temporary document (so you get code colouring), then print the document (but not with original line numbers) and remove the temp doc.
Is there someone who needs this function? I think that I do not exist much.
Is it the license written at the beginning of the file?
This feature would be awesome! :) Right now I copy block of text to another file and print from there, so it would be very useful to print selection.