How to view the source code of a method in a standard library of Racket?
Asked Answered
S

2

6

For example, there is a on-char method on the editor-canvas% class in racket/gui/base. It handles the 'wheel-up and 'wheel-down events and passes other events to the on-char method on canvas%.

I would like to view the source code and see how it does that.

I wish there are some tools like the Ruby API documentation, but now I do not even know where the source code of racket/gui/base is.

Array#each

Sennar answered 13/4, 2015 at 14:51 Comment(0)
L
8

In DrRacket IDE you can hover over every imported symbol and right click. In the menu you have "Open defining file". After clicking on this you right click over the same symbol again and look where you clicked last time you'll see it says "Jump to definition (in other file)".

Note that in the same menu you also have "View documentation for symbol from packet" which opens a browser with the documentation.

Laynelayney answered 13/4, 2015 at 15:10 Comment(0)
E
8

In DrRacket click the "Check Syntax" button (the one with the blue check mark and the magnifying glass). Then right click the identifier in question (here on-char) and choose the menu item "Open Defining File". This will open the file in which on-char is defined.

Embree answered 13/4, 2015 at 15:11 Comment(1)
As a bonus tip: For most builting package, you can find the source at github.com/racket/PACKAGE. In this case, see: github.com/racket/guiEmbree

© 2022 - 2024 — McMap. All rights reserved.