blob: 573b5abcf4269aa082fdfe7dfaa59d84362dd318 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css"/>
<title>R Script Editor - Content Assist</title>
<meta name="copyright" content="Copyright (c) 2008, 2019 Stephan Wahlbrink and others. SPDX-License-Identifier: EPL-2.0 OR Apache-2.0"/>
</head>
<body>
<h1>Content Assist</h1>
<h2>Use of Content Assist</h2>
<p>Content Assist is a mechanism within Eclipse that offers to insert code
from a menu that is activated on a simple keyboard shortcut,
<kbd>Ctrl+Space</kbd> by default. After pressing the shortcut, the following menu
appears:</p>
<img style="width: 1014px; height: 484px;" alt="Screenshot content assist" src="../images/screenshot_content_assist.png"/>
<p>As can be seen above, the proposal to insert can be chosen from the window.
There are different kind of proposals, the available proposals depends on the context.
Right from the items in the menu a popup displays information like
the code that will be inserted for the particular snippet that is selected from the menu.
Pressing <kbd>Enter</kbd> will insert the proposal in the editor and allow you to
further edit the text.
</p>
<p>Some proposals support the additional replacement mode. It is activated by holding the
<kbd>Ctrl</kbd> when selecting the proposal.
</p>
<h2>R Element (Names)</h2>
<h4>Proposals from other projects</h4>
<p>To get proposals for R elements of other R projects in the Eclipse workspace, you have to add
that projects to the list of referenced projects. The list can be edited at the project property
page "Project References" of the selected project.
Note, that closed projects cannot contribute R elements to the "R search path".
</p>
<h4>Proposals from packages</h4>
<p>To get proposals for R elements of an R package, you have to import the package to the
R script file by</p>
<ul>
<li>Roxygen <code>@import</code> tags</li>
<li>R commands <code>load</code> and <code>require</code></li>
</ul>
<p>in this file. The 'base' package is always imported.
StatET searches for the package at first in the references projects (recursively). If the package
is not found in the workspace, the content assistant tries to fetch the R elements of the package
from the currently active R instance (R console).
</p>
<h3>Argument Information</h3>
<p>After inserting a function name with arguments, the cursor is set after the left
parenthesis and the available arguments are shown in a small information hover.</p>
<p>It is possible to shown this information for known functions at any time by invoking the
content assist directly after the opening parenthesis or a comma between two function arguments.
Reinvoking the content assist shows the normal completions proposals.</p>
<h2>Templates</h2>
<p>Template proposals allow inserting predefined source snippets.
</p>
<h4>Configuration of snippet templates</h4>
<p>The content of the predefined snippets can be configured in <span class="uisequence">Window &gt; Preferences</span> at
<span class="uisequence indent">R &gt; Source Editors &gt; R Templates</span>
</p>
<img style="width: 776px; height: 536px;" alt="Screenshot preferences content assist templates" src="../images/screenshot_preferences_content_assist_templates.png"/>
<h2>Resource Paths</h2>
<p>Inside string this type enables the completion of path names for filesystem resources.
</p>
</body>
</html>