<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Vscode on Janusworx</title>
    <link>https://janusworx.com/tags/vscode/</link>
    <description>Recent content in Vscode on Janusworx</description>
    <image>
      <title>Janusworx</title>
      <url>https://janusworx.com/images/jw-logo.png</url>
      <link>https://janusworx.com/images/jw-logo.png</link>
    </image>
    <generator>Hugo -- 0.157.0</generator>
    <language>en</language>
    <lastBuildDate>Mon, 16 Aug 2021 15:18:10 +0530</lastBuildDate>
    <atom:link href="https://janusworx.com/tags/vscode/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Multiline Regex Search in VS Code</title>
      <link>https://janusworx.com/work/multiline-regex-search-in-vs-code/</link>
      <pubDate>Mon, 16 Aug 2021 15:18:10 +0530</pubDate>
      <guid>https://janusworx.com/work/multiline-regex-search-in-vs-code/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://janusworx.com/images/2021/kindle-notes.png&#34;&gt;&lt;img alt=&#34;picture of notes imported from an amazon kindle in vscode&#34; loading=&#34;lazy&#34; src=&#34;https://janusworx.com/images/2021/kindle-notes.png&#34;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;hr style=&#39;margin-left: auto; margin-right: auto;margin-bottom: 40px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;&#39; /&gt;  
&lt;p&gt;This is a picture of my notes, when I import them in from the Kindle.&lt;br&gt;
And every time I have to corral them into some sort of structure or write a blog post, I needed to laboriously get rid of all the Kindle metadata with multiple searches (and replaces.)&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p><a href="/images/2021/kindle-notes.png"><img alt="picture of notes imported from an amazon kindle in vscode" loading="lazy" src="/images/2021/kindle-notes.png"></a></p>
<hr style='margin-left: auto; margin-right: auto;margin-bottom: 40px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;' />  
<p>This is a picture of my notes, when I import them in from the Kindle.<br>
And every time I have to corral them into some sort of structure or write a blog post, I needed to laboriously get rid of all the Kindle metadata with multiple searches (and replaces.)</p>
<p>I mean these lines</p>
<pre tabindex="0"><code>==========
Draft No. 4 (John McPhee)
- Your Highlight on page 27 | location 406-407 | Added on Sunday, 15 August 2021 12:43:15
</code></pre><p>But having <a href="https://janusworx.com/blog/python-regular-expressions-real-world-projects/">learnt Regex</a> about a year ago, I have been using it on and off and have come to appreciate the power it offers.<br>
And I’ve been increasingly trying to solve all of my text search issues using regex, everywhere.<sup id="fnref:1"><a href="#fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></p>
<p>With a recent book, I managed to <a href="https://cb.janusworx.com/notice/A7nXyrNLRp2VvF2ceu">use regex</a> to get rid of single lines all at once.<br>
It still took me 3 sets of search and replaces though.<br>
So today, I got lazier and curiouser and wondered if I could do all three lines together.<br>
I was trying combinations of <code>/g</code> and <code>/gs</code> to somehow get the regex engine to span lines, but no dice.<br>
A bit of web surfing led me to <a href="https://code.visualstudio.com/updates/v1_29#_multiline-search">this post</a> which told me that, all I needed to do was match newline literals <code>\n</code><br>
This led, to me tinkering and coming up with this search regex<br>
<code>==========[\n\s]D.*[\n\s]-.*</code><br>
Which led to …</p>
<hr style='margin-left: auto; margin-right: auto;margin-bottom: 40px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;' />
<p><a href="/images/2021/kindle-notes-2.png"><img alt="picture of notes imported from an amazon kindle in vscode with search results" loading="lazy" src="/images/2021/kindle-notes-2.png"></a></p>
<hr style='margin-left: auto; margin-right: auto;margin-bottom: 40px; width:100px; border: none; background-color:rgb(238, 238, 238); color: rgb(238, 238, 238);  height: 1px;' />  
<p>matching everything in one fell swoop!<br>
All hail the power of regex!</p>
<br>
P.S. Subscribe to my [mailing list][1]!  
Forward these posts and letters to your friends and get them to subscribe!  
P.P.S. Feed my [insatiable reading habit][2].   
<div class="footnotes" role="doc-endnotes">
<hr>
<ol>
<li id="fn:1">
<p>(emphasis on trying. I’m no regex genius)&#160;<a href="#fnref:1" class="footnote-backref" role="doc-backlink">&#x21a9;&#xfe0e;</a></p>
</li>
</ol>
</div>
]]></content:encoded>
    </item>
    <item>
      <title>Programming, Day 3, Setting up VS Code to launch from the Command Line in OS X</title>
      <link>https://janusworx.com/work/programming-day-3-vscode-command-line-osx/</link>
      <pubDate>Tue, 05 Jun 2018 08:44:42 +0530</pubDate>
      <guid>https://janusworx.com/work/programming-day-3-vscode-command-line-osx/</guid>
      <description>&lt;p&gt;Problem:&lt;br&gt;
I wanted to launch Microsoft’s Visual Studio Code from the command line at will.&lt;/p&gt;
&lt;!-- TEASER_END --&gt;  
&lt;p&gt;What I did:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Launch VS Code&lt;/li&gt;
&lt;li&gt;Hit cmd-shift-p (⌘-⇧-P)&lt;/li&gt;
&lt;li&gt;Begin to type Shell … and choose and execute “Shell Command: Install &amp;lsquo;code&amp;rsquo; command in PATH”&lt;/li&gt;
&lt;li&gt;Launch Terminal and check to see if VS Code launches by typing the &lt;code&gt;code&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;Edit the &lt;code&gt;.bash_profile&lt;/code&gt; file in the home folder and change the &lt;code&gt;$EDITOR&lt;/code&gt; variable like so …&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;code&gt;# Setting Visual Studio Code as $EDITOR&lt;/code&gt;&lt;br&gt;
&lt;code&gt;export VISUAL=code&lt;/code&gt;&lt;br&gt;
&lt;code&gt;export EDITOR=&amp;quot;$VISUAL&amp;quot;&lt;/code&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Problem:<br>
I wanted to launch Microsoft’s Visual Studio Code from the command line at will.</p>
<!-- TEASER_END -->  
<p>What I did:</p>
<ol>
<li>Launch VS Code</li>
<li>Hit cmd-shift-p (⌘-⇧-P)</li>
<li>Begin to type Shell … and choose and execute “Shell Command: Install &lsquo;code&rsquo; command in PATH”</li>
<li>Launch Terminal and check to see if VS Code launches by typing the <code>code</code> command.</li>
<li>Edit the <code>.bash_profile</code> file in the home folder and change the <code>$EDITOR</code> variable like so …</li>
</ol>
<p><code># Setting Visual Studio Code as $EDITOR</code><br>
<code>export VISUAL=code</code><br>
<code>export EDITOR=&quot;$VISUAL&quot;</code></p>
<p>And that should just about do it.</p>
<p>Restart the terminal or source the bash_profile file for changes to take effect.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
