LScript Dev Pack

LScript NotePad++ addon

Tested in: NotePad++ 6.2.2
download LScriptDevPack
updated date: 24-Jan-2013

Language Syntax Coloring & Code-folding makes editing LScript a breeze. This is a tweak/modification of the original LScriptDevPack found in the Newtek forums.   It makes NotePad++ a better IDE to develop your Lightwave Layout or Modeler LScript in.  Auto-completion has not changed, however the Language Definition file & Syntax highlighting have been modified to:

  • provide proper code folding and
  • minor color changes to make comments and strings & other commands more readable (to me at least)

Code folding now works properly and is available on any code block delimited by curly braces { }  so that, for example, for & if statement blocks as well as all functions can independently (and when nested) fold up or expand as needed.

In addition, a new region folding marker has been added.  You can now mark any regions to fold (any regions at all – even ones containing other functions, comments etc) by marking the beginning of a line with //–> and the end of the region with //<–  Obviously, you need to make matching pairs of them to have them work properly.  For example:

//-->  ** My Region1 START **
myfunction1
{
    var a;
}
my function2
{
    var b;
}
//<--   ** My Region1 END **

 

installation

Installation for Notepad++ 6.2.2+ is as follows:

  1. It appears Auto-Completion is now included with the default install of Notepad++ so in theory, all you have to do is copy the lscript.xml file to C:\Program Files (x86)\Notepad++\plugins\APIs to get that to work
  2. Launch Notepad++ and in the menu select “Language > Define your Language” and a dialog appears where there is an Import button you can click to install the supplied file LScript language definintion for NotePad++.xml
  3. See Additional Tips below for an extra, unnecessary, but helpful, tweak to your context menu for Notepad++

 

additional tips & tricks

ADD FOLD ALL & UNFOLD ALL to your right-click context menu

Unfortunately there is no way to get Notepad++ to remember which sections in a file are folded next time you launch it, but adding these commands in your right-click context menu, along with now being able to fold any regions in one click, should make things easier.
Adding the commands “Fold All” and “Unfold All” to your right click menu, are often very helpful.  They are self explanatory and fold all the foldable sections in your code collapsing them up, or expanding all of them in one click.  You can collapse everything and just expand as you work on things, collapsing up when you want to de-clutter the editor while working.

To add this functionality, go to the Notepad++ menu  “Settings > Edit Popup Context Menu”  and insert these lines into the file where you like them and Save & Close that file after doing so.  You will need to restart Notepad++ to get them to appear in the menu.  I usually like them after the “Cut,Copy,Paste,Delete,Select All” section.  This should only change the context menu for the current user since the contextMenu.xml file gets edited in your AppData/Roaming folder.

<!-- id="0" is the separator -->
<Item id="0"/>
<Item MenuEntryName="View" MenuItemName="Fold All"/>
<Item MenuEntryName="View" MenuItemName="Unfold All"/>

Be careful not to break that context.xml file with other edits or you may need to reinstall NotePad++ to get the context menu to work correctly if you malform the xml with erroneous edits.

DON’T FORGET ABOUT the DOCUMENT MAP feature

Alot of people I see using Notepad++ aren’t aware of the document map feature.  In Notepad++’s menu, click “View > Document Map” to show it. It gives you a heads up navigation of your whole file which makes it easier to jump to a spot at a glance of your document zoomed way out.

DON’T FORGET ABOUT the CLONE TO OTHER VIEW feature

Again, this is a somewhat hidden feature which is often useful.  Right-click on the tab for your open document and select “Clone to Other View” from the popup menu.  This opens your same document into a second view (there is ONLY one copy of it – it is the exact same document) into another docked tab so you can scroll to 2 different parts of the same document at the same time and look at different parts of the same document simultaneously.

 

(These files are provided as is, there is no guarantee implicit or explicit that they will work on your system.
Big thanks to dballesg for allowing me to redistribute this modified version!!  Only distribute this file with permission from Newtek Lightwave forum member  dballesg.)

 

changelog
24-Jan-2013
  • added missing ctlfoldername keyword
20-Jan-2013
  • minor typo fix to SETTINGSDIR keyword
Dec-2012
  • initial release

Leave a Reply

Your email address will not be published. Required fields are marked *

*