IntelliSense code editing
Mbed Studio uses the Language Server Protocol (LSP) and includes a variety of IntelliSense code editing features to help you code faster and more efficiently. The IntelliSense features are only available when a platform has been selected and a program has been set as active. IntelliSense is available for stand-alone files as well as for multiple files that are part of the same program.
The following features are currently available in Mbed Studio.
When in the editor pane, the Format Document and Format Selection options are available in the right-click menu to help you indent your code correctly. If you select Format Document, the indentation is corrected in the whole file you are currently working on. If you select Format Selection, then only the line or lines of code you selected are indented properly. You can change the indentation by clicking the Spaces / Tab Size option on the right-hand side of the status bar. Spaces / Tab Size option. Clicking Spaces or Tab Size opens a drop-down list at the top left of the editor. Select Indent Using Spaces / Indent Using Tabs in the drop-down list, then select the number of spaces / tabs to use for the indentation. Select the number of spaces / tabs.
Bracket and quote highlighting
The editor will by default highlight the matching brackets or quotes when your cursor is over them.
Auto-completion and signature help
When you press CTRL + Space or start typing a keyword, type, function, variable name, or other program element that Mbed Studio recognizes, the editor offers to complete what you are typing. A drop-down list with possible options opens where you can select what you need. An icon that represents the code entity of each option (for example namespace, function, class or variable) is shown on the left. You will also see signature help for parameters of functions. Clicking the "i" icon gives you more details on each option.
Auto-completion and "i" icon. The editor automatically completes brackets and quotes as well.
Additional information about the elements you are hovering over in your code are displayed in popups.
When, for example, a bracket or semi-colon is missing in your code, a light bulb icon appears above the line where the problem is. Click the light bulb and check the correction suggested. If you are happy with the suggestion, click the Apply fix popup message. Apply fix example.
Go to Definition, Go to Type Definition and Peek Definition
- Go to Definition: Hover over a variable or function declaration, right-click, then select Go to Definition to open the file where it is defined in a separate tab.
- Peek Definition: This option also takes you to the definition of a variable or function but the definition is presented inline.
- Go to Type Definition: With this option, you can jump to the type definition of a symbol. Peek Definition option.
If you want to rename an element in your code such as a class, a function, a variable and so on, use the Change All Occurrences option. Select an element, right-click and select Change All Occurrences, then rename the element. It is renamed everywhere in the file you are currently working on. The Rename Symbol option allows you to rename an element across files.
To perform a focused search of your code and quickly find symbols, use the Go to Symbol option. In the editor, right-click and select Go to Symbol. A small window is displayed at the top left of the editor and the available symbols in the file you are currently working on appear in a drop-down list. Select a symbol to directly go to it. Go to Symbol option.
When problems are detected in your code, they are displayed in the Problems tab. To open the tab, go the View menu and select Problems or click the Problems option in the status bar. Problems option.
The Outline pane gives you a tree view of the classes, variables and functions in the current file.
From the View menu, select Outline to open the Outline pane on the right-hand side of the screen. Click the elements in the Outline pane to navigate through the file.
In the Outline view, orange icons represent classes, white icons represent variables and purple icons represent functions.
Find all references
To find all references to a code element throughout all of the files in an active program, hover over the element, right-click and select Find All References. An inline editor opens below the element. You can navigate between references and make edits in the editor. Double-click a reference in the inline editor to navigate to the reference in the main editor.
You can edit directly in the inline editor.