11<template >
22 <div class =" ast-explorer-root" >
3- <AstOptions v-model =" options" />
3+ <div class =" ast-tools" >
4+ <span class =" ast-tools__time" >{{ time }}</span
5+ ><AstOptions v-model =" options" />
6+ </div >
47 <div class =" ast-explorer" >
58 <MonacoEditor
69 ref =" sourceEditor"
@@ -33,8 +36,8 @@ export default {
3336 return {
3437 options: {
3538 showLocations: false ,
36- ecmaVersion: ' ' ,
37- jsonSyntax: ' ' ,
39+ ecmaVersion: " " ,
40+ jsonSyntax: " " ,
3841 },
3942 jsoncValue: ` // Welcome to jconc-eslint-parser!!
4043{
@@ -45,6 +48,7 @@ export default {
4548` ,
4649 astJson: {},
4750 modeEditor: " " ,
51+ time: " " ,
4852 }
4953 },
5054 watch: {
@@ -60,21 +64,27 @@ export default {
6064 methods: {
6165 refresh () {
6266 const options = {}
63- if (this .options .ecmaVersion ) {
67+ if (this .options .ecmaVersion ) {
6468 options .ecmaVersion = Number (this .options .ecmaVersion )
6569 }
66- if (this .options .jsonSyntax ) {
70+ if (this .options .jsonSyntax ) {
6771 options .jsonSyntax = this .options .jsonSyntax
6872 }
73+ const start = Date .now ()
6974 let ast
7075 try {
71- ast = jsoncEslintParser .parseForESLint (this .jsoncValue , options).ast
76+ ast = jsoncEslintParser .parseForESLint (
77+ this .jsoncValue ,
78+ options,
79+ ).ast
7280 } catch (e) {
7381 ast = {
7482 message: e .message ,
7583 ... e,
7684 }
7785 }
86+ const time = Date .now () - start
87+ this .time = ` ${ time} ms`
7888 const json = createAstJson (this .options , ast)
7989 this .astJson = json
8090 },
@@ -318,6 +328,13 @@ function isNode(value) {
318328 flex-direction : column ;
319329 height : 100% ;
320330}
331+ .ast-tools {
332+ display : flex ;
333+ text-align : right ;
334+ }
335+ .ast-tools__time {
336+ margin-right : auto ;
337+ }
321338.ast-explorer {
322339 min-width : 1px ;
323340 display : flex ;
0 commit comments