MetaMask / MetaMask/metamask-extension

Allow nested code fences

Open
#19,873 1 comment 0 reactions 0 assignees View on GitHub
area-buildSystem
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

We may want to consider allowing nested code fences, so we can avoid code looking like this due to more feature flags being added over time:

```
///: BEGIN:ONLY_INCLUDE_IN(snaps)
export function removeSnap(
snapId: string,
): ThunkAction {
return async (
dispatch: MetaMaskReduxDispatch,
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(keyring-snaps)
getState,
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(snaps)
) => {
dispatch(showLoadingIndication());
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(keyring-snaps)
const subjects = getPermissionSubjects(getState()) as {
[k: string]: { permissions: Record };
};

const isAccountsSnap =
subjects[snapId]?.permissions?.snap_manageAccounts !== undefined;
///: END:ONLY_INCLUDE_IN

(...)
```

Contributor guide

Open the contributing guide

Research direction

No file, parser, entry point, or test is named. Start by searching for handling of code fences and the ONLY_INCLUDE_IN markers, then determine the expected behavior for nested fences and add coverage showing that feature-flag filtering still produces valid code.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.