🐛 fix(vscode): React 组件卡片、事件处理函数卡片右上角补上调用树按钮
- 组件卡片、事件处理函数卡片传 calls,被规则认领后照样能看调用树(同自定义钩子卡片) - 编辑器准备不出调用层级(memo / forwardRef 包着的组件)改查引用时,JSX 开始标签也算调用处;闭合标签、成员标签、import、类型位置、当值传递的不算 - 查引用的 lookup 加上取名字前面的文字,判断仍只在 isCallSite 一处
This commit is contained in:
1 parent
5098951c74
commit
57675665a7
8 files changed
+100
-26
No files matched your search
@@ -93,7 +93,7 @@ describe('链式调用卡片发给页面', () => {
|
||||
})
|
||||
|
||||
describe('react 钩子卡片发给页面', () => {
|
||||
it('钩子返回值带着按来源分的淡底;属性表里各项的操作查的名字、不算的范围同别的下标从块第一行的行首算,键原样带着', async () => {
|
||||
it('组件卡片带着能看调用树;钩子返回值带着按来源分的淡底;属性表里各项的操作查的名字、不算的范围同别的下标从块第一行的行首算,键原样带着', async () => {
|
||||
const ts = createTypeScriptAdapter(WASM_DIR)
|
||||
const source = [
|
||||
'import { useEffect, useState } from "react";',
|
||||
@@ -106,7 +106,10 @@ describe('react 钩子卡片发给页面', () => {
|
||||
].join('\n')
|
||||
const views = await withBlocks(ts, 'typescriptreact', source, blocks =>
|
||||
toBlockViews(blocks, { source, language: ts, markers: [] }, typescriptZhTranslator, { languageId: 'typescriptreact', rules: [reactRule], report: () => {} }))
|
||||
const [state, id] = pageBlocks(views, source)[1].children
|
||||
const component = pageBlocks(views, source)[1]
|
||||
expect(component.kind).toBe('react.component')
|
||||
expect(component.callTree).toEqual({})
|
||||
const [state, id] = component.children
|
||||
expect(state.kind).toBe('react.state')
|
||||
expect(state.callTree).toBeUndefined()
|
||||
const base = source.indexOf(' const [n')
|
||||
|
||||
Reference in new issue
Block a user