Skip to content

Commit

Permalink
perf: 过滤掉不需要的文件
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-He95 committed Jul 12, 2023
1 parent 87a3e2d commit 889c956
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ let UINames: any = []
let optionsComponents: any = null
let UiCompletions: any = null
let cacheMap: any = {}

export function activate(context: vscode.ExtensionContext) {
const filter = ['javascript', 'javascriptreact', 'typescriptreact', 'html', 'vue', 'css']
const filter = ['javascript', 'javascriptreact', 'typescriptreact', 'vue', 'svelte']
context.subscriptions.push(addEventListener('activeText-change', (editor: vscode.TextEditor) => {
// 找到当前活动的编辑器
const visibleEditors = vscode.window.visibleTextEditors
Expand Down Expand Up @@ -43,8 +42,15 @@ export function deactivate() {
cacheMap = null
}

const filters = ['js', 'ts', 'jsx', 'tsx', 'vue', 'svelte']

function findUI() {
const cwd = vscode.window.activeTextEditor?.document.uri.fsPath
const suffix = cwd?.split('.').slice(-1)[0]

if (!suffix || !filters.includes(suffix))
return

const values = Object.values(cacheMap) as any
if (values[0] && values[0].includes(cwd))
return
Expand Down

0 comments on commit 889c956

Please sign in to comment.