tree-sitter / tree-sitter-typescript

TypeScript grammar for tree-sitter
MIT License
359 stars 109 forks source link

bug: it will be stuck bug: vue composition mode #291

Closed joel-xiao closed 5 months ago

joel-xiao commented 5 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

<template>
  <WrapperBox id="admin-database-box" title="数据库配置">
    <div class="admin-database-content">
      <span>原始数据来源</span>
      <el-radio-group class="admin-radio" v-model="enableDB" @change="onChange">
        <el-radio label="elasticsearch">Elasticsearch</el-radio>
        <el-radio label="alcor">Alcor</el-radio>
      </el-radio-group>
    </div>
  </WrapperBox>
</template>

<script setup>
import WrapperBox from "@/components/wrapper-box";

import { getCurrentInstance, onMounted, ref } from 'vue'
import { ElMessage } from 'element-plus'

const { proxy }  = getCurrentInstance();
const enableDB = ref('');

onMounted(() => {
  loadData();
});

function onChange() {
  onSave();
}

async function loadData() {
  const ret = await proxy.$getService('admin').getAlcorStatus();
  if (ret.result == 'ok' && ret.data) {
    enableDB.value = ret.data?.alcor ? 'alcor' : 'elasticsearch';
  }
}

async function onSave() {
  const data = {
    alcor: enableDB.value === 'alcor'
  };
  const ret = await proxy.$getService('admin').updateAlcorStatus(data);
  if (ret?.data == 'ok') {
    ElMessage({
      showClose: true,
      message: '修改状态成功',
      type: 'success',
    })
  } else {
    ElMessage({
      showClose: true,
      message: '修改状态失败',
      type: 'error',
    })
  }

}

</script>

<style lang="scss">
#admin-database-box {
  padding: 20px;

  .admin-database-content {
    margin-top: 10px;

    .admin-database-label {
      padding-right: 10px;
    }

    .admin-radio {
      display: inline-block;
      margin-left: 20px;
      transform: translateY(2px);
    }
  }
}
</style>

Steps To Reproduce/Bad Parse Tree

When accessing this file for operation.

Expected Behavior/Parse Tree

I hope he can use it normally, and it won't get stuck.

Repro

// Example code that causes the issue
function foo() {
  // Code that fails to parse, or causes an error
}
amaanq commented 5 months ago

this is not the vue parser, and your issue isn't clear