Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
TheEndless
Channel Surfer

Re: Eclipse plugin for Brightscript Beta

"malloys" wrote:
There's the problem.
The BrightScript plugin was developed and informally tested under Eclipse 3.6. It does not yet work under Eclipse 3.7.

It looks like this was causing the problem I had with the files that were hanging. I rolled back to 3.6.2, and they're loading now.

On a side note (or maybe related?), it doesn't seem to like the "?" shortcut for "print". It might be a coincidence, but each of the files that wouldn't load contained at least one "?" line. 3.6.2 marks them all as invalid syntax.

I also can't seem to get code folding to work. Is there some trick to it? I'm new to Eclipse, so please excuse my ignorance, but should I be seeing +/- icon or something to fold a section?
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
malloys
Visitor

Re: Eclipse plugin for Brightscript Beta

"TheEndless" wrote:

On a side note (or maybe related?), it doesn't seem to like the "?" shortcut for "print". It might be a coincidence, but each of the files that wouldn't load contained at least one "?" line. 3.6.2 marks them all as invalid syntax.


Yes, more than likely, the "?" print shortcut was omitted from the parser grammar... I had constructed the parser grammar by going through the BrightScript reference guide section by section, and the section on the Print command doesn't mention the shortcut (it shows up later in the guide in the examples and in the debugger help). I'll have that corrected in the next release.

"TheEndless" wrote:

I also can't seem to get code folding to work. Is there some trick to it? I'm new to Eclipse, so please excuse my ignorance, but should I be seeing +/- icon or something to fold a section?


With the current beta release, only comments can be folded. I should be able to get code folding fixed by the next release.
And BTW... comment folding is not turned on by default, has a bad default value for minimum lines threshold, and requires that the "Join Comments separated by empty lines" option be checked on in order to work (yes, that last bit is a known bug).

To turn comment folding on, goto: Window->Preferences->BrightScript->Editor->Folding, and:
Set the value for "Minimum lines required to enable folding" to 2 or greater, and check on the options for: "Join Comments Separated by empty lines"

Since we're on topic, what types of code structures would you like to see be fold-able?

I'm currently thinking: Subs/Functions and control blocks (if/then/else, while, for).

Should I extend this to array/associative array definitions as well?

Cheers
0 Kudos
TheEndless
Channel Surfer

Re: Eclipse plugin for Brightscript Beta

"malloys" wrote:
Since we're on topic, what types of code structures would you like to see be fold-able?

I'm currently thinking: Subs/Functions and control blocks (if/then/else, while, for).

Should I extend this to array/associative array definitions as well?

I'd like it on associative arrays at least.

I'm not sure if it matters, but there seems to be a lot of leeway in acceptable BrightScript syntax. For example, "End If / EndIf", "Else If / ElseIf", "For...Next / For...End For" are all valid, but aren't necessarily documented as such. I get sporadic highlighting/syntax errors when using various combinations of them in Eclipse. For the most part, VBScript syntax highlighting and code folding recognize these in Notepad++, so that might be a worthwhile reference point.

One other issue I've run across... The RSP Console window seems a bit spastic. The drop down with IP addresses isn't wide enough to show the full address, and it's constantly refreshing (constant as in every 500ms or so), so I can't seem to select any specific addresses. When I click the down arrow to pick one, it refreshes and ends up selecting the second address (I have three in the list) every time. If I highlight the text to type in an address, it refreshes two quickly for me to do so.

Now that I can actually open my files, this is looking pretty sweet. Thanks for putting the time and effort into it, and for listening to feedback!
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
malloys
Visitor

Re: Eclipse plugin for Brightscript Beta

"MidnightJava" wrote:

1. The outline was incomplete, missing the vast majority of my functions. This was corrected by commenting out a line in the script that was causing a false positive error marker. See item 3 below.


That's a known issue with the underlying core parser.
It's got a form of automatic recovery on parser errors, but it currently doesn't seem particularly good at recovering to a useful parser restart point for BrightScript code in most cases.
I'm looking into overriding and improving the recovery algorithm for future releases.

"MidnightJava" wrote:

2. Searching for a function declaration with a reference to the function highlighted works for some references and doesn't work for others. For many references, Search doesn't find a declaration, even though it is there, and shows up in the Outline view.


If you could provide specific examples via PM, that would help me to isolate the problem.

"MidnightJava" wrote:

Highlighting a function reference and then selecting Show in-> Outline View doesn't do anything in any case. Also Link With Editor works from Outline View to editor, but not in the other direction.


Thanks for the heads up - I'll look into these.


"MidnightJava" wrote:

3. The telnet console doesn't work. I enter the local IP address of my roku box, and it doesn't do anything. I successfully side-loaded the box, so I know the plug-in can see it. I see the progress monitor for a user job as soon as I enter the IP address for the roku box in the deploy wizard, but the telnet console doesn't seem to be able to connect. Also the drop-down combo in the console where I enter the IP address is only one character wide. I have to scroll through horizontally to read the IP address one character at a time.


This is a known issue that should be fixed in the next release.
Although it allows you to enter an IP address, you shouldn't have to enter the IP address of a Roku box in the console dropdown - the plugin should automatically be able to query for them and list the IP address(es) automatically.

However...
There is a known race condition (with the plugin startup) bug which prevents the SSDP query mechanism from working correctly, so it falls back to relying on the Roku box SSDP 1-per-minute unsolicited broadcast.

Until the bug is fixed in the next release, you should wait a little while (in theory, at most 1+ minute) after the BrightScript console is becomes visible for the plugin to see the 1-per-minute unsolicited SSDP broadcast from the roku box. The plugin should eventually see that broadcast, and then add the IP address to the console window for you.

"MidnightJava" wrote:

4. I have a false positive error marker, due to an issue you mentioned previously, i.e. code with adjacent () or [] will show an error. This causes a cascading of error markers, which of course is par for the course when parsing a grammar; but I thought I'd mention one in particular in case something can be done about it. The following reference has an error marker due to the bug mentioned above

 ShowArtist(Indexes[curIndex][msg.GetIndex()])


However, after the line above there are some statements that close if and while blocks. It seems the parser misses these, and consequently there are a number of markers later in the code for various end xxx statements, of the nature "expected if, found while, or expected function, founded if", etc. I commented out the line above, and all the error markers went away, and the Outline was then found to be complete.


Understood, see response above in (1) about the current parser error recovery issue.

"MidnightJava" wrote:

1. I see that code completion works when I'm in the midst of a word, but never after a dot operator. I understand that's problematic with a dynamically typed language, but it is possible in certain contexts where the type of the object is known to the parser. I've seen Javascript editors that make a best effort at such completion, although it's not as deterministic as, say, for a Java editor. Is there indeed no support for code completion after the dot operator, and is that something planned for future versions?


Yes, that's a known issue with code completion... or more accurately, with the current parser/parser grammar.
Only the base BrightScript language elements are currently known to the parser - the built-in objects and component types (and more to the point, the interface definitions) are not yet in the grammar.
Object/component/interface types are something I plan on adding over several releases.
As these get added, it will have useful follow-on effects, including improved code-completion (and eventually help/doc windows for items in the code completion list).

"MidnightJava" wrote:

2. Is there any plan to enable navigating from reference to declaration with a single key (e.g. F3)? I use that a lot in Java development in Eclipse, and it's far more convenient than using the Search commands, which seems to be the only way such a thing is supported now.


Good idea - I'll add that to the to-do list.

"MidnightJava" wrote:

3. I had some reserved words in a script I tried to edit. This caused some error markers that were at first confusing to me until I realized I had some reserved words in the script. It would be helpful if use of reserved words was recognized and called out explicitly by the parser.


Agreed.
FYI - the error marker text (with a few special exceptions), is currently auto-generated by the parser code generator (read: not defined in my code or grammar file).
I've noticed that the default parser messages aren't always very clear, so that's a general area of improvement for my parser wrapper code that I've got on the to-do list.

Thanks very much for the feedback - please keep it coming!

Cheers.
0 Kudos
malloys
Visitor

Re: Eclipse plugin for Brightscript Beta

"TheEndless" wrote:
"malloys" wrote:
Since we're on topic, what types of code structures would you like to see be fold-able?

I'm currently thinking: Subs/Functions and control blocks (if/then/else, while, for).

Should I extend this to array/associative array definitions as well?

I'd like it on associative arrays at least.


You got it. Consider those added.

"TheEndless" wrote:

I'm not sure if it matters, but there seems to be a lot of leeway in acceptable BrightScript syntax. For example, "End If / EndIf", "Else If / ElseIf", "For...Next / For...End For" are all valid, but aren't necessarily documented as such. I get sporadic highlighting/syntax errors when using various combinations of them in Eclipse. For the most part, VBScript syntax highlighting and code folding recognize these in Notepad++, so that might be a worthwhile reference point.


Fortunately, my contacts at Roku have given me access to the Roku box's source code, so I plan on examining the box's parser grammar and using that as a reference for the plugin's parser grammar going forward, rather than relying solely on the BrightScript Language Reference guide (as I have to-date).


"TheEndless" wrote:

One other issue I've run across... The RSP Console window seems a bit spastic. The drop down with IP addresses isn't wide enough to show the full address, and it's constantly refreshing (constant as in every 500ms or so), so I can't seem to select any specific addresses. When I click the down arrow to pick one, it refreshes and ends up selecting the second address (I have three in the list) every time. If I highlight the text to type in an address, it refreshes two quickly for me to do so.


Yeah, just spotted this issue today myself (and related to something I mention in a previous post about the SSDP code and a race condition with eclipse's plugin startup).
I should have that corrected in the next release.

"TheEndless" wrote:

Now that I can actually open my files, this is looking pretty sweet. Thanks for putting the time and effort into it, and for listening to feedback!


Thanks much - there's lot's more on the to-do list and Roku seems pretty interested in having me continue to improve the plugin.
Please, by all means, let me know of any suggestions for new features, improvements to existing ones, and of course any bugs you may encounter.

Cheers
0 Kudos
TheEndless
Channel Surfer

Re: Eclipse plugin for Brightscript Beta

Two last feature requests/observations, then I'll zip it (for the day)... 😉

I'm not sure if it's possible for a plugin to do this or not, but there's one feature that I use a lot in both Notepad++ and in Visual Studio that doesn't appear to be available in Eclipse. When highlighting a word, all other instances of that word are also highlighted in a lighter color. This makes it really easy to identify everywhere a variable is used in a file. In Visual Studio it's limited to the current scope of the highlighted variable, whereas in Notepad++ it's every occurrence. While the former is definitely handy, I'm kind of partial to the latter. Along those same lines, I've noticed that double-clicking a word highlights all non-whitespace, whereas ideally, it would stop at any non-word character instead (a period, to be more specific). Both of these are probably core Eclipse functionality, and not something you have control over, but I thought it worth mentioning, as they're two features that are pretty important to my development style/comfort.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
malloys
Visitor

Re: Eclipse plugin for Brightscript Beta

"TheEndless" wrote:
Two last feature requests/observations, then I'll zip it (for the day)... 😉

I'm not sure if it's possible for a plugin to do this or not, but there's one feature that I use a lot in both Notepad++ and in Visual Studio that doesn't appear to be available in Eclipse. When highlighting a word, all other instances of that word are also highlighted in a lighter color. This makes it really easy to identify everywhere a variable is used in a file. In Visual Studio it's limited to the current scope of the highlighted variable, whereas in Notepad++ it's every occurrence. While the former is definitely handy, I'm kind of partial to the latter. Along those same lines, I've noticed that double-clicking a word highlights all non-whitespace, whereas ideally, it would stop at any non-word character instead (a period, to be more specific). Both of these are probably core Eclipse functionality, and not something you have control over, but I thought it worth mentioning, as they're two features that are pretty important to my development style/comfort.


Good ideas - I'll add these to the to-do list.
I'm pretty sure I had the "automatically highlight all other instances on select" feature working at one point early in development (last year), but it appears it's been broken.
The "select only to non-word character boundaries on double-click" is definitely something under plugin control. I'll likely make this something configurable by adding a section or page to the user preferences.
0 Kudos
jbrave
Channel Surfer

Re: Eclipse plugin for Brightscript Beta

Plugin doesn't like the 3.0 Library statement:

Library "v30/bslCore.brs"

Syntax error: unexpected token "Library" <ID>, expected one of "Sub", or "Function"
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
malloys
Visitor

Re: Eclipse plugin for Brightscript Beta

"jbrave" wrote:
Plugin doesn't like the 3.0 Library statement:

Library "v30/bslCore.brs"

Syntax error: unexpected token "Library" <ID>, expected one of "Sub", or "Function"


Good catch - I'll add that to the to-do list for the parser.
FYI, I haven't re-reviewed the core language guide since 2.8, so there are bound to be more language elements missing from the parser grammar.
0 Kudos
MidnightJava
Visitor

Re: Eclipse plugin for Brightscript Beta

"malloys" wrote:

"MidnightJava" wrote:

3. The telnet console doesn't work. I enter the local IP address of my roku box, and it doesn't do anything. I successfully side-loaded the box, so I know the plug-in can see it. I see the progress monitor for a user job as soon as I enter the IP address for the roku box in the deploy wizard, but the telnet console doesn't seem to be able to connect. Also the drop-down combo in the console where I enter the IP address is only one character wide. I have to scroll through horizontally to read the IP address one character at a time.


This is a known issue that should be fixed in the next release.
Although it allows you to enter an IP address, you shouldn't have to enter the IP address of a Roku box in the console dropdown - the plugin should automatically be able to query for them and list the IP address(es) automatically.

However...
There is a known race condition (with the plugin startup) bug which prevents the SSDP query mechanism from working correctly, so it falls back to relying on the Roku box SSDP 1-per-minute unsolicited broadcast.

Until the bug is fixed in the next release, you should wait a little while (in theory, at most 1+ minute) after the BrightScript console is becomes visible for the plugin to see the 1-per-minute unsolicited SSDP broadcast from the roku box. The plugin should eventually see that broadcast, and then add the IP address to the console window for you.



The console does not receive the IP address of the roku no matter how long I wait. Sniffing with Wireshark, I see the M-SEARCH requests from the plug-in and roku's 200 OK response, but I do not see the NOTIFY messages coming from roku. I assume the M-SEARCH response is not being consumed by the console UI due to the race condition you mentioned. As to why the NOTIFY messages are not appearing, I'm not sure.

The roku is connected via wired connection to a wireless router. Eclipse is running on a laptop connected to the same router wirelessly (with the laptop and roku box in the same subnet). In the router, I turned on port forwarding for port 1900 to the laptop, and I temporarily turned off the software firewall on the laptop; but I still don't see any SSDP NOTIFY messages. Perhaps I need some additional setting on the router to enable UPnP-- I'll check it again this evening.

However, some other posts on this forum seem to say that the proper behavior for SSDP-advertised services is for the server to send out NOTIFY messages only when it first come up. I did try re-starting the roku, and didn't see any NOTIFY messages. Are you sure that roku sends NOTIFY messages continuously every minute?
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.