# Tag Info

52

Preface With Mathematica version 9.0.1 the following answer not valid anymore because the underlying protocol between front end and kernel was changed. Fortunately, we started to implement an open-source Mathematica plugin for IntelliJIDEA which has a full support for camel-hump completion. Please see this post for more information Camel-humps auto-...

33

There is an undocumented file in the installation directory named specialArgFunctions.tr: NotebookOpen @ FileNameJoin @ { $InstallationDirectory, "SystemFiles", "FrontEnd", "SystemResources" , "FunctionalFrequency", "specialArgFunctions.tr" } This file describes in detail how to attach completion actions to each parameter of listed functions. For ... 25 (Posting my comment as an answer, per @murphy's suggestion) Please check the folder$UserBaseDirectory/SystemFiles/FrontEnd/SystemResources/Functional‌​Frequency and see if there are any unusually large files there (>100 Kb or so). If any such files exist, please delete them. The file CodeAssistHistory10.3.m is often the culprit, and is safe to delete.

20

Before you start using this, be aware that this is all undocumented and unsupported functionality. It may change at any time, it may crash Mathematica, and it may bite you when you least expect it. I wouldn't be surprised if it turned out that incorrect use messes up the internal state of the front end. Use at your own risk. I tried the examples I show ...

19

Thanks for asking this question; I might not have discovered this customizable area without it. The auto-completion option values are automatically loaded on Front End start from: FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "SystemResources", "FunctionalFrequency", "OptionValues"}] This directory contains a series of Package (.m) ... 19 Do you mean CtrlShiftK? After typing Plo, press the key combination CtrlShiftK and a window will appear with possible options: As pointed by Yves，CtrlK will also work，but CtrlShiftK will work differently if you finish the function name. For an example, Type Plot3D; Use CtrlShiftK; Mathematica will show: 16 This took some digging but at least in Version 7 the FrontEnd command is FT, e.g.: FEFT["Plot"] You can read the definition with Definition[FEFT]. If you want only the Box form itself we can modify it accordingly (here for version 7): templateCell[name_String] := Module[{template}, If[! StringQ@ToExpression[name <> "::usage"],$NewMessage[...

16

This is obsolete in Mathematica 9, which automatically includes contexts in completions. Undocumented function: use at your own risk, subject to change in future versions, etc.... The function you're interested in is FEFC. It's been around for a while (here's a Mathematica Journal article that references it, near the end) although it has changed ...

14

Changing shortcuts isn't that complicated. All you have to do is change one line in the file KeyEventTranslations.tr in a location in your file system specified by this command: FileNameJoin[{$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources",$OperatingSystem}] Locate the following line in a text editor and change the key into the one ...

13

On my system, setting the following to False works (Mac OS X): (in Preferences->Advanced->"Open Option Inspector")

13

In the meantime, I was playing around. This is just to add a hotkey (Alt+k in windows) to replace what you have written so far with the partial symbol found. I don't know if it is a useful thing if we don't add it a way to handle multiple findings. Put this in a "init.m" file, inside FileNameJoin[{$UserBaseDirectory, "Applications", "AutocompleteBonus"}] ... 13 Besides the nice real handy option suggested by @yulinlinyu (more here) you can also use text-based interface to find completion for your half-typed function. It is not that fast, but has its own advantages. Try executing this: ?Plot* and you'll get this nice table of possible functions that complete your input. If you click on any you'll get short ... 12 To clarify the situation: In Version 9 on Windows and OS X, there is a new Make Template system which supports multiple templates for built-in functions. As part of the new system, unfortunately a bug was introduced which makes it ignore the usage statement for user-defined functions. This bug has been confirmed and we hope to fix it in a future release, ... 11 I also took a crack at this. I think I made it look pretty close to the jquery example you posted. Figuring out how to move the insertion point to the end of the word once a suggestion is selected was a bit of a struggle. As a result, there's a DynamicWrapper in there that may be unstable. Input is the list of possible values from which you'd like to draw ... 11 My humble contribution: (* Use this function to style list elements *) listItemStyle[item_] := Mouseover[#, Style[#, Background -> LightBlue]] &@ MouseAppearance[Framed[item], "LinkHand"]; (* This filters the list of data and returns a clickable list *) SetAttributes[autoComplete, HoldFirst]; autoComplete[s_, data_] := If[ StringLength[s] > 0, ... 11 I had exactly the same problem today (I have Mathematica 11.2 and Windows 10): the autocomplete suddenly disappeared and neither Ctrl+K or F2 worked. I don't have any additional packages installed; only the basic Mathematica. I tried clean-starting and that didn't work. I managed to get autocomplete to work again by deleting the$UserBaseDirectory and ...

11

PacletUpdate["EntityFramework"] should resolve the issue at this point.

10

So I mentioned this in a comment but I'll get it out here for the bounty poster too. Searching for the "JLink" in the autocomplete directory gave me this: FileNameJoin@{$InstallationDirectory, "SystemFiles", "Components", "AutoCompletionData", "Main", "documentedContexts.m"} If we look at what's inside it: FileNameJoin@{$InstallationDirectory, "...

8

You can also use hotstrings as a way of autocompletion. By using such replacements, words are immediately replaced by another word on typing a space after the hotstring: CreateDocument[{}, InputAutoReplacements -> {"sync" -> SynchronousInitialization}] You can set such replacements globally under Option Inspector (CtrlShiftO). Of course no one would ...

8

No, I don't think it's possible. The reason is that built-in symbols are plagued by the same problem. I would actually consider this a bug. It's confusing and hinders usability. Plus, other operators, such as ->, are not turned into patterns.

7

Note: This appears to really slowly in M9, although it works well in M8. It probably is better to use teedr's until it can be figured out what is causing the slow speeds. The following seems to work pretty well. I wrapped the options in a Pane and Framed so the entire row is clickable. ClearAll[AutoInputField]; SetAttributes[AutoInputField, ...

7

Maybe overkill but it was educational to try: DynamicModule[{}, EventHandler[ Overlay[{ Dynamic@Framed[ Row[{Style[x, Transparent, 15, Bold], Style[rest, GrayLevel@.6, 15, Bold]}], ImageSize -> {280, 30}, Alignment -> Top, FrameMargins -> {{5, 0}, {0, 1}}], InputField[Dynamic@x, String, BaseStyle -&...

7

You have to define its ::usage f1[a_, b_, c_] := Module[{}, Print[a];] f1::usage = "f1[a,b,c] prints the first argument"; Note that what you write at the beginning at the message (in this case f1[a, b, c] ) will determine the completion behavior, which is not defined by the function definition. Start a new line inside the string to have multiple ...

7

So I can provide some clarification and a workaround Clarification First off, this only triggers on the EndPackage: For example, this still allows ggg to autocomplete: BeginPackage["fooa"]; ggg::usage = "asdasd"; EndPackage[]; (*Break this into different cells or the FE acts like EndPackage was called!*) Abort[] BeginPackage["foo", {"fooa"}]; But ...

6

You can try (for a single notebook) CreateDocument[{}, NotebookEventActions -> {{"KeyDown", "\t"} :> NotebookWrite[SelectedNotebook[], "\t"]}] or (for global application) SetOptions[$FrontEnd, FrontEndEventActions -> {{"KeyDown", "\t"} :> NotebookWrite[SelectedNotebook[], "\t"]}] Does this meet your needs? For me it had an effect in ... 6 The number of items in the drop-down menu seems to be controlled by the suboption "MaxGlobalMatches" of the option CodeAssistOptions. The latter can be set at the EvaluationNotebook[],$FrontEndSession or $FrontEnd levels. The default value of the suboption is 5. Options[$FrontEndSession, CodeAssistOptions] You can change the value of this suboption to a ...

6

You can use undocumented "OptionNames" property of SyntaxInformation to customize option names suggestions (and coloring of invalid option names). MyFunc // ClearAll MyFunc // Options = {"MyOpt" -> True}; MyFunc // SyntaxInformation = { "ArgumentsPattern" -> {_, OptionsPattern[]}, "OptionNames" -> {"\"MyOpt\""} }; After typing MyFunc[3.2, ...

5

Sometimes instead of handy shorthands like in the other answers, you'll find more useful Names giving a list of the names of symbols matching the string, (it's case sensitive of course) e.g. Names["Gro*B*"] Names["Gro*b*"] {"GroebnerBasis", "GroupActionBase", "GroupPageBreakWithin"} {"GroebnerBasis", "GroupMultiplicationTable", "GroupOrbits", "...

5

This can be accomplished with the AddCodeCompletion function in the function repository. Evaluate the following piece of code: AddCodeCompletion = ResourceFunction["AddCodeCompletion"] AddCodeCompletion["readCSV"]["AbsoluteFileName"] readCSV will now auto-complete absolute file paths. AddCodeCompletion can be used with relative filenames as well. Note: ...

5

This has to do with the Notebook's default context setting in the evaluation menu. If it isn't set to Global, the definitions made in init.m are not seen. As rm-rf says, a good way to put custom definitions in the init.m would be to use Begin and End to create an Init` context and append that context to the context path so that the definitions are ...

Only top voted, non community-wiki answers of a minimum length are eligible