PDA

View Full Version : LScript DevPack update for Notepad++



sami
12-16-2012, 10:50 PM
Forum member dballesg (who originally distributed this little add-on for Notepad++ to help with LScript coding in it) has graciously allowed me to post my updated version of it with the following tweaks which have made it more useful for me. I'll include my portion of the new ReadMe file below to explain the changes/additions:

LScriptDevPack for Notepad++ UPDATED: 17-Dec-2012

This is a tweak/modification of the original LScriptDevPack. It has been tested with NotePad++ 6.2.2. Auto-completion has not changed, however the Lanugage Definition file & Syntax highlighting have been tweaked to:

a) provide proper code folding and
b) 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 delimeted 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.

Also 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 is slighty different for 6.2.2+ because Notepad++'s menus have changed since then.

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:
=========================
1) FOLD ALL & UNFOLD ALL
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.

2) 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.

3) 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.

--------------

109922

This files are provided as it is, there is no guarantee implicit or explicit that they will work on your system.

Only distribute them with permission from forum member dballesg. You have my permission to distribute any of my changes to these original files.

Hope this is useful!
sami

Dodgy
12-17-2012, 09:40 PM
Thanks very much for this, I usually use Context, but code folding could make me switch!

mikadit
12-21-2012, 04:37 AM
Installed immediately. Very nice!
Thank you very much!

sami
01-15-2013, 08:56 AM
I've decided to delete the attachments that I've been posting to the forums and host them myself so that my plugins & shared content can easily be found in one place. I've also added them to the LWPluginDB with tags and info.

If you are looking the updated LScript Dev Pack, which is the NotePad++ syntax coloring and code-folding addon for Lscript I've mentioned in this thread, you can now find it here (http://phtn.me/appslscriptdevpack). :)

nickdigital
01-18-2013, 03:16 PM
Just got this installed.

Thank you sami!

nickdigital
01-18-2013, 06:47 PM
SETTINSDIR should be SETTINGSDIR

I changed this in both xml files but it's not updating in my notepad++.

sami
01-19-2013, 06:27 AM
oops. will update this. thanks!

Be sure you updated the Lscript setting from the Language menu and not a new entry. The interface in notepad++ is a little odd in that window and it's a slight bit ambiguous what you are editing when you make a change. That's probably way your change didn't get reflected - because you probably made the change in a copy of the Lscript language definiton but then the old one was still applied to your file?

EDIT: It's now fixed on my site (http://apps.photonstudios.com/downloads/lscript-dev-pack)

RebelHill
01-20-2013, 06:36 AM
grrr... 404 for the download.

sami
01-20-2013, 06:41 AM
Are you sure? Try again after clearing your cache. It seems ok here.
I redirected the link to the new zip file maybe yours is pointing to the old one cuz you downloaded it before?

RebelHill
01-20-2013, 07:05 AM
Aha... got it. Interestingly Id not downloaded the dec version, so not sure why that happened. btw... how's folding supposed to work here? If click any of the sidebar -'s to collapse a region, it collapses everything below it..

edit... nevermind... shoulda removed the old version first. btw... horrible new colours... how can I change em?

edit 2... ahh found that too... awesome.

sami
01-20-2013, 07:19 AM
on tablet at the mo' so can't make notepad++ screenshots, but it works like this:

Main colors are in the main Settings Preferences section - these tend to be common colors between languages, then to change the colors of the Lscript stuff, go to Language > User Defined Language and then in the drop down on that dialog, select the previously imported LScript setting, and toggle through the screens there. Each section has its own colors and a button to change them. I suspect you don't like my comment colors and string colors.

I like em so I can see em better separated from other code. You can see the comment section and turn off background color or whatever and also the Delimiters section is where the strings " colors are. Change that there. If you can't figure it out, tell me what colors you want and I'll change them and post another.

sami
01-20-2013, 07:22 AM
I'm also looking at adding support for the Notepad++ SourceCookiefier plugin which would give a panel with jumping to function definitions etc. Just have to find the time to check out that plugin's docs to make an XML to add that function and variable definition navigation too...

RebelHill
01-20-2013, 10:54 AM
Noted a bit of a miss that it makes in assessment of brace pairs.. {}

for instance...

func:
{
if(something)
{
doSomething;
}
}

works fine... but...

func:
{
if(something)
{doSomething;}
}

Doesnt... it mixes up which in-brace pairs with which out-brace.

sami
01-20-2013, 11:08 AM
This is all part of my global plan to stop coders everywhere cuddling their curlies! :devil:
That's so unreadable that way to me..., I find it a million times easier to just glance at code and see code blocks when they're on their own line (hence the nice drawn vertical lines from brace to brace that most editors do when you stack them like that).

That being said, I guess it boils down to personal preference if you wanna cuddle your braces, all power to ya, and I guess I didn't notice this issue with the code folding because I like em spread out on their own lines and lined up vertically. Sorry, about missing that, but I'll bet it's a limitation of the regex way Notepad++ does its language definitions. And I'm not quite sure how to fix that in Npp. Any ideas? I recall somewhere on a sourceforge forum reading it was in a feature request, but I'm not sure..

RebelHill
01-20-2013, 11:21 AM
I like it where Ive got some if/else/while with only 1 line to execute... just a packing preference... but that's the extent of it for me, not like a lot of LS's Ive seen with braces all over the shop.

As for fixes... no clue, but the previous version of devPack (DBs i believe it must've been) recognised the pairing no prob.

sami
01-20-2013, 12:25 PM
If it's just one line you don't need braces on an if. But I guess existing code like you have above will still get screwed up with code folding in that case. And I'm fairly certain the last devpack only had code folding on things like editbegin - I recall having to add curly brace code blocks to the mix.. Not sure there is much I can do - though I'll check out the Npp forums and see if I can get any ideas.

nickdigital
01-22-2013, 09:33 PM
I think ctlfoldername is missing too.

sami
01-23-2013, 05:40 AM
I'll add that too. Initially I just took dballseg's version and changed the code folding. Sorry I haven't had the time to compare it to the docs and adendums..

Edit: download is updated on my site

nickdigital
01-23-2013, 11:00 AM
I'll add that too. Initially I just took dballseg's version and changed the code folding. Sorry I haven't had the time to compare it to the docs and adendums..

Edit: download is updated on my site

I get a 404 error with the d/l link.

sami
01-23-2013, 03:39 PM
I'm using a redirector for the link, seems when I change the file if you've downloaded it before, your browser cache is pointing to the wrong file. If you clear your browser cache and try again it will be fine. Tho I'll try and get the link to force refresh next time.

nickdigital
01-23-2013, 03:42 PM
Thanks that fixed it.