Notepad++ SU8 Ruby API Autocomplete
-
@driven said:
This is the sort of thing I want to check in SU ruby on the mac,
Your first snip seems to bring up loads more methods than what your posting, ..."methods" ?? The snippet lists Constants. You mean this snippet ??
Errno.constants.sort.each {|e| puts %Q[\t\t<Keyword name="Errno::#{e}"/>\n\t\t<Keyword name="Errno::#{e}::Errno"/>\n] }
@driven said:
... are you editing yours down?
NO .. BUT the
Errno
module is created dynamically by Ruby at startup, and MAY DIFFERfrom platform to platform (ie, from one Operating System to another.)The count on the PC is 73 Constants within
Errno
module (pointing atSystemCallError
exception subclass instances,) each of whom have a local constantErrno
that wraps their private instance methoderrno()
. SO a grandtotal of 146 moduleErrno
constants on the PC.Just to be on the safe side.. and to be sure that Global Constants (defined in
Object
,) are not propagating into theErrno
module, in Ruby 1.8.5 .... use the following snippet, and post the results here in a code box, please.(Errno.constants.sort-Object.constants.sort).each {|e| puts %Q[\t\t<Keyword name="Errno::#{e}"/>\n\t\t<Keyword name="Errno::#{e}::Errno"/>\n] }
-
here it is, I'm running these through Ruby Console, so aren't they shielded from external globals? and I know I still get names messed about, sorry.. john
>> (Errno.constants.sort-Object.constants.sort).each {|e| puts %Q[\t\t<Keyword name="Errno;;#{e}"/>\n\t\t<Keyword name="Errno;;#{e};;Errno"/>\n] } <Keyword name="Errno;;E2BIG"/> <Keyword name="Errno;;E2BIG;;Errno"/> <Keyword name="Errno;;EACCES"/> <Keyword name="Errno;;EACCES;;Errno"/> <Keyword name="Errno;;EADDRINUSE"/> <Keyword name="Errno;;EADDRINUSE;;Errno"/> <Keyword name="Errno;;EADDRNOTAVAIL"/> <Keyword name="Errno;;EADDRNOTAVAIL;;Errno"/> <Keyword name="Errno;;EAFNOSUPPORT"/> <Keyword name="Errno;;EAFNOSUPPORT;;Errno"/> <Keyword name="Errno;;EAGAIN"/> <Keyword name="Errno;;EAGAIN;;Errno"/> <Keyword name="Errno;;EALREADY"/> <Keyword name="Errno;;EALREADY;;Errno"/> <Keyword name="Errno;;EBADF"/> <Keyword name="Errno;;EBADF;;Errno"/> <Keyword name="Errno;;EBADMSG"/> <Keyword name="Errno;;EBADMSG;;Errno"/> <Keyword name="Errno;;EBUSY"/> <Keyword name="Errno;;EBUSY;;Errno"/> <Keyword name="Errno;;ECHILD"/> <Keyword name="Errno;;ECHILD;;Errno"/> <Keyword name="Errno;;ECONNABORTED"/> <Keyword name="Errno;;ECONNABORTED;;Errno"/> <Keyword name="Errno;;ECONNREFUSED"/> <Keyword name="Errno;;ECONNREFUSED;;Errno"/> <Keyword name="Errno;;ECONNRESET"/> <Keyword name="Errno;;ECONNRESET;;Errno"/> <Keyword name="Errno;;EDEADLK"/> <Keyword name="Errno;;EDEADLK;;Errno"/> <Keyword name="Errno;;EDESTADDRREQ"/> <Keyword name="Errno;;EDESTADDRREQ;;Errno"/> <Keyword name="Errno;;EDOM"/> <Keyword name="Errno;;EDOM;;Errno"/> <Keyword name="Errno;;EDQUOT"/> <Keyword name="Errno;;EDQUOT;;Errno"/> <Keyword name="Errno;;EEXIST"/> <Keyword name="Errno;;EEXIST;;Errno"/> <Keyword name="Errno;;EFAULT"/> <Keyword name="Errno;;EFAULT;;Errno"/> <Keyword name="Errno;;EFBIG"/> <Keyword name="Errno;;EFBIG;;Errno"/> <Keyword name="Errno;;EHOSTDOWN"/> <Keyword name="Errno;;EHOSTDOWN;;Errno"/> <Keyword name="Errno;;EHOSTUNREACH"/> <Keyword name="Errno;;EHOSTUNREACH;;Errno"/> <Keyword name="Errno;;EIDRM"/> <Keyword name="Errno;;EIDRM;;Errno"/> <Keyword name="Errno;;EILSEQ"/> <Keyword name="Errno;;EILSEQ;;Errno"/> <Keyword name="Errno;;EINPROGRESS"/> <Keyword name="Errno;;EINPROGRESS;;Errno"/> <Keyword name="Errno;;EINTR"/> <Keyword name="Errno;;EINTR;;Errno"/> <Keyword name="Errno;;EINVAL"/> <Keyword name="Errno;;EINVAL;;Errno"/> <Keyword name="Errno;;EIO"/> <Keyword name="Errno;;EIO;;Errno"/> <Keyword name="Errno;;EISCONN"/> <Keyword name="Errno;;EISCONN;;Errno"/> <Keyword name="Errno;;EISDIR"/> <Keyword name="Errno;;EISDIR;;Errno"/> <Keyword name="Errno;;ELOOP"/> <Keyword name="Errno;;ELOOP;;Errno"/> <Keyword name="Errno;;EMFILE"/> <Keyword name="Errno;;EMFILE;;Errno"/> <Keyword name="Errno;;EMLINK"/> <Keyword name="Errno;;EMLINK;;Errno"/> <Keyword name="Errno;;EMSGSIZE"/> <Keyword name="Errno;;EMSGSIZE;;Errno"/> <Keyword name="Errno;;EMULTIHOP"/> <Keyword name="Errno;;EMULTIHOP;;Errno"/> <Keyword name="Errno;;ENAMETOOLONG"/> <Keyword name="Errno;;ENAMETOOLONG;;Errno"/> <Keyword name="Errno;;ENETDOWN"/> <Keyword name="Errno;;ENETDOWN;;Errno"/> <Keyword name="Errno;;ENETRESET"/> <Keyword name="Errno;;ENETRESET;;Errno"/> <Keyword name="Errno;;ENETUNREACH"/> <Keyword name="Errno;;ENETUNREACH;;Errno"/> <Keyword name="Errno;;ENFILE"/> <Keyword name="Errno;;ENFILE;;Errno"/> <Keyword name="Errno;;ENOBUFS"/> <Keyword name="Errno;;ENOBUFS;;Errno"/> <Keyword name="Errno;;ENODATA"/> <Keyword name="Errno;;ENODATA;;Errno"/> <Keyword name="Errno;;ENODEV"/> <Keyword name="Errno;;ENODEV;;Errno"/> <Keyword name="Errno;;ENOENT"/> <Keyword name="Errno;;ENOENT;;Errno"/> <Keyword name="Errno;;ENOEXEC"/> <Keyword name="Errno;;ENOEXEC;;Errno"/> <Keyword name="Errno;;ENOLCK"/> <Keyword name="Errno;;ENOLCK;;Errno"/> <Keyword name="Errno;;ENOLINK"/> <Keyword name="Errno;;ENOLINK;;Errno"/> <Keyword name="Errno;;ENOMEM"/> <Keyword name="Errno;;ENOMEM;;Errno"/> <Keyword name="Errno;;ENOMSG"/> <Keyword name="Errno;;ENOMSG;;Errno"/> <Keyword name="Errno;;ENOPROTOOPT"/> <Keyword name="Errno;;ENOPROTOOPT;;Errno"/> <Keyword name="Errno;;ENOSPC"/> <Keyword name="Errno;;ENOSPC;;Errno"/> <Keyword name="Errno;;ENOSR"/> <Keyword name="Errno;;ENOSR;;Errno"/> <Keyword name="Errno;;ENOSTR"/> <Keyword name="Errno;;ENOSTR;;Errno"/> <Keyword name="Errno;;ENOSYS"/> <Keyword name="Errno;;ENOSYS;;Errno"/> <Keyword name="Errno;;ENOTBLK"/> <Keyword name="Errno;;ENOTBLK;;Errno"/> <Keyword name="Errno;;ENOTCONN"/> <Keyword name="Errno;;ENOTCONN;;Errno"/> <Keyword name="Errno;;ENOTDIR"/> <Keyword name="Errno;;ENOTDIR;;Errno"/> <Keyword name="Errno;;ENOTEMPTY"/> <Keyword name="Errno;;ENOTEMPTY;;Errno"/> <Keyword name="Errno;;ENOTSOCK"/> <Keyword name="Errno;;ENOTSOCK;;Errno"/> <Keyword name="Errno;;ENOTTY"/> <Keyword name="Errno;;ENOTTY;;Errno"/> <Keyword name="Errno;;ENXIO"/> <Keyword name="Errno;;ENXIO;;Errno"/> <Keyword name="Errno;;EOPNOTSUPP"/> <Keyword name="Errno;;EOPNOTSUPP;;Errno"/> <Keyword name="Errno;;EOVERFLOW"/> <Keyword name="Errno;;EOVERFLOW;;Errno"/> <Keyword name="Errno;;EPERM"/> <Keyword name="Errno;;EPERM;;Errno"/> <Keyword name="Errno;;EPFNOSUPPORT"/> <Keyword name="Errno;;EPFNOSUPPORT;;Errno"/> <Keyword name="Errno;;EPIPE"/> <Keyword name="Errno;;EPIPE;;Errno"/> <Keyword name="Errno;;EPROTO"/> <Keyword name="Errno;;EPROTO;;Errno"/> <Keyword name="Errno;;EPROTONOSUPPORT"/> <Keyword name="Errno;;EPROTONOSUPPORT;;Errno"/> <Keyword name="Errno;;EPROTOTYPE"/> <Keyword name="Errno;;EPROTOTYPE;;Errno"/> <Keyword name="Errno;;ERANGE"/> <Keyword name="Errno;;ERANGE;;Errno"/> <Keyword name="Errno;;EREMOTE"/> <Keyword name="Errno;;EREMOTE;;Errno"/> <Keyword name="Errno;;EROFS"/> <Keyword name="Errno;;EROFS;;Errno"/> <Keyword name="Errno;;ESHUTDOWN"/> <Keyword name="Errno;;ESHUTDOWN;;Errno"/> <Keyword name="Errno;;ESOCKTNOSUPPORT"/> <Keyword name="Errno;;ESOCKTNOSUPPORT;;Errno"/> <Keyword name="Errno;;ESPIPE"/> <Keyword name="Errno;;ESPIPE;;Errno"/> <Keyword name="Errno;;ESRCH"/> <Keyword name="Errno;;ESRCH;;Errno"/> <Keyword name="Errno;;ESTALE"/> <Keyword name="Errno;;ESTALE;;Errno"/> <Keyword name="Errno;;ETIME"/> <Keyword name="Errno;;ETIME;;Errno"/> <Keyword name="Errno;;ETIMEDOUT"/> <Keyword name="Errno;;ETIMEDOUT;;Errno"/> <Keyword name="Errno;;ETOOMANYREFS"/> <Keyword name="Errno;;ETOOMANYREFS;;Errno"/> <Keyword name="Errno;;ETXTBSY"/> <Keyword name="Errno;;ETXTBSY;;Errno"/> <Keyword name="Errno;;EUSERS"/> <Keyword name="Errno;;EUSERS;;Errno"/> <Keyword name="Errno;;EWOULDBLOCK"/> <Keyword name="Errno;;EWOULDBLOCK;;Errno"/> <Keyword name="Errno;;EXDEV"/> <Keyword name="Errno;;EXDEV;;Errno"/> ["E2BIG", "EACCES", "EADDRINUSE", "EADDRNOTAVAIL", "EAFNOSUPPORT", "EAGAIN", "EALREADY", "EBADF", "EBADMSG", "EBUSY", "ECHILD", "ECONNABORTED", "ECONNREFUSED", "ECONNRESET", "EDEADLK", "EDESTADDRREQ", "EDOM", "EDQUOT", "EEXIST", "EFAULT", "EFBIG", "EHOSTDOWN", "EHOSTUNREACH", "EIDRM", "EILSEQ", "EINPROGRESS", "EINTR", "EINVAL", "EIO", "EISCONN", "EISDIR", "ELOOP", "EMFILE", "EMLINK", "EMSGSIZE", "EMULTIHOP", "ENAMETOOLONG", "ENETDOWN", "ENETRESET", "ENETUNREACH", "ENFILE", "ENOBUFS", "ENODATA", "ENODEV", "ENOENT", "ENOEXEC", "ENOLCK", "ENOLINK", "ENOMEM", "ENOMSG", "ENOPROTOOPT", "ENOSPC", "ENOSR", "ENOSTR", "ENOSYS", "ENOTBLK", "ENOTCONN", "ENOTDIR", "ENOTEMPTY", "ENOTSOCK", "ENOTTY", "ENXIO", "EOPNOTSUPP", "EOVERFLOW", "EPERM", "EPFNOSUPPORT", "EPIPE", "EPROTO", "EPROTONOSUPPORT", "EPROTOTYPE", "ERANGE", "EREMOTE", "EROFS", "ESHUTDOWN", "ESOCKTNOSUPPORT", "ESPIPE", "ESRCH", "ESTALE", "ETIME", "ETIMEDOUT", "ETOOMANYREFS", "ETXTBSY", "EUSERS", "EWOULDBLOCK", "EXDEV"]
-
@driven said:
Would you mind sharing Marshal snippet, and will that work with all modules?
I'm not sure what you are asking for.
Marshal::constants.sort
>> ["MAJOR_VERSION", "MINOR_VERSION"]Marshal::singleton_methods.sort
>> ["dump", "load", "restore"]The
Marshal
module has been part of Standard Ruby since the very early days. It's listed in the old "Pick-Axe" book which was Ruby circa 1.6.x
By the way.. can Safari open a CHM (Compiled HTML Help Markup,) file natively without a plugin ??
If so.. you should get at least the Reference for v1.8.6 in this post.
~ -
@driven said:
here it is, ...
Looks like there are 85 of them on the Mac (thanks John.)
@driven said:
...I'm running these through Ruby Console, so aren't they shielded from external globals?
HELL NO. The Ruby Console runs WITHIN
Object
, anything you define there becomes global. That's why it's dangerous to define methods in the console.. they get inherited by ALL objects. -
BUT if running one of the WebConsoles ... you might be within the coder's namespace instead of
Object
. -
@driven said:
Is the a 1.8.6 module that simply didn't exist at all in 1.8.5 that I could test for?
Well I'm purty sure module
DanZoid
did not exist in Ruby 1.8.5... or any version. (snicker)Offhand I dont know of one such module (mostly the changes have been adding or removing methods and constants, and fixing bugs.)
I don't really have a good 1.8.5 reference... just all those numerous YAML documents in
share\ri\1.8\system
and I don't have time to learn how to use rdoc to generate a HTML help page right now.If you want to know what happens when a non-existant module (or class,) is referenced in Ruby, the answer is that a
NameError
exception is raised.Try it at the console...
puts DrivenUpTheWall.methods
~ -
@dan rathbun said:
Here's the 1.8.6 constant list AND class methods for the
Marshal
module:As an experiment, in parameters, I used:
"~" to denote "this class or subclass"
"^" to denote "implictly convertable to" (which would include the class and any subclasses.)for ex:
^Integer
would mean: "Integer
class, subclass, or object that implements ato_i()
method."Hi Dan,
What I was trying to say is I don't know the method you used to get the additional information about this Constant.
I tried a couple of things to add it to the other code snippet, but I have had no luck (which is what's required for me).I realise if a method doesn't exist it throws an error, so what I'm looking for is a method that didn't exist in 1.8.5 (which SkechUp says its using on Macs), if this newer Ruby/Class/Constant, etc.., is present then SU must be referencing or have access to other installed versions.
There's a native coca utility http://chmox.sourceforge.net/ for reading CHM on OSX, forgot I had, so now I'll have a look.
The other thing I'm always looking for is what makes WebDialog different on the Mac, so probing SU through the ruby console appeals to me.
Not to mention that autocomplete on a Mac editor would be a good thing...
john
john
-
@driven said:
Not to mention that autocomplete on a Mac editor would be a good thing...
I use TextMate, would be nice to get an autocomplete for that. If that's even possible...
-
@driven said:
@dan rathbun said:
Here's the 1.8.6 constant list AND class methods for the
Marshal
module:What I was trying to say is I don't know the method you used to get the additional information about this Constant.
If you mean the text that is in the XML descr attributes.. that I just copy and pasted manually out of the Ruby Core Reference Help CHM. Then edited it a bit to make it more readable, more concise, etc. (Sometimes those Japanese guys who work on the Ruby Core don't write the best English.)
Of course... doing that manually for all of the methods in Ruby and the Sketchup API is a lifetime project.
I'm looking at seeing if I can script it.. at least grabbing the text that can be edited and cut-down later. (Notepad++ has a memory limit to the text for each function.)
@@ThomThom - That BitBucket website just about locks up MSIE 7. But I stopped posting new constant lists, as I realized that it is better the write a plugin that generates the XML files, so I've been working on that. Also need to write a database utility, or maybe a webform so the functions and overloads can be added, edited, etc. more easily by multiple people.
-
@thomthom said:
I use TextMate, would be nice to get an autocomplete for that. If that's even possible...
I'll try this with TextWrangler, and let you know how it pans out http://c-command.com/bbautocomplete/
john
-
@dan rathbun said:
@@ThomThom - That BitBucket website just about locks up MSIE 7
hm... No problems in IE8 here. (Don't have IE7 any more on any of my machines.)
-
Wonderful!!!!!!
-
This seems sort on hard to maintain as a .xml file. Would it be easier to manage as in a different format that could be translated into the .xml?
Maybe a spreadsheet?
(A read-only version of the actual Spreadsheet)Edit - see next post.
-
Here's a Ruby script that creates the Ruby.xml auto-complete file directly from the online spreadsheet.
Use:
prompt$ ruby gss2nppxml.rb
(Google Spreadsheet 2 Notepad Plus Plus XML)requires 'nokogiri' (
gem install nokogiri
)The file Ruby.xml will be created in the same folder. Move/Copy this file to the Notepad++ plugins/API folder and restart Notepad++.
n++ auto-complete documentation.
The spreadsheet is publically editable by anyone with the link (see attachment,) so anyone can easily contribute by adding return values and function paramter hints to the sheets.
-
Oooh, what have you done here Jim? Looks interesting. I haven't checked out the spreadcheet you generated, but does it include argument name hints?
Do you have a pre-compiled XML file? -
So the spreadsheet is is used as a dB. I had done this in the past when outputting HTML API docs for eigenMath, which I eventually compiled into a CHM using the free MS HTML Help Workshop.
I had proposed something along this line for the Ruby API docs, but input forms would be a great benefit. Fortunately.. Excel and it's OpenSource clones can have worksheets that are dB input forms (or the suite's dB engine Access or OpenBase, can be used to create an updating applet with forms.)
-
@thomthom said:
does it include argument name hints?
Yes. If you look at the spreadsheet, overloads are handled using a period (.) You can have any number of overloads and parameters.
@thomthom said:
Do you have a pre-compiled XML file?
NP++ Seems to get confused, though. See how NP++ uses the hints from add for add_3d_text. I can't see anything wrong in the XML according to the docs.
-
Is there a way for np++ automatically to add/remove your own module, class, and method names into/from the auto-complition list?
What I mean:
Lets say I write some class in NP++, naming it 'Anton'.
On the next line I start with letter A and the auto-completion-list should show-up displaying all index with A including my name.
Then I erase my class and on next line start with word A again. Now, the index list should no longer have 'Anton' in the index.Sorry, that's kind of awkward put together, though I hope ya could understand what I mean.
-
Not that I'm aware of - but it would be really nice. It's something that an IDE does though - and Notepadd++ is more of a text editor than an IDE. But they do have a plugin system - maybe there is something there.... ?
-
@anton_s said:
Is there a way for np++ automatically to add/remove your own module, class, and method names into/from the auto-complition list?
What I was really wishing for... was to be able to load multiple API overlay files.
One for Core Ruby. Then if You wanted to work on a Rails project, you could load a Rails API overlay list.
For a Sketchup example, the Core Ruby API would always load. Then of course we'd need the basic Sketchup API. If we also needed the TT_Lib API, and the WxSU APIs, we could load them also.
NP++ has session files that keep track of all open files in a project, their window sizes, the language they use, where the cursor is, what is hilighted, etc. So keeping an API file list for each file would not be "out of this world."
For a Js example, you could set a Core Js, and overlay say, the JQuery API on top of it.
And it would also be nice to have a "bread-crumb" API bar that would list the loaded APIs for the active file.
There is alot of room on the left side of the statusbar (just after it displays the file language, and before the file length.)
Advertisement