Skip to content

MQL Tools Auto-completion Fails for Struct Members When Using this. Syntax in VS Code Extension #115

@Arash-Hashemi

Description

@Arash-Hashemi

I am experiencing an issue with the IntelliSense auto-completion feature in my Visual Studio Code extension for MetaTrader 5 (MQL5) development.

Problem Description

Auto-completion suggests struct members correctly in the standard case but fails in a specific scenario involving the this keyword.

  1. Normal Case (Working):

    • When I type the name of a struct followed by a dot ., the members of that struct are correctly suggested.
    • Example: mystruct. ✅ → Suggestions appear.
  2. Problem Case 1 (Not Working):

    • When I use the this keyword (which is a pointer to the current class instance) followed by a dot . and the struct name, auto-completion fails after the second dot.
    • Example: this.mystruct. ❌ → No suggestions appear.
  3. Problem Case 2 (Working but Invalid):

    • If I use the pointer operator -> with this (i.e., this->mystruct.), auto-completion does work and suggests the struct members correctly.
    • However, this syntax is invalid in MQL5 and results in compilation errors:
      • '>' - operand expected
      • '-' - illegal operation use

Summary of the Issue

The correct, error-free syntax this.mystruct. does not trigger auto-completion, while the incorrect syntax this->mystruct. does. This forces developers to manually type all member names, reducing productivity and increasing the chance of errors.

Expected Behavior

IntelliSense should provide auto-completion for struct members when using the valid this.mystruct. syntax, just as it does for a plain struct variable.

Request

Could you please investigate why the this. syntax breaks the auto-completion chain and provide a fix so that it works as expected?

Thank you for your time and assistance.

Best regards,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions