Skip to content

Commit bbd0162

Browse files
authored
fix: correcting fuzzysearch to fileSearch from merge conflicts (#1543)
1 parent f7529bd commit bbd0162

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fuzzySearch.test.ts renamed to server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fileSearch.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as assert from 'assert'
2-
import { FuzzySearch } from './fuzzySearch'
2+
import { FileSearch } from './fileSearch'
33
import { testFolder } from '@aws/lsp-core'
44
import * as path from 'path'
55
import * as fs from 'fs/promises'
66
import { TestFeatures } from '@aws/language-server-runtimes/testing'
77
import { Features } from '@aws/language-server-runtimes/server-interface/server'
88

9-
describe('FuzzySearch Tool', () => {
9+
describe('FileSearch Tool', () => {
1010
let tempFolder: testFolder.TestFolder
1111
let testFeatures: TestFeatures
1212

@@ -35,7 +35,7 @@ describe('FuzzySearch Tool', () => {
3535
})
3636

3737
it('invalidates empty path', async () => {
38-
const fuzzySearch = new FuzzySearch(testFeatures)
38+
const fileSearch = new FileSearch(testFeatures)
3939
await assert.rejects(
4040
fileSearch.validate({ path: '', queryName: 'test' }),
4141
/Path cannot be empty/i,
@@ -75,8 +75,8 @@ describe('FuzzySearch Tool', () => {
7575
await tempFolder.write('fileB.md', '# fileB content')
7676
await tempFolder.write('fileC.js', 'console.log("fileC");')
7777

78-
const fuzzySearch = new FuzzySearch(testFeatures)
79-
const result = await fuzzySearch.invoke({
78+
const fileSearch = new FileSearch(testFeatures)
79+
const result = await fileSearch.invoke({
8080
path: tempFolder.path,
8181
queryName: 'txt',
8282
maxDepth: 0,
@@ -97,8 +97,8 @@ describe('FuzzySearch Tool', () => {
9797
await subfolder.write('fileB.txt', 'fileB content')
9898
await tempFolder.write('fileC.md', '# fileC content')
9999

100-
const fuzzySearch = new FuzzySearch(testFeatures)
101-
const result = await fuzzySearch.invoke({
100+
const fileSearch = new FileSearch(testFeatures)
101+
const result = await fileSearch.invoke({
102102
path: tempFolder.path,
103103
queryName: 'txt',
104104
})
@@ -124,8 +124,8 @@ describe('FuzzySearch Tool', () => {
124124
await subfolder1.write('level1.txt', 'level1 content')
125125
await subfolder2.write('level2.txt', 'level2 content')
126126

127-
const fuzzySearch = new FuzzySearch(testFeatures)
128-
const result = await fuzzySearch.invoke({
127+
const fileSearch = new FileSearch(testFeatures)
128+
const result = await fileSearch.invoke({
129129
path: tempFolder.path,
130130
queryName: 'txt',
131131
maxDepth: 1,
@@ -146,8 +146,8 @@ describe('FuzzySearch Tool', () => {
146146
await tempFolder.write('FileUpper.txt', 'upper case filename')
147147
await tempFolder.write('fileLower.txt', 'lower case filename')
148148

149-
const fuzzySearch = new FuzzySearch(testFeatures)
150-
const result = await fuzzySearch.invoke({
149+
const fileSearch = new FileSearch(testFeatures)
150+
const result = await fileSearch.invoke({
151151
path: tempFolder.path,
152152
queryName: 'file',
153153
maxDepth: 0,
@@ -166,8 +166,8 @@ describe('FuzzySearch Tool', () => {
166166
await tempFolder.write('FileUpper.txt', 'upper case filename')
167167
await tempFolder.write('fileLower.txt', 'lower case filename')
168168

169-
const fuzzySearch = new FuzzySearch(testFeatures)
170-
const result = await fuzzySearch.invoke({
169+
const fileSearch = new FileSearch(testFeatures)
170+
const result = await fileSearch.invoke({
171171
path: tempFolder.path,
172172
queryName: 'file',
173173
maxDepth: 0,
@@ -188,8 +188,8 @@ describe('FuzzySearch Tool', () => {
188188
await tempFolder.write('regular.txt', 'regular content')
189189
await nodeModules.write('excluded.txt', 'excluded content')
190190

191-
const fuzzySearch = new FuzzySearch(testFeatures)
192-
const result = await fuzzySearch.invoke({
191+
const fileSearch = new FileSearch(testFeatures)
192+
const result = await fileSearch.invoke({
193193
path: tempFolder.path,
194194
queryName: 'txt',
195195
})
@@ -205,7 +205,7 @@ describe('FuzzySearch Tool', () => {
205205

206206
it('throws error if path does not exist', async () => {
207207
const missingPath = path.join(tempFolder.path, 'no_such_directory')
208-
const fuzzySearch = new FuzzySearch(testFeatures)
208+
const fileSearch = new FileSearch(testFeatures)
209209

210210
await assert.rejects(
211211
fileSearch.invoke({ path: missingPath, queryName: '.*' }),
@@ -215,8 +215,8 @@ describe('FuzzySearch Tool', () => {
215215
})
216216

217217
it('expands ~ path', async () => {
218-
const fuzzySearch = new FuzzySearch(testFeatures)
219-
const result = await fuzzySearch.invoke({
218+
const fileSearch = new FileSearch(testFeatures)
219+
const result = await fileSearch.invoke({
220220
path: '~',
221221
queryName: '.*',
222222
maxDepth: 0,

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fuzzySearch.ts renamed to server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/fileSearch.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// FuzzySearch tool based on ListDirectory implementation
1+
// FileSearch tool based on ListDirectory implementation
22
import { CommandValidation, InvokeOutput, requiresPathAcceptance, validatePath } from './toolShared'
33
import { workspaceUtils } from '@aws/lsp-core'
44
import { Features } from '@aws/language-server-runtimes/server-interface/server'
@@ -7,15 +7,15 @@ import { DEFAULT_EXCLUDE_DIRS, DEFAULT_EXCLUDE_FILES } from '../../chat/constant
77
import { CancellationToken } from '@aws/language-server-runtimes/protocol'
88
const Fuse = require('fuse.js')
99

10-
export interface FuzzySearchParams {
10+
export interface FileSearchParams {
1111
path: string
1212
queryName: string
1313
maxDepth?: number
1414
caseSensitive?: boolean
1515
threshold?: number
1616
}
1717

18-
export class FuzzySearch {
18+
export class FileSearch {
1919
private readonly logging: Features['logging']
2020
private readonly workspace: Features['workspace']
2121
private readonly lsp: Features['lsp']
@@ -26,7 +26,7 @@ export class FuzzySearch {
2626
this.lsp = features.lsp
2727
}
2828

29-
public async validate(params: FuzzySearchParams): Promise<void> {
29+
public async validate(params: FileSearchParams): Promise<void> {
3030
if (params.maxDepth !== undefined && params.maxDepth < 0) {
3131
throw new Error('MaxDepth cannot be negative.')
3232
}
@@ -106,7 +106,7 @@ export class FuzzySearch {
106106

107107
public getSpec() {
108108
return {
109-
name: 'fuzzySearch',
109+
name: 'fileSearch',
110110
description:
111111
'Search for files and directories in a target path using fuzzy name matching.\n\n' +
112112
'## Overview\n' +

0 commit comments

Comments
 (0)