🐛 fix(vscode): React 规则在导入了 react 的 .ts / .js 文件上也启用,自定义钩子和钩子调用照常出卡片
This commit is contained in:
1 parent
2ccec54747
commit
9f736d92e7
23 files changed
+141
-36
No files matched your search
@@ -111,7 +111,7 @@ describe('路由筛选后展开函数体', () => {
|
||||
parsed,
|
||||
{ source, language, markers: [] },
|
||||
pythonZhTranslator,
|
||||
{ rules: [fastapiRule], report: (message) => { throw new Error(message) } },
|
||||
{ languageId: 'python', rules: [fastapiRule], report: (message) => { throw new Error(message) } },
|
||||
))
|
||||
const blocks = pageBlocks(views, source)
|
||||
const route = blocks.find(block => block.kind === 'fastapi.route')!
|
||||
|
||||
@@ -502,7 +502,7 @@ describe('跳到定义:TS / Python 源码里闪哪一处', () => {
|
||||
async function jump(adapter: LanguageAdapter, languageId: string, translator: Translator, source: string, needle: string, rules: readonly LibraryRule[] = []): Promise<{ plan: RevealPlan | undefined, flashed: string }> {
|
||||
const offset = source.indexOf(needle)
|
||||
expect(offset, needle).toBeGreaterThanOrEqual(0)
|
||||
const views: HostBlockView[] = await withBlocks(adapter, languageId, source, blocks => toBlockViews(blocks, { source, language: adapter, markers: [] }, translator, { rules, report: () => {} }))
|
||||
const views: HostBlockView[] = await withBlocks(adapter, languageId, source, blocks => toBlockViews(blocks, { source, language: adapter, markers: [] }, translator, { languageId, rules, report: () => {} }))
|
||||
const plan = revealInSource(views, source, source.slice(0, offset).split('\n').length - 1, offset)
|
||||
return { plan, flashed: flashed(views, plan, source) }
|
||||
}
|
||||
@@ -633,7 +633,7 @@ describe('跳到定义:TS / Python 源码里闪哪一处', () => {
|
||||
' return self.name',
|
||||
].join('\n')
|
||||
const views = await withBlocks(py, 'python', source, blocks =>
|
||||
toBlockViews(blocks, { source, language: py, markers: [] }, pythonZhTranslator, { rules: [sqlalchemyRule], report: () => {} }))
|
||||
toBlockViews(blocks, { source, language: py, markers: [] }, pythonZhTranslator, { languageId: 'python', rules: [sqlalchemyRule], report: () => {} }))
|
||||
const at = (needle: string): { plan: RevealPlan | undefined, flashed: string } => {
|
||||
const offset = source.indexOf(needle)
|
||||
const plan = revealInSource(views, source, source.slice(0, offset).split('\n').length - 1, offset)
|
||||
|
||||
Reference in new issue
Block a user