Skip to content

Commit 95dd3be

Browse files
author
Guillaume Chau
committed
Auto-complete special tokens
1 parent 1fb195c commit 95dd3be

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

src/devtools/App.vue

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
<template>
44
<div id="app" :class="{ app: true, dark: isDark }">
5+
<datalist id="special-tokens">
6+
<option v-for="(value, key) of specialTokens" :key="key" :value="value | specialTokenValue"></option>
7+
</datalist>
58
<div class="header">
69
<img class="logo" src="./assets/logo.png" alt="Vue">
710
<span class="message-container">
@@ -47,6 +50,7 @@
4750
import ComponentsTab from './views/components/ComponentsTab.vue'
4851
import EventsTab from './views/events/EventsTab.vue'
4952
import VuexTab from './views/vuex/VuexTab.vue'
53+
import { SPECIAL_TOKENS } from '../util'
5054
5155
import { mapState } from 'vuex'
5256
@@ -64,11 +68,16 @@ export default {
6468
vuex: VuexTab,
6569
events: EventsTab
6670
},
67-
computed: mapState({
68-
message: state => state.message,
69-
tab: state => state.tab,
70-
newEventCount: state => state.events.newEventCount
71-
}),
71+
computed: {
72+
...mapState({
73+
message: state => state.message,
74+
tab: state => state.tab,
75+
newEventCount: state => state.events.newEventCount
76+
}),
77+
specialTokens () {
78+
return SPECIAL_TOKENS
79+
}
80+
},
7281
methods: {
7382
switchTab (tab) {
7483
bridge.send('switch-tab', tab)
@@ -104,6 +113,9 @@ export default {
104113
tab () {
105114
this.$nextTick(this.updateActiveBar)
106115
}
116+
},
117+
filters: {
118+
specialTokenValue: value => JSON.stringify(value)
107119
}
108120
}
109121
</script>

src/devtools/components/DataField.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
ref="editInput"
2424
class="edit-input"
2525
v-model="editedValue"
26+
list="special-tokens"
2627
@keyup.esc="cancelEdit"
2728
@keyup.enter="submitEdit"
2829
>

src/util.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ export const UNDEFINED = '__vue_devtool_undefined__'
3939
export const INFINITY = '__vue_devtool_infinity__'
4040
export const NAN = '__vue_devtool_nan__'
4141

42+
export const SPECIAL_TOKENS = {
43+
UNDEFINED,
44+
INFINITY,
45+
NAN
46+
}
47+
4248
export function stringify (data) {
4349
return CircularJSON.stringify(data, replacer)
4450
}

0 commit comments

Comments
 (0)