Using code snippets from hard drive using Snippet Manager

For other topics related to the FreeBASIC project or its community.
Trinity
Posts: 214
Joined: Sep 16, 2017 17:07

Using code snippets from hard drive using Snippet Manager

Postby Trinity » Sep 28, 2017 18:20

Hi everyone ,
First of all then most of you who have programmed in many years probably already have the thing with code snippets taken care so this post is for the less experienced that have not ;-)

I already have so many code snippets made that I have come to find it difficult or annoying to navigate it all , with to many snippets pasted into code only to be REM'ed out and other code snippets saved to drive with each it's own file title. It all simply becomes too much. I don't want to have to save every little piece of it to drive in it's own little file and also I have too many to want to look through more whole code listing that I have used for copy and paste every time. So I went looking for a free code snippet manager. Most of the code snippets managers are for pro's and people that likes to save snippets on-line , I however prefer a desktop application that saves my code to my drive.

After a good deal of searching I found this program Snippet Manager : http://www.snippetmanager.net , which seem to do the trick , though it needs a little tweaking imo . If anybody else wants to use that program as a snippet manager working with FreeBASIC then here is a description of what I did (some tips) :

I did not want the setting of server for up and download of snippets so I went to settings and removed the download server address.
In the directory C:\Program Files (x86)\Snippet Manager\Snippets (on Windows 7 , 64bit otherwise maybe elsewhere) I renamed all files except "search" and "www.snippetmanager.net_update" - reason for doing so was that I wanted a fresh slate so to speak and among other that I didn't want all the snippets that came with the program and I found all the stuff listed in the program interface annoying. (remember to exit program before renaming or deleting files)
Also the program do not have FreeBASIC on it's language list , so what I did was to spot what to do to make it do so. And it's all put into the directory C:\Program Files (x86)\Snippet Manager\SyntaxFiles (on Windows 7 , 64bit otherwise maybe elsewhere) . To make the program get FreeBASIC on list one simply needs to make a SyntaxFile for FreeBASIC. I did a quick and basic hack on a *COPY* of the TEXT version of the files and saved it with the name FreeBASIC and I hope that I got it right - at least it seem to work fine for me (what I did were to replace the reference to the expression "Text" with the expression "FreeBASIC" where I found it *appropriate* and replaced reference to extension .txt to that of .bas. Maybe other can do better - if then you are welcome.

Also if anybody wants to have some of the languages vanish from the languages list when adding new snippets then I think that all you have to do is to take the SyntaxFile for that/those languages and delete them or drop them into a new sub directory where program do not see them.

To make a FreeBasic.syn file for the program then just save this code to file with the name FreeBASIC.syn and place in the directory C:\Program Files (x86)\Snippet Manager\SyntaxFiles (on Windows 7 , 64bit otherwise maybe elsewhere) . After this and above adjustments you ought to be good to go :-)

P.S. please remember that renaming and moving unwanted files rather than deleting them allows for you to effortlessly to revert what you did ;-) (to the extend that your actions did not make mark on other stuff/files not backed up)


Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<Language Name="FreeBasic" Startblock="FreeBasic">
<FileTypes>
   <FileType Extension=".bas" Name="FreeBasic file"/>   
</FileTypes>

   <Block Name="FreeBasic" Style="Text" PatternStyle="CS Keyword" EscapeChar="" IsMultiline="true">



      <!-- Keywords that can exist inside this block -->
      <Keywords>
         <PatternGroup Name="Keywords" Style="CS Keyword">
         </PatternGroup>
      </Keywords>
      <!-- Operators that can exist inside this block -->
      <Operators>
         <PatternGroup name="URL" Style="CS URL">
            <Pattern Text="http://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?" IsComplex="true" />
         </PatternGroup>
      </Operators>
      <!-- Blocks that can exist inside this block -->
      <ChildBlocks>
         <Child Name="CS String" />
      </ChildBlocks>
   </Block>

   <Block Name="CS String" Style="CS String" PatternStyle="" EscapeChar="\" IsMultiline="false">
      <Scope Start="&quot;" End="&quot;"    Style="CS String"  Text="" />
      <Operators>
         <PatternGroup name="URL" Style="CS URL">
            <Pattern Text="http://([\w-]+\.)+[\w-]+(/[\w- ./?%&amp;=]*)?" IsComplex="true" />
         </PatternGroup>
      </Operators>
   </Block>
   
   <Style Name="Text" ForeColor="" BackColor="" Bold="false" Italic="false" Underline="false" />
   <Style Name="CS String" ForeColor="Black" BackColor="" Bold="True" Italic="True" Underline="false" />
   <Style Name="CS Operator" ForeColor="Red" BackColor="" Bold="false" Italic="false" Underline="false" />
   <Style Name="CS Keyword" ForeColor="Blue" BackColor="" Bold="true" Italic="false" Underline="false" />
   <Style Name="CS URL" ForeColor="Blue" BackColor="" Bold="false" Italic="false" Underline="true" />
</Language>
Last edited by Trinity on Sep 30, 2017 8:23, edited 2 times in total.
nimdays
Posts: 180
Joined: May 29, 2014 22:01
Location: ID

Re: Working with code snippets from hard drive

Postby nimdays » Sep 28, 2017 22:31

Thanks for sharing, 370kb is small.
Kuron
Posts: 30
Joined: Jul 26, 2005 3:22
Location: Nashville

Re: Using code snippets from hard drive using Snippet Manager

Postby Kuron » Oct 24, 2017 9:34

Thank you, Trinity. Good find!!!

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests