Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Auto completion in R studio

Tags:

r

rstudio

Does anyone know how to completely disable automatic completions in Rstudio?

I don't see an option for it in Tools > Global Options; only a way to turn it to 'Manual (tab)' or 'When Triggered'. I can't enter a tab while typing code and it's driving me crazy.

like image 591
code_cowboy Avatar asked Apr 14 '16 15:04

code_cowboy


2 Answers

This is possible on versions of RStudio IDE 1.0+ by going to Tools > Global Options > Code > Completion and unchecking "Allow automatic completions in console".

like image 93
Ian Pylvainen Avatar answered Nov 09 '22 13:11

Ian Pylvainen


I agree this is very annoying. RStudio completely ignores the user preference for code completion shortcut, and I verified this in the source code. I found the following workaround, which disables TAB auto-completion in both the console and source views, while leaving intact auto-completion using the CTRL-SPACE (Control-Space) keys.

This workaround involves doing a custom build of RStudio (latest master branch at https://github.com/rstudio/rstudio.git).

Note: On Mac OS X El Capitan/Sierra, the Java SDK must be installed, and Apache Ant and OpenSSL must be installed (i.e. via Homebrew -- brew install ant; brew install openssl), in addition to the listed dependencies, before running cmake per the instructions.

For the workaround, I commented out the hard-coded TAB completion triggers in the following files, then built the release version via cmake (per instructions) and sudo make install:

In directory: src/gwt/src/org/rstudio/studio/client/workbench/views

./console/shell/assist/CompletionUtils.java

Lines 27-28:
return /*( event.getKeyCode() == KeyCodes.KEY_TAB && modifier == KeyboardShortcut.NONE)
        || */ (event.getKeyCode() == KeyCodes.KEY_SPACE && modifier == KeyboardShortcut.CTRL);

=====

./console/shell/shell.java

Lines 517-518:
/* if (event.getNativeKeyCode() == KeyCodes.KEY_TAB)
   event.preventDefault(); */

=====

./console/shell/assist/RCompletionManager.java

Line 1156:
//   if (firstLine.matches("^\\s*$"))

=====

./source/Source.java

Lines 382-383:
/* commands.codeCompletion().setShortcut(
                               new KeyboardShortcut(KeyCodes.KEY_TAB)); */
like image 40
railsfanatic Avatar answered Nov 09 '22 13:11

railsfanatic