Is there an autocomplete for Dr. Racket?
Asked Answered
M

2

22

I usually use Sublime text editor and gnome terminal to edit and run my programs. Due to educational purposes, I am using the IDE Dr. Racket.

I could not find an autocomplete feature to use while typing. I checked this out on google and at Dr. Racket's menu.

For instance, if I am calling a function already defined I would like to accelerate the process of typing the functions name. I have tried using control + /, but it does not work as an autocomplete for variables and procedures already defined.


Edit

@Sylwester, look, I tried that with a previous defined function, named square. It did not work:enter image description here

Murvyn answered 14/9, 2016 at 20:55 Comment(1)
As I mentioned in my answer that I don't know which dictionary it uses and it certainly doesn't pick up on user created procedures like you square even after RUN/Syntax check.Mallard
M
21

Image of list of matched

Linux and Windows

CTRL + /.

Mac OSX

Command + /

The last "key" might not be a button on its own and if that's so it needs to be the combination to make a /. eg. on my norwegian keyboard its CTRL + SHIFT + 7 since SHIFT + 7 makes a /.

I have no idea where it gets it's matches from since I see it finds fold even when it is not called that in #lang racket. It does not seem to catch user procedures either.

This answer is based on information from a racket mailing list entry from 2011. It's not documented in DrRacket shotcuts page so it might not be officially supported.

Mallard answered 14/9, 2016 at 21:48 Comment(1)
IIRC, it gets it from the bindings brought in from other files. But I've honestly found this auto complete to be really slow and not worth using.Natachanatal
I
7

On top of the default autocomplete, there are various other options:

  • The drcomplete package provides several autocomplete features,
  • The quickscript-extra package contains the dynamic-abbrev script (autocomplete based on the contents of the file) and complete-word script (completion based on a given dictionary),
  • The quickscript-competition-2020 package contains the fishy-completion script (lexical-based completion).

For the latter 2, you get scripts entries in the Scripts menu in DrRacket, plus default keybindings that can be changed by editing the scripts. (Also note that the other scripts installed at the same time can be deactivated from the Scripts|Manage|Disable scripts… menu.)

Icbm answered 28/8, 2020 at 7:54 Comment(2)
Since Racket isn’t statically typed, do these just suggest everything in scope or can they somehow figure out which possibilities would actually work in context?Almanza
@joseph As mention in the answer, fishy-completion is using lexical information. dynamic-abbrev is based on the contents of the file, but not the lexical context, while complete-word is based on a static dictionary. For DrComplete, it's complicated --- see the READMEIcbm

© 2022 - 2024 — McMap. All rights reserved.