Code editor
Write and edit the JavaScript of a function in Azion Console, in a Monaco editor with syntax highlighting, IntelliSense, and debugging.
The code editor is where you write the JavaScript of a function in Azion Console. It is built on the Monaco Editor, the editor used by VS Code. Each function carries its code in the Code tab, which opens with placeholder code that you replace. Save stores the code and makes the function available to instantiate on an application. Editing a function requires the Edit Functions permission on the account. For the path that reaches the editor from Azion Console, refer to Quickstart.
Editor features
The code editor carries these Monaco Editor features:
- Syntax highlighting
- IntelliSense
- Debugging
The editor supports the globals and types and the Web APIs that Azion Runtime implements. The context menu of the editor also carries the Format Document command.
Code preview
The code editor shows the response of the function while you write it, without a deployment. The preview calls a PreviewProvider function in the source code, which builds a simulated request. For the auxiliary function and the formats the preview renders, refer to Preview deployment.
ChatGPT integration
The code editor calls the ChatGPT APIs, so code assistance runs inside the editor and not in a separate tab. The integration covers:
- Code explanation
- Code generation
- Code refactor
- Debugging
The integration uses credentials from your own OpenAI account, declared in the source code of the function. For the credentials and the editor commands, refer to ChatGPT integration.