Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Category comments do not work when generating from simulator #10216

Open
filips123 opened this issue Oct 6, 2024 · 0 comments
Open

Category comments do not work when generating from simulator #10216

filips123 opened this issue Oct 6, 2024 · 0 comments

Comments

@filips123
Copy link

Bug Template

Describe the bug

When using auto-generation from the simulator, the category comments for namespaces do not work, as they are simply ignored.

To Reproduce

  1. Configure core lib to use auto-generated blocks (create sims.d.ts file, add it to pxt.json).

  2. Create a simulator file that exposes some blocks in a category:

    /**
     * Provides access to basic micro:bit functionality.
     */
    //% color=#1E90FF weight=116 icon="\uf00a"
    namespace pxsim.basic {
        /**
         * Repeat the code forever in the background
         * @param body code to execute
         */
        //% help=functions/forever weight=55
        //% blockId=device_forever block="forever" afterOnStart=true
        export function forever (body: RefAction): void {
            thread.forever(body)
        }
    
        /**
         * Pause for the specified time in milliseconds
         * @param ms how long to pause for, eg. 100, 200, 500, 1000, 2000
         */
        //% help=functions/pause weight=54
        //% blockId=device_pause block="pause (ms) %pause"
        export function pause (ms: number): void {
            if (isNaN(ms)) ms = 20
            thread.pause(ms)
        }
    }
  3. See that sims.d.ts does not contain the category comment:

    // Auto-generated from simulator. Do not edit.
    declare namespace basic {
        /**
         * Repeat the code forever in the background
         * @param body code to execute
         */
        //% help=functions/forever weight=55
        //% blockId=device_forever block="forever" afterOnStart=true
        //% shim=basic::forever
        function forever(body: () => void): void;
    
        /**
         * Pause for the specified time in milliseconds
         * @param ms how long to pause for, eg. 100, 200, 500, 1000, 2000
         */
        //% help=functions/pause weight=54
        //% blockId=device_pause block="pause (ms) %pause"
        //% shim=basic::pause
        function pause(ms: number): void;
    
    }
    
    // Auto-generated. Do not edit. Really.

Expected behavior

The category comment should be present and applied correctly in the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant