

 AWS Cloud9 is no longer available to new customers. Existing customers of AWS Cloud9 can continue to use the service as normal. [Learn more](https://aws.amazon.com/blogs/devops/how-to-migrate-from-aws-cloud9-to-aws-ide-toolkits-or-aws-cloudshell/)

# Enhanced language support in the AWS Cloud9 IDE
<a name="enhanced-lang-support"></a>

AWS Cloud9 provides enhanced support to improve your development experience when coding with the following languages:
+ **Java**: Extensions allow provide features such as code completion, linting for errors, context-specific actions, and debugging options.
+ **Typescript**: *Language projects* offer access to enhanced productivity features for TypeScript.

**Topics**
+ [Enhanced Java support](enhanced-java.md)
+ [Enhanced TypeScript support](projects.md)

# Enhanced support for Java development
<a name="enhanced-java"></a>

AWS Cloud9 provides enhanced language support to improve your development experience when working with Java. Key productivity features include code completion, linting for errors, code lenses, and debugging options such as breakpoints and stepping.

**Important**  
Enhanced productivity features are available only for AWS Cloud9 development environments that are connected to Amazon EC2 instances.   
Moreover, to ensure an optimal IDE experience when using enhanced language support for Java, the Amazon EC2 compute instance that backs your AWS Cloud9 environment requires **2 GiB** or more of memory. If AWS Cloud9 detects that your EC2 compute instance doesn't have sufficient RAM, you're not offered the option to activate enhanced features for Java. 

## Activating and customizing enhanced Java support
<a name="activating-java-support"></a>

The option to activate enhanced support for Java is automatically displayed if the following conditions are met:
+ Your AWS Cloud9 environment is connected to an Amazon EC2 instance with 2 GiB or more of memory.
+ You're working with a file associated with Java development. AWS Cloud9 checks the following file names and extensions: `*.java`, `*.gradle` (associated with the Gradle build tool), and `pom.xml` (associated with the Apache Maven build tool).
+ You're working in an AWS Cloud9 environment that was created after **December 11, 2020**. At present, it's not possible to use Java productivity features in development environments that were created before this date.

If these conditions are met, a dialog box displays to ask you whether you want to activate the extra productivity features for coding and debugging Java. If you choose **Activate**, you can start using the features in the IDE.

![\[Code completion with\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/working_with_java_rework.png)


**Note**  
Amazon EC2 instances which are launched when you create an AWS Cloud9 environment have *Amazon Coretto 11* already installed. Amazon Coretto is no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK). This means you can start developing and running Java applications in AWS Cloud9 out-of-the-box.

You can also manually activate and deactivate enhanced language and debugging support using the AWS Cloud9 interface. Choose **Preferences**, **Java Support**, **Enhanced Java Support**.

![\[Manually activating and deactivating enhanced Java support\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/activate_java_extensions_update.png)


The enhanced support for Java development in AWS Cloud9 is provided by two extensions to the IDE: 
+ Language Support for Java(TM) by Red Hat
+ Debugger for Java

The AWS Cloud9 interface gives you access to wide range of settings that customize these extensions' performance. To change extension settings, choose **Preferences**, **Java Support**.

For detailed information on these settings, see the installed versions' ReadMe pages in the extensions' GitHub repositories:
+ [Language Support for Java(TM) by Red Hat](https://github.com/redhat-developer/vscode-java/tree/v1.8.0)
+ [Debugger for Java](https://github.com/microsoft/vscode-java-debug/tree/0.40.1)

## Feature highlights
<a name="key-java-features"></a>

After you've activated enhanced Java support, you can use a range of productivity-boosting features.

** Code completion**

With code completion, the editor makes context-aware suggestions based on the code you're typing. For example, if you type the dot (".") operator after an object name, the editor displays the methods or properties available for that object. 

![\[Code completion with\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/code-complete-java.png)


**Code lenses**

Code lens allow you to access context-specific actions directly in the source code. For Java development, code lenses facilitate unit testing by allowing you to run and debug specific methods. 

![\[Accessing code lenses\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/context-specific-actions.png)


**Code linting**

Code linting describes how the editor highlights potential errors in your code before you've even built it. For example, the linting tool call out if you're trying to use an uninitialized variable or trying to assign a value to a variable that's expecting a different type. 

![\[Linting highlight errors before you build your code\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/linting.png)


**Debugging options**

You can implement breakpoints and watch expressions. Set your breakpoints in the source code and display the debugger pane to define relevant conditions. 

![\[Debugging options\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/debugging_options.png)


**Debugging using configuration files**

You can also control your debugging configuration by using launch configurations and tasks which AWS Cloud9 supports via the `launch.json` and `tasks.json` configuration files. For examples of launch configurations and how they can be used, see [Java debug configuration.](https://github.com/microsoft/vscode-java-debug/blob/main/Configuration.md)

**Java commands**

You can run commands from the AWS Cloud9 command panel by pressing **Ctrl\$1.** or **F1**. Then filter the relevant commands by entering "java".

![\[Listing available Java commands\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/java_commands.png)


**Quick fixes**

With quick fixes, you can resolve errors caused by using undeclared variables or undefined methods by creating stubs for the missing elements. 

![\[Implementing a quick fix\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/quick_fix_java.png)


**Refactoring**

Refactoring allows you to restructure your code without changing its behavior. To access options such as organizing imports or creating constructors, open the context (right-click) menu for the item and choose **Refactoring**.

![\[Refactoring feature\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/refactoring_java.png)


**Renaming**

Renaming is a refactoring feature that allows you to easily modify the names of selected variables, functions, and classes everywhere that they appear in the code with a single action. To change a name, open the context (right-click) menu for the item and choose **Rename**. Renaming affects every instance of the name in your code. 

![\[Renaming a class name\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/renaming_refactoring_java.png)


## Optional tools for Java development
<a name="optional-tools"></a>

The extensions that provide enhanced Java support include features that allow you to integrate the Gradle and Maven automation tools into your project development. These tools aren't pre-installed in your AWS Cloud9 development environment. For more information on installing and using these optional build tools, see the following resources:
+ **Gradle**: [Getting started guide](https://docs.gradle.org/current/userguide/userguide.html)
+ **Maven**: [Maven in 5 minutes](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html)

## Problems tab for Java extension
<a name="problems-panel"></a>

You can view and troubleshoot issues with your java project within your AWS Cloud9 environment in the Problems tab of the AWS Cloud9 IDE. To display the Problems tab from the AWS Cloud9 IDE, select **View** and choose **Problems** from the menu bar.

![\[Opening the problems tab\]](http://docs.aws.amazon.com/cloud9/latest/user-guide/images/problems-panel.png)


You can also open the Problems tab by selecting the **\$1** icon within the console and choosing **Open Problems**. When you select a problem from the tab, it opens the affected file and displays the issue details.

# Enhanced TypeScript support and features
<a name="projects"></a>

The AWS Cloud9 IDE allows you to use *language projects* to access enhanced productivity features for TypeScript. A language project is a collection of related files, folders, and settings in the IDE for an AWS Cloud9 development environment.

To use the IDE to create a language project in your environment, see [Create a Language Project](#projects-create).

## Available project productivity features
<a name="projects-features"></a>

The AWS Cloud9 IDE provides the following project productivity features for TypeScript.

### Autocomplete
<a name="projects-features-autocomplete"></a>

As you type in a file in the editor, a list of symbols is displayed at the insertion point for that context, if any symbols are available there.

To insert a symbol from the list at the insertion point, if the symbol isn't already chosen, choose it by using your up arrow or down arrow key, and then press `Tab`.

Before you press `Tab`, you might see a screentip that contains information about the symbol you chose, if information is available.

To close the list without inserting a symbol, press `Esc`.

### Gutter Icons
<a name="projects-features-gutter-icons"></a>

Icons might appear in the gutter for the active file. These icons highlight possible issues such as warnings and errors in code before you run it.

For more information about an issue, pause your pointer on the issue's icon.

### Quick Fixes
<a name="projects-features-quick-fixes"></a>

In the active file in the editor, you can display information about coding errors and warnings, with possible fixes that you can automatically apply to that code. To display error or warning information and possible fixes, choose any part of the code that has a red dotted underline (for errors), or a gray dotted underline (for warnings). Or, with the cursor resting on code that has a red or gray dotted underline, press `Option-Enter` (for macOS), or `Alt-Enter` (for Linux or Windows). To apply a proposed fix, choose the fix in the list, or use the arrow keys to select the fix and then press `Enter`. To turn choosing quick fixes with mouse clicks on or off, choose **AWS Cloud9**, **Preferences**, **User Settings**, **Language**, **Hints & Warnings**, **Show Available Quick Fixes on Click**.

### Find References
<a name="projects-features-find-refs"></a>

In the active file in the editor, you can display all references to the symbol at the insertion point, if the IDE has access to those references.

To do this, at the insertion point anywhere within the symbol, run the ** `Find References` ** command. For example:
+ Right-click at the insertion point, and then choose **Find References**.
+ On the menu bar, choose **Go, Find References**.
+ Press `Shift-F3` by default for macOS, Windows, or Linux.

If references are available, a pane opens on top of the active file, next to that symbol. The pane contains a list of the files where the symbol is referenced. The pane displays the first reference in the list. To display a different reference, choose that reference in the list.

To close the pane, choose the close (**X**) icon in the pane, or press `Esc`.

The ** `Find References` ** command might be disabled, or might not work as expected, under the following conditions:
+ There are no references to that symbol in the active file's project.
+ The IDE can't find some or all of that symbol's references in the active file's project.
+ The IDE doesn't have access to one or more locations where that symbol is referenced in the active file's project.

### Go to Definition
<a name="projects-features-go-to-def"></a>

In the active file in the editor, you can go from a symbol to where that symbol is defined, if the IDE has access to that definition.

To do this, at the insertion point anywhere within the symbol, run the ** `Jump to Definition` ** command. For example:
+ Right-click at the insertion point, and then choose **Jump to Definition**.
+ On the menu bar, choose **Go, Jump to Definition**.
+ Press `F3` by default for macOS, Windows, or Linux.

If the definition is available, the insertion point switches to that definition, even if that definition is in a separate file.

The ** `Jump to Definition` ** command might be disabled, or might not work as expected, under the following conditions:
+ The symbol is a primitive symbol for that language.
+ The IDE can't find the definition's location in the active file's project.
+ The IDE doesn't have access to the definition's location in the active file's project.

### Go to Symbol
<a name="projects-features-go-to-symbol"></a>

You can go to a specific symbol within a project, as follows.

1. Make one of the files in the project active by opening it in the editor. If the file is already open, choose its tab in the editor to make that file the active one.

1. Run the ** `Go to Symbol` ** command. For example:
   + Choose the **Go** window button (magnifying glass icon). In the **Go to Anything** box, type `@`, and then start typing the symbol.
   + On the menu bar, choose **Go, Go To Symbol**. In the **Go** window, start typing the symbol after **@**.
   + Press `Command-2` or `Command-Shift-O` by default for macOS, or `Ctrl-Shift-O` by default for Windows or Linux. In the **Go** window, start typing the symbol after **@**.

   For example, to find all symbols in the project named `toString`, start typing `@toString` (or start typing `toString` after **@**, if **@** is already displayed).

1. If you see the symbol you want in the **Symbols** list, choose it by clicking it. Or use your up arrow or down arrow key to select it, and then press `Enter`. The insertion point then switches to that symbol.

If the symbol that you want to go to isn't in the active file's project, this procedure might not work as expected.

## Create a Language Project
<a name="projects-create"></a>

Use the following procedure to create a language project that will work with supported project productivity features in the AWS Cloud9 IDE.

**Note**  
We recommend that you use supported project productivity features on files that are part of a language project. Although you can use some supported project productivity features on a file that isn't part of a project, those features might behave with unexpected results.  
For example, you might use the IDE to search for references and definitions from within a file at the root level of an environment that isn't part of a project. The IDE might then search only across files at that same root level. This might result in no references or definitions found, even though those references or definitions actually exist in language projects elsewhere across the same environment.

### Create a TypeScript Language Project
<a name="projects-create-typescript"></a>

1. Ensure you have TypeScript installed in the environment. For more information, see [Step 1: Install required tools](sample-typescript.md#sample-typescript-install) in the [TypeScript tutorial for AWS Cloud9](sample-typescript.md).

1. From a terminal session in the IDE for the environment, switch to the directory where you want to create the project. If the directory doesn't exist, create it and then switch to it. For example, the following commands create a directory named `my-demo-project` at the root of the environment (in `~/environment`), and then switch to that directory.

   ```
   mkdir ~/environment/my-demo-project
   cd ~/environment/my-demo-project
   ```

1. At the root of the directory where you want to create the project, run the TypeScript compiler with the ** `--init` ** option.

   ```
   tsc --init
   ```

   If this command is successful, the TypeScript compiler creates a `tsconfig.json` file in the root of the directory for the project. You can use this file to define various project settings, such as TypeScript compiler options and specific files to include or exclude from the project.

   For more information about the `tsconfig.json` file, see the following:
   +  [tsconfig.json Overview](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) on the TypeScript website.
   +  [tsconfig.json Schema](http://json.schemastore.org/tsconfig) on the json.schemastore.org website.