Q Remix Documentation
  • INTRODUCTION
    • Welcome to Q-Remix IDE's documentation
    • Navigating Q-Remix
    • Using Q-Remix Safely
    • Q-Remix Links
    • FAQ
  • CORE MODULES
    • File Explorer
    • Search in Files
    • Settings
    • Editor
    • Autocompletion & Suggestions in Editor
    • Contract Creation & Compiling
    • Deploy & Run
    • Accessing and Interacting with the Deployed Contracts
    • Terminal
  • Solidity modules
    • Solidity Compiler
    • AI Assistant
    • Q-Remix Chatbot
    • AI Code Generation
    • Multi AI Models switch
    • AI Project Generation
    • Debugger
  • Guide
    • Creating and Deploying a Contract
    • Importing and Loading Source Files in Solidity
  • Unit Testing
    • Testing by Example
  • MISCELLANEOUS
    • Q-Remix as Code Viewer
    • Code Contribution Guide
Powered by GitBook
On this page
  • Feature Overview
  • Benefits
  • Future Improvements
  1. CORE MODULES

Autocompletion & Suggestions in Editor

PreviousEditorNextContract Creation & Compiling

Last updated 14 days ago

The Autocompletion and Suggestions feature in our Monaco Editor integration provides developers with intelligent, context-aware code completion for Solidity smart contracts. This feature leverages the Monaco Editor's capabilities, augmented by a custom backend API, to offer real-time suggestions, snippets, and ghost text, enhancing coding efficiency and reducing errors during smart contract development.

Feature Overview

This feature is designed to assist developers by providing:

  • Context-Aware Autocompletion: Suggestions are generated based on the current code context, such as keywords, function signatures, and Solidity-specific constructs (e.g., contract, function, event).

  • Code Snippets: Predefined templates for common Solidity patterns like contracts, functions, events, and modifiers, which can be inserted with a single selection.

  • Ghost Text: Inline preview of suggested code that can be accepted with a Tab key press, offering a seamless coding experience.

  • Custom Suggestion Box: A UI component displaying detailed suggestions with documentation, types, and icons, triggered by specific keywords or key combinations (e.g., Ctrl+Shift+S).

Key Features in Detail

1. Suggestion Box

  • Trigger: Activated via Ctrl+Shift+S or automatically based on context.

  • Content: Displays a list of suggestions with:

    • Icons: Visual indicators for types (e.g., ⚡ for functions, 📄 for contracts).

    • Documentation: Brief descriptions of each suggestion.

    • Types: Indicates whether the suggestion is a function, contract, event, etc.

  • Example: Suggestions for contract include a full template with state variables, events, and functions.

2. Autocompletion

  • Trigger Characters: Suggestions are triggered by characters like ., (, {, =, and even a space, ensuring seamless integration into the coding workflow.

  • Solidity-Specific Suggestions: Includes keywords (public, private), types (uint256, address), and snippets for common patterns.

  • Example: Typing modifier suggests onlyOwner with a complete implementation, as shown in the screenshot.

3. Ghost Text

  • Behavior: Displays a preview of the suggested code inline, styled in italic with a dotted underline.

  • Interaction: Press Tab to accept the suggestion, or continue typing to ignore it.

  • Performance: Suggestions are fetched with a 300ms debounce to avoid overwhelming the backend.

Benefits

  • Faster Development: Focus more on logic, less on boilerplate.

  • Error Reduction: Use verified and complete code patterns.

  • Learning Tool: Great for beginners with inline docs and context.

  • Custom & AI Suggestions: Supports both hardcoded templates and backend-powered, context-sensitive suggestions.

Future Improvements

  • Enhance AI suggestion accuracy by integrating a more powerful model.

  • Add support for more languages beyond Solidity.

  • Improve suggestion ranking based on user history and project context.

  • Optimize backend performance for larger codebases.

This feature significantly enhances the developer experience by combining the power of Monaco Editor with intelligent, context-aware suggestions tailored for Solidity development.

Suggestion box
Autocompletion-Ghost box