none
How to Copy Code from a Code Block?

Answers

  • John Saunders said:

    How should we copy code from a code block? When someone sends me a WSDL (see http://forums.msdn.microsoft.com/en-US/asmxandxml/thread/5546f4ac-240d-4110-9889-8a893bf1ef1d), I'd like to be able to copy it and try it out.

    Surely it would be good to be able to copy code snippets?


    Use File->New Project to create Web Service Projects



    John,
    Currently you have to select the code snippet and then right click and select Copy.

    We are looking to add a 'Copy Code Snippet' link in a future release, which will copy the code snippet to the clipboard and remove any line numbers that were added.
    Thanks,
    Carl Prothman
    STO Forums - Software Development Engineer 2
    • Edited by carlpro Friday, June 6, 2008 3:41 PM Update reply
    • Marked as answer by John Saunders Friday, June 6, 2008 4:27 PM
    Friday, June 6, 2008 3:37 PM

All replies

  • John Saunders said:

    How should we copy code from a code block? When someone sends me a WSDL (see http://forums.msdn.microsoft.com/en-US/asmxandxml/thread/5546f4ac-240d-4110-9889-8a893bf1ef1d), I'd like to be able to copy it and try it out.

    Surely it would be good to be able to copy code snippets?


    Use File->New Project to create Web Service Projects



    John,
    Currently you have to select the code snippet and then right click and select Copy.

    We are looking to add a 'Copy Code Snippet' link in a future release, which will copy the code snippet to the clipboard and remove any line numbers that were added.
    Thanks,
    Carl Prothman
    STO Forums - Software Development Engineer 2
    • Edited by carlpro Friday, June 6, 2008 3:41 PM Update reply
    • Marked as answer by John Saunders Friday, June 6, 2008 4:27 PM
    Friday, June 6, 2008 3:37 PM
  • Thanks, Carl, that's what I was afraid of.

    You may want to add to the tooltip over the checkbox for adding line numbers a message that they will become part of the snippet itself and will be copied along with it.

    Use File->New Project to create Web Service Projects
    Friday, June 6, 2008 4:28 PM
  • A better way would be to enable the user to toggle line number display in the message view. That way they can copy it themselves without you needing to add line number parsing code, or any crazy JS stuff like that.
    • Proposed as answer by carlpro Sunday, June 8, 2008 4:45 AM
    Sunday, June 8, 2008 1:56 AM
  • If they were to mark-up the line numbers when added to the code block, they'll be able to remove them easily:

    <div title="line 100"><span class="linenumber">100</span> This is a line</div> 
    <div title="line 101"><span class="linenumber">101</span> This is a second line</div> 
     

    Use File->New Project to create Web Service Projects
    • Proposed as answer by carlpro Sunday, June 8, 2008 4:45 AM
    Sunday, June 8, 2008 3:08 AM