workspaced.com.importer

  • Declaration

    void start();

    Initializes the import parser. Call with {"cmd": "load", "components": ["importer"]}

  • Declaration

    void stop();

    Has no purpose right now.

  • get

    Declaration

    ImportInfo[] get(string code, int pos);

    Returns all imports available at some code position.

    Call With: {"subcmd": "get"}

  • add

    Declaration

    ImportModification add(string importName, string code, int pos, bool insertOutermost = true);

    Returns a list of code patches for adding an import. If insertOutermost is false, the import will get added to the innermost block.

    Call With: {"subcmd": "add"}

  • Declaration

    struct ImportModification;

    Information about how to add an import

    • Declaration

      string rename;

      Set if there was already an import which was renamed. (for example import io = std.stdio; would be "io")

    • Declaration

      CodeReplacement[] replacements;

      Array of replacements to add the import to the code

  • Declaration

    struct SelectiveImport;

    Name and (if specified) rename of a symbol

    • Declaration

      string name;

      Original name (always available)

    • Declaration

      string rename;

      Rename if specified

  • Declaration

    struct ImportInfo;

    Information about one import statement

    • Declaration

      string[] name;

      Parts of the imported module. (std.stdio -> ["std", "stdio"])

    • Declaration

      string rename;

      Available if the module has been imported renamed

    • Declaration

      SelectiveImport[] selectives;

      Array of selective imports or empty if the entire module has been imported