Updated docs and added docs for code editor

This commit is contained in:
Akash Yadav
2022-10-24 12:05:59 +05:30
parent 176ef2a868
commit d4402a7437
18 changed files with 188 additions and 108 deletions
+6 -8
View File
@@ -17,14 +17,12 @@ AndroidIDE is an **Integrated Development Environment (IDE)** to build Gradle ba
- [Creating a new project](./getting_started.md#creating-a-new-project)
- [Working with an existing project](./getting_started.md#working-with-an-existing-project)
#### [User interface](./user_interface.md#readme)
  How to use the application.
- [Main Menu](./user_interface.md#main-menu)
- [Editor](./editor#readme)
- [Key Bindings](./editor/key-bindings.md#readme)
- [Sidebar](./editor#sidebar)
- [Options Menu](./editor#options-menu)
- [BottomSheet](./editor/bottomsheet.md#readme)
#### [Working with projects](./user_interface.md#readme)
  Get familiar with the various elements of the editor screen.
- [Options menu](./editor/README.md#options-menu).
- [File tree](./editor/README.md#the-file-tree).
- [Bottom sheet](./editor/README.md#editor-bottomsheet).
- [Code editor](./editor/README.md#the-code-editor).
## Important links
+20 -27
View File
@@ -1,36 +1,29 @@
# Editor
Editor is one of the the main components of an IDE.
<!-- AndroidIDE uses Sora as it's code editor. -->
# Editor UI
## [Key Bindings](./key-bindings.md#readme)
Keyboard shortcuts you can use in the editor.
## Sidebar
#### 1st group
- `Terminal`: Open terminal with project root directory.
- `Close this project`: Close the project and editor.
#### 2nd group
&emsp; Here is some links and help dialog.
#### 3rd group
- `IDE Preferences`: Open Preferences screen.
- `Share with Friends`: Share AndroidIDE.
Whenever you create a new project or open an existing project, you're presented with the editor screen. The page guides you through the various options you through the various elements of the Editor UI.
## Options Menu
Top right options and three-dot(`⋮`) menu.
- `Quick run(▷)`: Runs `assembleDebug` and installs the debug apk (if permission is given).
- `Run(▶)`: Various Gradle actions. Check [here](./actions.md#readme).
- `Run(▶)`: Various Gradle actions. Check [here](./build_actions.md#readme).
- `Find`:
- `Find in file`: Find and replace in the file which is opened in the editor.
- `Find in project`: Find in all the files in the selected project modules. <br/>&emsp; You can also filter the files with their extensions seperated by '|' .
- `File tree`: Open the file tree of the project. <br/>&emsp; You can also open it by swiping left from edge.
- `Find in project`: Find in all the files in the selected project modules. You can also filter the files with their extensions seperated by '|' .
- `File tree`: Open the file tree of the project. You can also open it by swiping left from edge. [Learn more](#the-file-tree).
- `Gradle daemon status`: Know the Gradle daemon status.
- `Cancel build`: If any build action is running, cancel it.
- `Sync project`: Sync the project and it's dependencies.
- `Cancel build`: If any build action is running, cancels it.
- `Sync project`: Sync the project. The IDE asks you to sync the project when there are any changes in the project configuration files. However, you could use this option to sync the project manually.
## [BottomSheet](bottomsheet.md#readme)
Swipe up to open the bottomsheet. You can find the
[Build Output](./bottomsheet.md#build-output),
[App Logs](./bottomsheet.md#app-logs),
[IDE Logs](./bottomsheet.md#ide-logs),
[Diagnostics](./bottomsheet.md#diagnostics),
[Search results](./bottomsheet.md#search-results) here.
## The file tree
The file tree shows your project files in a tree format. You can access the file tree sliding the right navigation drawer to the left or by clicking the 'File tree` option in the options menu. You can simply click any file to open it in the editor. Long clicking on any file item shows you some actions that you can perform on that given file/folder.
## Bottom sheet
The bottom sheet provides information about the Gradle builds along with app logs, IDE logs and much more. [Learn more](./bottom_sheet.md).
## Code editor
The code is where you work with your project files. It provides various actions based on the type of files. [Learn more](./code_editor.md).
+59
View File
@@ -0,0 +1,59 @@
# Editor Bottom Sheet
The bottom sheet can be expanded either by sliding or by a simple click. It shows the output from various builds. It also shows the application logs, logs from the IDE itself, search results and file diagnostics.
## Build Output
This tab shows the build output as emitted by the Gradle build process. This is where your project's build related issues will be shown.
<details>
<summary>See screenshot</summary>
<img src="../images/build_output.png" width="250"/>
</details>
## App Logs
This tab shows the logs received from your application.
To see logs from your application, you must invoke the `startLogging(Context)` method of `LogSender` class in your launcher activity or your application class.
In your activity or application :
```java
...
import com.itsaky.androidide.logsender.LogSender;
...
@Override
public void onCreate(...) {
LogSender.startLogging(this);
super.onCreate(...);
...
}
...
```
<details>
<summary>See screenshot</summary>
<img src="../images/app_logs.png" width="250"/>
</details>
## IDE Logs
This tab shows the logs from the IDE. With these logs, you can understand what is going on in the IDE. If any errors occurs in the IDE itself, this is where is will be shown. When reporting IDE related issues, you are expected to provide these logs.
<details>
<summary>See screenshot</summary>
<img src="../images/ide_logs.png" width="250"/>
</details>
## Diagnostics
This tab helps you to locate and identify syntax problems with the code. See errors and warnings from your code here.
<details>
<summary>See screenshot</summary>
<img src="../images/diagnostics.png" width="250"/>
</details>
## Search Results
The results of `Find in project` action are shown in this tab.
<details>
<summary>See screenshot</summary>
<img src="../images/search_results.png" width="250"/>
</details>
-30
View File
@@ -1,30 +0,0 @@
# Editor BottomSheet
Swipe up to open the BottomSheet.
## Build Output
In this tab, you can see the build outputs which were printed in the terminal while Gradle Build process.
## App Logs
Here you can view your App logs.<br/>
To see App logs use `startLogging(Context ctx)` method of `LogSender` class.<br/>
In your Activities or Application -
```java
...
import com.itsaky.androidide.logsender.LogSender;
...
public void onCreate(Bundle savedInstanceState) {
LogSender.startLogging(this);
...
}
...
```
## IDE Logs
Here you can see the IDE logs.<br/>
IDE logs are logs from the IDE. By these logs, you can understand what is going on in the IDE. It is primarily used to debug IDE issues.
## Diagnostics
This tool help you to locate and identify syntax problems with the code. See errors and warnings from your code here.
## Search Results
You can see the results of `Find in project` here.
+30
View File
@@ -0,0 +1,30 @@
# The code editor
AndroidIDE uses [sora-editor](https://github.com/Rosemoe/sora-editor) as it's code editor. Syntax highlighting in the editor is provided with the help of lexers generated using ANTLR4.
## Key Bindings
When working with a physical keyboard, you can use use key bindings for performing various text actions.
The editor provides support for some key bindings by default.
The currently supported key bindings are mostly similar to Android Studio/Intellij IDEA.
See the [supported key bindings](./key_bindings.md).
## Text actions
When you start selecting text in the editor, a compact text actions window is shown which allows you to perform some common actions like `Select all`, `Cut`, `Copy`, `Paste`, etc. This window is always anchored to the selection handles so that it is easily accessible.
<details>
<summary>See screenshot</summary>
<img src="../images/editor_text_actions.png" width="250"/>
</details>
## Code actions
Within the [text actions window](#text-actions), there is the `Code actions` item which provides some file-specific actions that you can perform. It helps you to do some frequent tasks quickly and provides diagnostics related actions if applicable.
As of now, only [Java code actions](./java_code_actions.md) are available.
<details>
<summary>See location of code actions item in text actions window</summary>
<img src="../images/editor_code_actions_item.png" width="250"/>
</details>
+43
View File
@@ -0,0 +1,43 @@
# Java code actions
## Common code actions
Common code actions which can be performed for most of the Java symbols.
| Code action | Description |
| --------------------- | ---------------------------------------------------------------------------------------------------- |
| Comment line | Comment out the selected line. |
| Uncomment line | Uncomment the selected line. |
| Find references | Finds the references to the selected variable, method, class, etc. |
| Go to definition | Find the file and the location where the selected symbol is defined then navigates to that location. |
| Organize imports | Organizes the imports in current file. |
| Remove unused imports | Removes all imports that are not used in the file. |
## Diagnostic related actions
Code actions that can be performed for diagnositics only.
| Code action | Description |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Add import | Imports the selected, non-imported class. |
| Add throws | Adds the selected throwable to the `throws` signature of the current method. |
| Create missing method | Creates the missing method. The name and signature of the method that will be created is extracted from the diagnostic. |
| Convert to block | Moves the RHS of an unused field to the `static` block. |
| Implement abstract method | Implemented the un-implemented abstract methods that a class inherits from it's superclass/interface. |
| Remove class | Removes the unused class |
| Remove method | Removes the unused method |
| Remove unused throws | Removes the unused `throws` signature from a method. The unused throws warning is shown when a method defines exceptions (with the `throws` keyword) that can be thrown from the method but does not actually throw that exception in it's body. |
| Suppress unchecked warning | Adds the `@SuppressWarnings("unchecked")` annotation to the method. |
| Convert to statement | Converts a unused variable declaration to a statement. |
## Generators
These code actions help you add various implementations to your code.
| Code action | Description |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Generate constructor | A field based action. Allows you to choose some fields from the current class and generates a constructor which accepts and initializes those fields. |
| Generate missing constructor | Generates the missing constructor implementation with the `super` constructor invocation. |
| Generate setters and getters | A field based action. Allows you to choose some fields from the current class and generates setters and getters for those fields. |
| Generate `toString()` | A field based action. Allows you to choose some fields from the current class and generates the `toString()` implementation with those fields. |
| Override superclass methods | A method based action. Allows you to choose methods from the superclass and override them all at once. |
-22
View File
@@ -1,22 +0,0 @@
## Key Bindings (Keyboard Shortcuts)
- `Ctrl+Home`: Moves the cursor to the beginning of content. If in selection mode, sets the selection from beginning of content to the selection anchor.
- `Ctrl+End`: Moves the cursor to the end of content. If in selection mode, sets the selection from the selection anchor to the end of content.
- `Ctrl+Shift+Home`: Same as `Ctrl+Home`, but starts or updates the selection.
- `Ctrl+Shift+End`: Same as `Ctrl+End`, but starts or updates the selection.
- `Ctrl + X`: If no content is selected, cuts the current line. Else, performs the usual cut operation.
- `Ctrl + C`: If no content is selected, selects and copies the current line. Else, performs the usual copy operation.
- `Ctrl + D`: If content is selected, duplicates the selected content else duplicates the current line.
- `Ctrl + W`: Selects the word at the left selection handle.
- `Shift + Enter`: Start a new line.
- `Ctrl + Enter`: Split line. If content is selected, deletes the selected content then splits the line.
- `Ctrl + Alt + Enter`: Start a new line before current line.
- `Ctrl + Shift + J`: Join current line and next line.
- `Ctrl+Left`: Move to word start. If the cursor is already at the current word's start, moves the cursor to previous word's start, skipping whitespaces.
- `Ctrl+Right`: Move to word end. If the cursor is already at the current word's end, moves the cursor to next word's end, skipping whitespaces.
- `Ctrl+Shift+Left`: Same as `Ctrl+Left`, but starts or updates the selection.
- `Ctrl+Shift+Right`: Same as `Ctrl+Right`, but starts or updates the selection.
- `Ctrl+Up`: Scroll up by one row.
- `Ctrl+Down`: Scroll down by one row.
- `Ctrl+Shift+Up`: Moves the current line (or all selected lines) up by one line.
- `Ctrl+Shift+Down`: Moves the current line (or all selected lines) down by one line.
+30
View File
@@ -0,0 +1,30 @@
## Editor key bindings
These are the keybindings that can be used in any type of file.
| Keybinding | Description |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `Ctrl + A` | Select all. |
| `Ctrl + X` | If no content is selected, cuts the current line. Else, performs the usual cut operation. |
| `Ctrl + C` | If no content is selected, selects and copies the current line. Else, performs the usual copy operation. |
| `Ctrl + V` | The usual paste action. |
| `Ctrl + U` | Undo the last action. |
| `Ctrl + R` | Redo the last action. |
| `Ctrl + D` | If content is selected, duplicates the selected content else duplicates the current line. |
| `Ctrl + W` | Selects the word at the left selection handle. |
| `Ctrl + Left` | Move to word start. If the cursor is already at the current word's start, moves the cursor to previous word's start, skipping whitespaces. |
| `Ctrl + Right` | Move to word end. If the cursor is already at the current word's end, moves the cursor to next word's end, skipping whitespaces. |
| `Ctrl + Up` | Scroll up by one row. |
| `Ctrl + Down` | Scroll down by one row. |
| `Ctrl + Home` | Moves the cursor to the beginning of content. If in selection mode, sets the selection from beginning of content to the selection anchor. |
| `Ctrl + End` | Moves the cursor to the end of content. If in selection mode, sets the selection from the selection anchor to the end of content. |
| `Ctrl + Enter` | Split line. If content is selected, deletes the selected content then splits the line. |
| `Ctrl + Shift + Left` | Same as `Ctrl+Left`, but starts or updates the selection. |
| `Ctrl + Shift + Right` | Same as `Ctrl+Right`, but starts or updates the selection. |
| `Ctrl + Shift + Up` | Moves the current line (or all selected lines) up by one line. |
| `Ctrl + Shift + Down` | Moves the current line (or all selected lines) down by one line. |
| `Ctrl + Shift + Home` | Same as `Ctrl+Home`, but starts or updates the selection. |
| `Ctrl + Shift + End` | Same as `Ctrl+End`, but starts or updates the selection. |
| `Ctrl + Alt + Enter` | Start a new line before current line. |
| `Ctrl + Shift + J` | Join current line and next line. |
| `Shift + Enter` | Start a new line. |
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 437 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 734 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

-21
View File
@@ -1,21 +0,0 @@
# User Interface
Functions of the UI components.
## Main Menu
When you open AndroidIDE, this menu will be open.
### Create project
Read the [getting started](../getting_started.md#creating-a-new-project) doc.
### Open existing project
Read the [getting started](../getting_started.md#working-with-an-existing-project) doc.
### Terminal
Open the AndroidIDE terminal. You can install and use various Linux packages in terminal.
To exit the Terminal run `exit` command or use `Ctrl+D`.
### Preferences
Set your preferences for various things in AndroidIDE.
### Documentation
Open the documentation of AndroidIDE.
### Sponsor
You can support this project.
## Editor
Read the editor docs [here](./editor#readme).