Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,35 @@
"default": true,
"description": "Determine whether to insert an emoji."
},
"debugger-for-console.emojiList": {
"type": "array",
"items": {
"type": "string"
},
"default": [
"🚀",
"🛸",
"🛰️",
"👑",
"🔭",
"✨",
"🍀",
"🍻",
"🍿",
"🍉",
"🔥",
"🥑",
"🎡",
"🍙",
"📦",
"📫",
"🍟",
"🍭",
"🍩",
"🌿"
],
"description": "Customize the list of emojis to randomly select from. You can add or remove emojis as you like."
},
"debugger-for-console.quote": {
"type": "string",
"enum": [
Expand Down
149 changes: 56 additions & 93 deletions playground/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,129 +7,92 @@ const str = 'Hello';

const reg = /abcdefg/;

const arr = ['a', 'b', 'c']
const multiArr = [
...arr,
...arr,
]
const arr = ['a', 'b', 'c'];
const multiArr = [...arr, ...arr];

const [...list] = [...arr]
const [...list] = [...arr];

const arrowFn = (..._args) => {}
const arrowFn = (..._args) => {};

const stringWithSpacesAndQuotes = `Hello\" \' \` World`
const stringWithSpacesAndQuotes = `Hello\" \' \` World`;

const obj = {
name: 'John',
age: 20,
}
name: 'John',
age: 20
};

const computedStyle = computed(() => {
const styles = {
...config.style,
};
const styles = {
...config.style
};

return styles;
return styles;
});

async function fnScope(length = obj['name'].length) {
const say = 'hello,' + 'world!';

const say = 'hello,' + 'world!';

const obj = {
name: 'John',
age: 20,
value: [
1,
2,
3,
]
}

const is = (
1 &&
2 ||
3
)

const arrowFn = (arr) => {

}
const obj = {
name: 'John',
age: 20,
value: [1, 2, 3]
};

const sortedEntries = Object.entries(obj).sort(
(a, b) => parseInt(a[1]) - parseInt(b[1]),
);
const is = (1 && 2) || 3;

obj.value?.[0]?.test();
const arrowFn = (arr) => {};

const res = await fetch('https://api.github.com/users/octocat', {
data: fn(data),
});
const sortedEntries = Object.entries(obj).sort((a, b) => parseInt(a[1]) - parseInt(b[1]));

Promise.resolve()
.then((res) => {
obj.value?.[0]?.test();

})
.catch((err) => {
const res = await fetch('https://api.github.com/users/octocat', {
data: fn(data)
});

})
Promise.resolve()
.then((res) => {})
.catch((err) => {});
}

watch(
() => preferences.theme.mode,
() => globalThis.updateTheme(getLatestTheme()),
() => preferences.theme.mode,
() => globalThis.updateTheme(getLatestTheme())
);

const veryLongStatement = window.name.includes('abc'.toUpperCase())[0].toLowerCase().includes('a')?.length

function initApp( Vue ) {
let app = new Vue({
router,
store,
i18n,
render: () => h(App),
})

const arr = new Array([
1,
2,
3,
])

setSelectedImage(result.assets[0].uri)

const METHODS = {
mount({
aaa,
bbb,
}) {
app = app.$mount('#app')
},

unmount() {
app.$destroy()

}
}
}
const veryLongStatement = window.name.includes('abc'.toUpperCase())[0].toLowerCase().includes('a')?.length;

if (Math.random() > 0.5) {
fnScope(
function initApp(Vue) {
let app = new Vue({
router,
store,
i18n,
render: () => h(App)
});

const arr = new Array([1, 2, 3]);

obj['name'].length,
setSelectedImage(result.assets[0].uri);

)
const METHODS = {
mount({ aaa, bbb }) {
app = app.$mount('#app');
},

unmount() {
app.$destroy();
}
};
}

if (Math.random() > 0.5) {
fnScope(obj['name'].length);
}

export function getTemplate(colors) {
const {
background,
foreground,
...theme
} = colors
const { background, foreground, ...theme } = colors;

theme.key ||= theme.css
theme.key ||= theme.css;

return theme
return theme;
}
11 changes: 10 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { commands } from 'vscode'
import { commands, workspace } from 'vscode'
import type { ExtensionContext, WorkspaceConfiguration } from 'vscode'

import { commandsMapping } from './commands/index'
Expand All @@ -16,6 +16,15 @@ export function activate(context: ExtensionContext): void {

// only update user config when extension is activated
updateUserConfig()

// auto update config when configuration changes
const configChangeListener = workspace.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration('debugger-for-console')) {
updateUserConfig()
}
})

context.subscriptions.push(configChangeListener)
}

export function deactivate(): void {
Expand Down
7 changes: 5 additions & 2 deletions src/features/random-emoji.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { resolvedConfig } from '../extension'

const EMOJIS = [
const DEFAULT_EMOJIS = [
'🚀',
'🛸',
'🛰️',
Expand All @@ -25,7 +25,10 @@ const EMOJIS = [

export function getRandomEmoji() {
if (resolvedConfig.get('emoji')) {
return EMOJIS[Math.floor(Math.random() * EMOJIS.length)]
const customEmojiList = resolvedConfig.get<string[]>('emojiList', [])
const emojiList = customEmojiList.length > 0 ? customEmojiList : DEFAULT_EMOJIS

return emojiList[Math.floor(Math.random() * emojiList.length)]
}

return ''
Expand Down