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

### @diffs doesn't seem to work in tutorials #8667

Open
Yngel72 opened this issue Jan 24, 2022 · 2 comments
Open

### @diffs doesn't seem to work in tutorials #8667

Yngel72 opened this issue Jan 24, 2022 · 2 comments
Assignees
Labels

Comments

@Yngel72
Copy link

Yngel72 commented Jan 24, 2022

The command "### @diffs true" invariably seems to generate the error message "Unknown command: @diffs" when used as described in the documentation. Starting a document like this, for instance, will generate the error message:

@activities true

@diffs true

scene.setBackgroundColor(9)
let mySprite = sprites.create(img`
    . . . . . . . . . . . . . . . . 
    . . . . . . . . . . . . . . . . 
    . . . . . . . . . b 5 5 b . . . 
    . . . . . . b b b b b b . . . . 
    . . . . . b b 5 5 5 5 5 b . . . 
    . b b b b b 5 5 5 5 5 5 5 b . . 
    . b d 5 b 5 5 5 5 5 5 5 5 b . . 
    . . b 5 5 b 5 d 1 f 5 d 4 f . . 
    . . b d 5 5 b 1 f f 5 4 4 c . . 
    b b d b 5 5 5 d f b 4 4 4 4 b . 
    b d d c d 5 5 b 5 4 4 4 4 4 4 b 
    c d d d c c b 5 5 5 5 5 5 5 b . 
    c b d d d d d 5 5 5 5 5 5 5 b . 
    . c d d d d d d 5 5 5 5 5 d b . 
    . . c b d d d d d 5 5 5 b b . . 
    . . . c c c c c c c c b b . . . 
    `, SpriteKind.Player)
controller.moveSprite(mySprite)# tutorial

So far, I haven't found a working example of @diffs in any code I've browsed through on GitHub.

Using "// @highlight" within the code on the line above the block you need to highlight works as described in the documentation for highighting blocks, but is there a way to highlight variables that's been changed or added within blocks?

@shakao
Copy link
Contributor

shakao commented Jan 28, 2022

Ah, so I think even with diffs on, it will highlight the entire block and not just the changed variable. But here's an example of the @diffs flag that you can try in the tutorial tool!:

### @activities true
### @diffs true

# My Tutorial

## My Activity

### Step 1

Here is some text.

```blocks 
let mySprite = sprites.create(img`.`, SpriteKind.Player)
```

### Step 2

This is the second step
    
```blocks
let mySprite = sprites.create(img`.`, SpriteKind.Player)
controller.moveSprite(mySprite)
```

### Step 3

Congratulations, you did it!
    
```blocks
let myEnemy: Sprite = null;
let mySprite = sprites.create(img`.`, SpriteKind.Player)
controller.moveSprite(myEnemy)
```

```template
scene.setBackgroundColor(9)
let mySprite = sprites.create(img`
    . . . . . . . . . . . . . . . . 
    . . . . . . . . . . . . . . . . 
    . . . . . . . . . b 5 5 b . . . 
    . . . . . . b b b b b b . . . . 
    . . . . . b b 5 5 5 5 5 b . . . 
    . b b b b b 5 5 5 5 5 5 5 b . . 
    . b d 5 b 5 5 5 5 5 5 5 5 b . . 
    . . b 5 5 b 5 d 1 f 5 d 4 f . . 
    . . b d 5 5 b 1 f f 5 4 4 c . . 
    b b d b 5 5 5 d f b 4 4 4 4 b . 
    b d d c d 5 5 b 5 4 4 4 4 4 4 b 
    c d d d c c b 5 5 5 5 5 5 5 b . 
    c b d d d d d 5 5 5 5 5 5 5 b . 
    . c d d d d d d 5 5 5 5 5 d b . 
    . . c b d d d d d 5 5 5 b b . . 
    . . . c c c c c c c c b b . . . 
    `, SpriteKind.Player)
controller.moveSprite(mySprite)
```

@Yngel72
Copy link
Author

Yngel72 commented Jan 31, 2022

Thanks! I really appreciate the help. It kind of works using the tutorial tool (For some reason, some of the blocks that were already present will sometimes be highlighted as well as the newly added ones), but it still seems a bit wonky when editing directly from the JavaScript tab in MakeCode Arcade. I'm still getting the "Unknown command" error. Maybe it only works with the Beta version?
Anyway, I'm quite happy with the functionality of the "highlights" command, it gets the job done in a consistent way. I think I'll stick to that for now.

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

No branches or pull requests

3 participants