Skip to content

Commit 103a9fb

Browse files
committed
Extract ignored lock files into a shared constant and expand the list of excluded lock files across the workspace and search utilities
1 parent 3c560e7 commit 103a9fb

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

apps/editor/src/commands/search-files-for-context-command/utils/search-files-by-term.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ import * as path from 'path'
22
import * as fs from 'fs'
33
import { Logger } from '@shared/utils/logger'
44
import { create_search_regex } from './create-search-regex'
5-
6-
const IGNORED_FILES = new Set([
7-
'pnpm-lock.yaml',
8-
'package-lock.json',
9-
'yarn.lock'
10-
])
5+
import { IGNORED_LOCK_FILES } from '@/constants/ignored-lock-files'
116

127
export const search_files_by_term = async (params: {
138
files: string[]
@@ -20,7 +15,7 @@ export const search_files_by_term = async (params: {
2015
try {
2116
const file_name = path.basename(file_path)
2217

23-
if (IGNORED_FILES.has(file_name)) {
18+
if (IGNORED_LOCK_FILES.includes(file_name)) {
2419
continue
2520
}
2621

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export const IGNORED_LOCK_FILES = [
2+
'package-lock.json',
3+
'pnpm-lock.yaml',
4+
'yarn.lock',
5+
'Cargo.lock',
6+
'Gemfile.lock',
7+
'composer.lock'
8+
]

apps/editor/src/context/providers/workspace/workspace-provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
CONTEXT_CHECKED_TIMESTAMPS_STATE_KEY,
88
RANGES_STATE_KEY
99
} from '@/constants/state-keys'
10+
import { IGNORED_LOCK_FILES } from '@/constants/ignored-lock-files'
1011
import { natural_sort } from '@/utils/natural-sort'
1112
import { dictionary } from '@shared/constants/dictionary'
1213
import { Logger } from '@shared/utils/logger'
@@ -1612,7 +1613,7 @@ export class WorkspaceProvider
16121613
this._user_ignore_patterns.add(patterns)
16131614
}
16141615

1615-
this._user_ignore_patterns.add('node_modules')
1616+
this._user_ignore_patterns.add(['node_modules', ...IGNORED_LOCK_FILES])
16161617

16171618
const allow_patterns = config.get<string[]>('allowPatterns')
16181619
this._user_allow_patterns = ignore()

0 commit comments

Comments
 (0)