title: Using Python or TypeScript to transform text that I select in VSCode
body: <p>Let's say I select some text in the editor.  I would like to define my own Python functions or scripts that:</p>
  
  <ol>
  <li>Take as an input the selected text as a string.</li>
  <li>Transform it and return a new string that replaces the selected text back in the editor</li>
  </ol>
  
  <p>Moreover, I would like to ideally register these functions or scripts as a VSCode commands (with a specific <code>commandID</code>s) that I can define myself and to the command palette in VSCode. By doing so, I can bind them to a shortcut in <code>keybindings.json</code> with specific shortcuts and when clauses.</p>
  
  <hr>
  
  <p>Is there any built-in functionality in VSCode to do this? If not, what set of steps can I follow to do it?</p>