How to Go-to-line in the IDE

Asked by alex chu

My script is over 1000 lines long, i tried short cut like ctrl-g, ctrl-L none of them can "go to line" similar to other IDE.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Roman Podolyan (podolyan-roman) said :
#1

1) You can use other IDE to navigate the script. Sikuli scripts could be edited with PyCharm, and they can be even run with it. (you won't have capabilities to to capture images though). PyCharm has Go To Line

2) You can spend some time and insert after every 50 lines comment like

#mark050
...
#mark100
...
#mark150

It would be dirty hack.
_____

But in general if you have over 1000 lines in one script, you are doing it wrong. This is what is called "large class" anti-pattern. Even 250+ like I had is not a good idea: it is hard to manage. Consider breaking your script into several smaller files/classes and smaller functions.

Revision history for this message
alex chu (bb9now) said :
#2

I understand design pattern. But that's for writing code not for Sikuli script. The IDE only support one script file. Maybe I'm missing something totally obvious ? :)

I can use any editor like sublime, Eclipse, .NET studio. But the main problem is the Jpg image won't show on those IDE. How others develop their script?

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Are you using latest SikuliX - at least 1.1.1?
http://sikulix.com

The IDE supports as many scripts as you like - just open a new tab.
There are many features that allow, to divide larger scripts into smaller parts, besides the things the Python language as such delivers.

In the docs there are some infos about import and running scripts from within other scripts.

And with an intelligent naming scheme it is possible, to use the IDE only for the image management only, while working with the code in mature IDE's like PyCharms.

Many possibilities.

... and I totally agree with comment #1

--- But that's for writing code not for Sikuli script
LOL - what's the difference?

Revision history for this message
alex chu (bb9now) said :
#4

I'm coming back from 2012 and i'm pretty cautious with the IDE,
I've never trying open files that's been edited outside afraid it will crash the IDE and can't recover from it.

LOL - what's the difference?
Shouldn't be if sikuli can work with files edited by outside editor :)

Revision history for this message
RaiMan (raimund-hocke) said :
#5

Things have changed a lot since then.
You should use latest version 1.1.1 (http://sikulix.com) and make your experiences.

... and SikuliX can work of course with files "edited by outside editor" - you only have to accept the rules for a SikuliX script:
- a folder named foobar.sikuli
- contains a file foobar.py (might be edited outside)
- contains images referenced in the script

Can you help with this problem?

Provide an answer of your own, or ask alex chu for more information if necessary.

To post a message you must log in.