log-rune
Dominic Gannaway 10 months ago
parent 22b5289a42
commit f2162c0c26

@ -299,29 +299,42 @@ export const javascript_visitors_runes = {
return b.call('$.effect_active');
}
if (rune === '$log') {
if (state.options.dev) {
const args = /** @type {import('estree').Expression[]} */ (
node.arguments.map((arg) => visit(arg))
);
return b.call('$.log', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
}
if (rune === '$log.trace') {
if (state.options.dev) {
const args = /** @type {import('estree').Expression[]} */ (
node.arguments.map((arg) => visit(arg))
);
return b.call('$.log_trace', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
}
if (rune === '$log.break') {
if (state.options.dev) {
const args = /** @type {import('estree').Expression[]} */ (
node.arguments.map((arg) => visit(arg))
);
return b.call('$.log_break', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
}
if (rune === '$log.table') {
if (state.options.dev) {
const args = /** @type {import('estree').Expression[]} */ (
node.arguments.map((arg) => visit(arg))
);
return b.call('$.log_table', b.thunk(b.array(args)));
}
return b.unary('void', b.literal(0));
}
next();
}

@ -205,15 +205,20 @@
return {
from: word.from - 1,
options: [
{ label: '$state', type: 'keyword', boost: 5 },
{ label: '$props', type: 'keyword', boost: 4 },
{ label: '$derived', type: 'keyword', boost: 3 },
snip('$effect(() => {\n\t${}\n});', { label: '$effect', type: 'keyword', boost: 2 }),
{ label: '$state', type: 'keyword', boost: 10 },
{ label: '$props', type: 'keyword', boost: 9 },
{ label: '$derived', type: 'keyword', boost: 8 },
snip('$effect(() => {\n\t${}\n});', { label: '$effect', type: 'keyword', boost: 7 }),
snip('$effect.pre(() => {\n\t${}\n});', {
label: '$effect.pre',
type: 'keyword',
boost: 1
})
boost: 6
});
{ label: '$effect.active', type: 'keyword', boost: 5 },
{ label: '$log', type: 'keyword', boost: 4 },
{ label: '$log.break', type: 'keyword', boost: 3 },
{ label: '$log.trace', type: 'keyword', boost: 2 },
{ label: '$log.table', type: 'keyword', boost: 1 },
]
};
}

Loading…
Cancel
Save