Skip to content

Conversation

Triumph-light
Copy link

Description

Main function: Add splitpane to support multi block display

Change point:

  1. Transformation of parser module: Change the current parser to an array type and store the corresponding parser for the display container
  2. Transformation of options module: Transform parserOptions and rawOptions into a {parserid: parserinfo} structure to store corresponding options information for local storage of options in the future. Since parserOptions was previously computed, it is now a complex data type that cannot be processed by computed, so it is implemented by watch
  3. UI module modification: Added expLayout to store corresponding display layouts, switching layouts will clear information based on the current Parser

Linked Issues

issue 140

Additional context

  1. Is the current structural design reasonable, and are there any other issues or hidden logic bugs with the type.
  2. The language of inputContainer is determined by using the currently active tab to determine whether this interaction is OK

Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

vercel bot commented Jun 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ast-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 13, 2025 9:25am

@Triumph-light
Copy link
Author

Now there are still some bugs and ts type that have not been repaired. I will fix them and then see if the code is optimized.

@sxzz
Copy link
Owner

sxzz commented Jun 28, 2025

  1. There are many bugs need to be fixed.
    • Try switch language, editor is disappeared.
    • Padding and text color, use label for parser name instead of id.
    • image
  2. Use left-right layout by default

Copy link
Owner

@sxzz sxzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix TS errors as well.

@@ -1,3 +1,6 @@
{
"editor.formatOnSave": true
"editor.codeActionsOnSave": {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert these changes.

app.vue Outdated
@@ -1,4 +1,6 @@
<script setup lang="ts">
import { expLayout } from '~/state/ui.js'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { expLayout } from '~/state/ui.js'
import { expLayout } from '~/state/ui'

import { currentParser } from '~/state/parser/parser'
import { parsersOptions } from '~/state/parser/options'
import { currentParsers } from '~/state/parser/parser'
import { activeTab } from '~/state/ui.js'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { activeTab } from '~/state/ui.js'
import { activeTab } from '~/state/ui'

@@ -0,0 +1,18 @@
<template>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use UnoCSS icon.

public/.svg Outdated
@@ -0,0 +1 @@
<svg t="1750689713539" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="16875" width="200" height="200"><path d="M170.666667 896a42.666667 42.666667 0 0 1-42.666667-42.666667V170.666667a42.666667 42.666667 0 0 1 42.666667-42.666667h682.666666a42.666667 42.666667 0 0 1 42.666667 42.666667v682.666666a42.666667 42.666667 0 0 1-42.666667 42.666667H170.666667z m170.666666-469.333333H213.333333v384h128v-384z m469.333334 0h-384v384h384v-384z m0-213.333334H213.333333v128h597.333334V213.333333z" fill="#000000" p-id="16876"></path></svg>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this?

utils/index.ts Outdated
@@ -0,0 +1,21 @@
export function getIntersection<T>(arr1: T[], arr2: T[]): T[] {
// 优化:对较小数组建 Set,减少内存占用
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the Chinese comment.

state/url.ts Outdated
@@ -1,11 +1,13 @@
// import { rawOptions, setDefaultOptions } from './parser/options'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comments

state/ui.ts Outdated
@@ -18,6 +19,13 @@ export const outputView = useLocalStorage<'tree' | 'json'>(
'tree',
)

export const sideBarAvailable = computed(
() => currentParser.value.options.configurable && !!currentParserGui.value,
export const expLayout = ref<Layout>('layout1')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea about expLayout. Use a more clear name, and value.

@Triumph-light
Copy link
Author

There are a few details and bugs that need to be addressed. I will continue your work when I have some free time.

I also found some problems when I was using it, and I will also fix and optimize it together.

@outslept
Copy link
Contributor

outslept commented Jul 12, 2025

FYI clicking this produces 2 tabs

image

Result of the click, I don't think this is intended to work like that

image

@Triumph-light
Copy link
Author

仅供参考,单击此按钮将产生 2 个标签

图像 点击的结果,我不认为这是应该这样运作的 图像

What do you think it should be? Do you expect that there will be two different parsers after clicking?
I think it's just a display of multiple layouts, similar to how VSCode splits files. The specific content is determined by the user's own choice.
The advantage of this is that users can have more autonomy in their operations.
When there is only one parser for certain data formats, it can still be compatible and allow for horizontal comparisons, such as simultaneous observation of tree and JSON formats.

@outslept
Copy link
Contributor

I totally get the idea. I was talking that going to this mode with presumably empty localstorage & no tabs - creates 2 tabs for parser output (displaying the exact same info). Shouldn't it be a single tab for 1 parser? Why do we double it for this state?

@Triumph-light
Copy link
Author

I totally get the idea. I was talking that going to this mode with presumably empty localstorage & no tabs - creates 2 tabs for parser output (displaying the exact same info). Shouldn't it be a single tab for 1 parser? Why do we double it for this state?

How to understand "a single tab for 1 parser". I don't quite understand this.

You mean that when you switched to this kind of multi-tab for the first time, you parsed the same analysis twice, right? This is indeed a problem.

@Triumph-light Triumph-light marked this pull request as ready for review July 27, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants