Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

TextMate - LSL Language definition file (For Mac users ;-))

Piero Padar
#
Join date: 26 Aug 2005
Posts: 42
12-28-2007 06:02
Updated adding llGetObjectDetails, its constants and last lslint. Minor improving of syntax check shell script.
:D
# Piero
Piero Padar
#
Join date: 26 Aug 2005
Posts: 42
12-28-2007 06:16
From: Cylence Quine
I'd LOVE to see a screencast of that, Piero!! Thanks for keeping the Textmate bundle up to date!! And thank you, Leon Ash, for putting it together in the first place. :D

A "screencast" of the bundle (just some features) is here:
http://digilander.libero.it/usemac/lsl.mov

Instructions and all you need to setup a web server for SL in minutes are here:
http://digilander.libero.it/usemac/slweb/

Sorry for this update delay! I was busy editing support stuff for my sitter:
http://digilander.libero.it/usemac/psit2.html

:D

# Piero
Piero Padar
#
Join date: 26 Aug 2005
Posts: 42
Added a color picker
05-12-2008 01:05
Have fun :D

#Piero
Anthony Hocken
Registered User
Join date: 16 Apr 2006
Posts: 121
01-30-2009 05:20
Been trying out TextMate and I have to say it's the most uninviting code editor I've ever used. I'm grateful for Piero sharing his Bundle, and once I get past the initial hurdles I'm sure it'll be a great editor, but first off, what's with all the red highlighting when the syntax is perfectly valid. This is what I see:

http://tr.im/8jq2

Okay, I can shuffle the layout to remove the red markers as follows

http://tr.im/8jqk

...but why should I. It's perfectly valid either way and I don't fancy adjusting my coding style to fit someone elses. At the very least how do I turn this highlighting off? It's flawed and distracting at best. Especially when the red highlights appear on-the-fly as I'm typing.

Okay I could get my hands dirty right off the bat and edit the regular expressions in the Bundle. But this is basic stuff, why should I even have to! this should be reserved for advanced stuff later on surely. I just want a workable setup from the outset so I can get on with stuff.

If I get the patience I might do my own based on the C/C++ bundle, because all the issues should already be addressed there I'd have thought. Blank lines are invalid. If I align comments the extra spaces are invalid. If I exclude the braces (for a single line) after a conditional/for-loop it's invalid. Sorry, just all too rigid for me.

Any help appreciated.

Incidentally I share Gwyneth Llewelyn's sentiments about this so I hope I don't get made fun of like she did! I shouldn't have to dive into a page full of reg exp to configure the basics.

EDIT: figured out the color settings soon after positing so disregard that. That just leaves the red highlighting now.
_____________________
Piero Padar
#
Join date: 26 Aug 2005
Posts: 42
suspect syntax
01-30-2009 07:34
From: someone
EDIT: figured out the color settings soon after positing so disregard that. That just leaves the red highlighting now.

See the included color scheme (made to be modified) on the "suspect" entry...
You can use the "code cleanup" of the bundle too:

default {
state_entry() {
llSay(0, "Hello, Avatar!";);
}
touch_start(integer total_number) {
llSay(0, "Touched.";);
}
}

this bundle was made for this kind of indentation (tabs don't show right here on forum).

# Piero
Adam Marker
new scripter
Join date: 2 Jan 2004
Posts: 104
bundles vs. color themes vs. coding style
01-30-2009 09:31
Heh, I sympathize with your issues, Anthony. Stuff really should "just work", but unfortunately there are a lot of cooks stirring a broth like this one. TextMate is just sooooo (too?) flexible.

-- executive summary --
I use the (wonderful) LSL bundle and have Lots of blank lines -- but I've never seen them marked as "invalid". The Font & Color Theme I use doesn't have a catch-all red background for "Invalid". My suggestion: try some of the other Themes under Preferences, Fonts & Colors. I tried some and "Slush & Poppies" might be good if you like a light screen, try "Twilight" for a dark screen.

-- gory details --
Overall, you need to figure out if TextMate is a good editor for you. It certainly isn't for everyone, and I'm glad that there are lots of choices out there. But please don't discard it based on experience with one language -- at least not until you've aired your issues someplace where we can help. uhmmm. good job!

Piero's (wonderful) LSL bundle was made for a certain style of code formatting. If you use a different style, there might be some conflicts. Only a few editors I've seen (like Eclipse for Java) allow you to set preferences like "space after brackets?" and the like. http://img.skitch.com/20090130-frnfg9ptc1pct9yedn4jh9x251.jpg But all is not lost; that infernal TextMate flexibility can resolve issues as quickly as it creates them (sometimes).

A TextMate language "bundle", like the one for LSL, uses regular expressions to assign one or more "scopes" to each bit of text. If that scope can be found in the current "theme", the corresponding color/style is applied to the text. If the results are not what you want, there are a couple of places to apply a "fix".

One fix is to use Piero's LSL Font and Color Theme. Since they were made for each other, that might make things better. If not, trying different built-in Themes is a good option, since each defines the "scopes" slightly differently.

In this particular case, the bundle assigns blank lines to the scope invalid.suspect.source.empty.line.lsl. When TextMate finds the "Invalid" scope in the "Mac Classic" theme, Red You Get! Note: you don't have to dive into the regex to figure this out. Place your cursor before any character and choose Bundle Development/Show Scope from the gear menu in the status bar, or press ctrl-shift-P -- and the scope will be displayed in a popup.
http://img.skitch.com/20090130-ch8j4wfks45tnrnqejbp29saiw.jpg

Probably the cleanest solution here is to make a copy of your favorite Theme (Choose "Edit Theme List... in the Themes menu), then customize it whenever you find an annoyance. You could start with any Theme, but you might *try* Piero's LSL Theme for more compatibility. In this case, if you were determined to use the Mac Classic Theme with its Invalid Red, you'd need to get more specific about what is really invalid. Add an element called "Invalid - Suspect" (can be any text), give it a scope selector of "invalid.suspect" (exact text), and choose unstyled black on white. Using a shortened selector like this overrides the generic "invalid" selector and gloms onto any scope that starts with "invalid.suspect".

I know all these gory details probably aren't what you wanted to hear, but when you use a (lovingly) user-developed piece of software (the LSL bundle), it happens sometimes. TextMate is a hacker's editor, and the hackers do hack.
Anthony Hocken
Registered User
Join date: 16 Apr 2006
Posts: 121
01-30-2009 20:01
Thanks for that Adam. Very useful post.

I've always used light text on dark blue background since Borland/Turbo Pascal days (where I think it was default, but my memory doesnt go back that far!) so the Cobalt theme is fairly close. The red markings still appear, but I removed them by selecting the "Invalid" element in Preferences > Fonts & Colors and changed the opacity of the background color to 0. Initial period of insanity over, I think. And thanks to Piero I don't have to manually setup lslint & wiki help like in my last editor (which is just as well, because it was a breeze in Textpad compared to TextMate).

A nicer solution would be to alter the Bundle but it'll do for now and if/when I do I'll share my effort.

From: someone

A TextMate language "bundle", like the one for LSL, uses regular expressions to assign one or more "scopes" to each bit of text. If that scope can be found in the current "theme", the corresponding color/style is applied to the text. If the results are not what you want, there are a couple of places to apply a "fix".


Are there any side-effects from just hiding the red invalid markers like I mentioned above, or do the defined scopes affect other features in the editor apart from syntax colouring? Seems fine at first glance.
_____________________
Adam Marker
new scripter
Join date: 2 Jan 2004
Posts: 104
side effects of hiding "Invalid" stuff
01-31-2009 08:10
Hiding the Invalid elements by turning off the red does have side-effects. I don't know if they extend beyond syntax highlighting.

The (wonderful, thank you Piero) LSL bundle defines (at least) 3 different kinds of invalid. The 'invalid.suspect' seems to cover things like blank lines, but the other two (invalid.source and invalid.illegal) might be useful in pointing out syntax errors -- I'm not sure, I didn't grok the details.

By changing the Invalid element, you're hiding syntax on all scopes that start with "invalid." A better approach would be to define a new "Invalid - Suspect" element with a scope of "invalid.suspect" and the opacity 0 background.

Worse though -- the theme choice is a TextMate global setting. So if you switch to a Ruby or C++ file, your modified Invalid element would hide invalid stuff there too. If any of your languages defines a scope like "invalid.definitely.destroys.data", you'd want to see it.

p.s. I love your little bug sig. It really annoys me.
Anthony Hocken
Registered User
Join date: 16 Apr 2006
Posts: 121
01-31-2009 08:22
From: Adam Marker

Worse though -- the theme choice is a TextMate global setting. So if you switch to a Ruby or C++ file, your modified Invalid element would hide invalid stuff there too. If any of your languages defines a scope like "invalid.definitely.destroys.data", you'd want to see it.


I'm not going to confess how long I spent hunting for theme settings in the Bundle area because it's embarrassing. When I saw it was a global setting I kicked myself. I'm used to it being language specific.

In version 2 of TextMate he's changing the underlying architecture. Maybe this is one of the things he's addressing.

From: Adam Marker

p.s. I love your little bug sig. It really annoys me.


I actually have shares in companies selling computer cleaning products. I get a kickback for every smudged screen.
_____________________
1 2 3