microsoft / microsoft/pxt

Code card rendering should use api name from 'blockAliasFor='

Open
#10,852 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.3k
Forks
641
Avg merge
12h 4m
Merged PRs (30d)
57

Description

Rendering of code cards uses the api name from the decompile info even when the attrs have blockAliasFor set. I'm thinking that if both the blocks and ```sig rendering use the alias name, the TS code cards should do the same?

The example here shows the api name with the _ while the alias name is set as onItemDropped.

//% blockId=events_onItemDropped
//% blockAliasFor="events.onItemDropped"
//% block="on $item dropped with $count"
//% draggableParameters="reporter"
//% group="Items"
//% weight=80 help=events/on-item-dropped
export function _onItemDropped(handler: (item: number, count: number) => void) {
    events.onItemDropped(handler);
}
image

RE: https://github.com/microsoft/pxt-minecraft/pull/2846#issuecomment-3222206254

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the code card rendering path for TypeScript code cards, then compare how block rendering and sig rendering resolve blockAliasFor. Use the provided onItemDropped example to check the displayed API name. Done means the code card uses onItemDropped rather than _onItemDropped when the alias is set.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.