DrRacket autocomplete does not see functions defined in my source code - racket

I am using Racket and DrRacket for a small project (I am trying to learn both and using them to teach a friend of mine some functional programming).
I have just discovered the autocomplete function (C-/) and it works fine with library functions, but it won't see my own functions.
I have also added
(provide (all-defined-out))
at the beginning of my source file (I thought that the autocomplete function might not see the symbols because they are not exported) but this does not solve the problem.
All the symbols are accessible in the DrRacket REPL (I can evaluate my functions and they work fine).
Can you give me any indication on how to solve this problem? Do I need to configure something?

I can confirm that DrRacket currently works this way. The best advice I can give, is to submit a feature request (use "Submit Bugreport" in the Help menu) and then cross your fingers.

Related

VS Code / IDEs: How can I enable cmd+click goto definition for variables declared at runtime?

I'm looking to improve my own productivity by trying to figure out how to provide cmd+click functionality for variables declared at runtime. I work with a library that allows you to register objects to it at runtime to be accessed later — it would be great if I could cmd+click to definitions of these! How do you think I could achieve this? I'm open to any ideas. Thanks!
Edit:
Thoughts I have so far inspired by feedback from various Slack communities:
There is no such thing as 'runtime' when providing functionality in IDEs
We need to be able to teach the IDE about what definitions to expect. Whether this means writing an extension to use the VS Code API specifically for my use-case, or otherwise working within a system that generates files that the IDE already knows to look for, which allows it to connect the dots and provide the precious peek / goto definition functionality
Edit:
I'm starting work on a VS Code extension that reads a dotfile for configuration — I'll share what I find out as I go!

complete code that implement go to definition

I am using vs code for code editor. One feature I really like is "go to definition". However, my code is mixed with c++ and matlab source code. When I open c++ code, I can use the feature to jump to a new location in different file. However, for matlab code I could not do it. In gvim, I can use gf command to jump to files with suffixes add. In source insight, I can add simple definition for matlab function. But in vs I can not do it. I want to create my own go to definition for matlab function. But the vs code is too complicated (compare with gvim and source insight) to create such feature for a new language.
Could someone pointed me a location that I can get a complete implementation of this feature, so I can modify the code to fit for matlab function? To create by myself without such code is really out of my capability. I googled around and do find some information about this. But they are not complete and hard to understand for me.
Thanks
Frank

IDE support for Scala scripting

I plan to try some exploratory programming with Scala, e.g. loading some scala source files and call the functions defined in these source files interactively, maybe doing some plotting in the between.
I want to keep a scripting source file, and occasionally send some lines in it to the scala console using a short-cut such as Ctrl+Enter.
Which IDE supports scripting well?
The Scala plugin for Eclipse offers two different interpreters. One is the standard REPL, simply integrated within the IDE, the other one is the Run Selection Interpreter which may be very handy for the kind of experimentation you'd like to do, give it a try.
The Scala plugin for eclipse is the best out there .
http://www.scala-ide.org/
With the Run Selection Interpreter you can achieve what you want :
An expression can be executed in the interpreter by selecting text in
any Scala editor and either selecting the toolbar button (see
screenshot) or by using the Ctrl+Shift+X key combination (Cmd+Shift+X
on the Mac). The key combination can be changed by going to Keys ->
Preferences and changing the binding for the command "Send Selection
to Scala Interpreter"
In latest version of scala plugin for IntellJ Idea 11 (Nika EAP) scala console works much better. Read more in plugin blog http://blog.jetbrains.com/scala/2011/10/19/scala-language-console-nika-builds/
you can try Slate while I am still heavily developing. Although, for basic scripting, you can probably do command line as well. Almost all IDEs support integration with the interpreter btw.
It is obligatory to mention emacs here. Can emacs do _? Yes, emacs can do that!
In all seriousness, though, you might want to google around for "scala mode emacs" and see what you can find.

Eclipse Style Function Completions in Emacs for C, C++ and JAVA?

How Do I Get Eclipse Style Function Completions in Emacs for C, C++ and JAVA?
I love the power of the Emacs text editor but the lack of an "intellisense" feature
leaves me using Eclipse.
M-/ is a quick and dirty autocomplete based on the contents of your current buffer. It won't give you everything you get in Eclipse but is surprisingly powerful.
I can only answer your question as one who has not used Eclipse much. But! What if there was a really nice fast heuristic analysis of everything you typed or looked at in your emacs buffers, and you got smart completion over all that everywhere, not just in code?
M-x load-library completion
M-x global-set-key C-RET complete RET
When I was doing java development I used to use the:
Java Development Environment for Emacs (JDEE)
The JDEE will provide method name completion when you explicitly invoke a jdee provided function. It has a keyboard binding for this functionality in the jdee-mode.
The CEDET package provides completion for C/C++ & Java (and for some other languages). To initial customization you can take my config that i use to work with C++ projects
Right now, I'm using Auto Complete for Emacs. As a current Visual Studio and ex-Eclipse user, I can say that it rivals both applications quite well. It's still not as good as Microsoft's IntelliSense for C#, but some would say that C++ is notoriously difficult to parse.
It leverages the power of (I believe) the Semantic package from Cedet, and I find it feels nicer to use when compared to Smart Complete. It completes C++ members, local variables, etc. It's pretty good. However, it falls down on not being able to complete overloaded methods (it only shows the function once with no parameters, but thats a limitation of Cedet I believe), and other various things. It may improve in future though!
By the way, I could be wrong here, but I think you need an EDE project set up for the class member completion to work (just like you would normally with Semantic). I've only ever used it while having an EDE project, so I assume this is true.
Searching the web I find http://www.emacswiki.org/cgi-bin/wiki/EmacsTags#toc7 describing complete-tab in etags. It is bound to M-Tab by default. This binding may be a problem for you
Also, etags has some limits, which may annoy you...
The link also points to CEDET as having better symbol completion support.
Have you tried the emacs plugin for eclipse?
http://people.csail.mit.edu/adonovan/hacks/eclipse-emacs.html
I've written a C++-specific package on top of CEDET that might provide
what you want. It provides an Eclipse-like function arguments hint.
Overloaded functions are supported both for function arguments hint
and for completion.
Package is located here:
https://github.com/abo-abo/function-args
Make sure to check out the nice screenshot:
https://raw.github.com/abo-abo/function-args/master/doc/screenshot-1.png
auto-complete-clang is what you want. Can't go wrong with using an actual C++ compiler for completions.
The only problem it has is there's no way to know what -I and -D flags to pass to the compiler. There are packages for emacs that let you declare projects and then you can use that.
Personally, I use CMake for all C and C++ work so I wrote some CMake code to pass that information to emacs through directory-local variables. It works, but I'm thinking of writing a package that calls cmake from emacs so there's less intrusion.

Writing Emacs extensions in languages other than Lisp

I'd like to take an existing application (written in OCaml) and create an Emacs "interface" for it (like, for example, the Emacs GDB mode). I would prefer to do this without writing a ton of Lisp code. In MVC terms, I'd like for the View to be Emacs, but for the Model and Controller to remain (primarily) OCaml.
Does anybody know of a way to write Emacs extensions in a language other than Lisp? This could either take the form of bindings to the Emacs extension API in some other language (e.g., making OCaml a first-class Emacs extension language) or an Emacs interaction mode where, for example, the extension has a pipe into which it can write Emacs Lisp expressions and read out result values.
http://www.emacswiki.org/cgi-bin/emacs-en?CategoryExtensionLanguage is a list of all non-Elisp extension languages you can use.
It does appear to be dynamic language centric.
http://common-lisp.net/project/slime/ is missing from that list, as it is not quite an extension language, but an Elisp-Common Lisp bridge. Its source code would show how to communicate back and forth over sockets.
A similar IDE for Erlang is Distel, at http://fresh.homeunix.net/~luke/distel/ (currently down) and https://github.com/massemanet/distel.
Good luck!
I don't know if this will work for your particular problem, but I have been doing something similar using the shell-command-to-string function:
(shell-command-to-string
"bash -c \"script-to-exec args\"")
So for example, we have existing scripts written in python which will mangle a file, so the above lets me invoke the script via emacs lisp.
A quick google search found this page describing a system to write extensions in Python, so it seems feasible to do what you want... you will just have to see if anyone has written a similar framework for OCaml.
Some Extension Api is now possible with the incoming emacs 25.1 and dynamic modules
A Library, emacs-ffi offer a foreign function interface based on libffi.
Check out complete documentation on the README.
Try PyMacs, which allows extending Emacs in Python.
edit: updated link.
From the statically typed languages side, there is something that looks quite performant and well featured for Haskell:
https://github.com/knupfer/haskell-emacs
there is also probably something useful for Scala to be reused from the Ensime project (has a bridge for both Emacs and Vim):
https://github.com/ensime/ensime-server
Furthermore, a quick google search revealed another potential candidate for extending Emacs with a classic FP language, OCaml; the project has a lot of .ml source files so there's got to be an Emacs-OCaml bridge somewhere:
https://github.com/the-lambda-church/merlin
There is no "Extension API". Emacs Lisp is way in there, and it ain't moving.
You can run Emacs commands from your other process. Have a look at Gnuserv.
There are plenty of applications where Emacs is the View for a Model/Controller in a separate process. The Emacs GDB interface is a good example. I'm not sure of a simpler example, maybe sql-postgresql?