-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2879 from continuedev/dev
Autocomplete improvements
- Loading branch information
Showing
25 changed files
with
296 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
core/autocomplete/context/root-path-context/test/RootPathContextService.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { testRootPathContext } from "./testUtils"; | ||
|
||
const TEST_CASES = [ | ||
{ | ||
description: "function", | ||
fileName: "file1.ts", | ||
range: { | ||
start: { line: 10, character: 2 }, | ||
end: { line: 10, character: 24 }, | ||
}, | ||
positions: [ | ||
{ row: 9, column: 34 }, // Person | ||
{ row: 9, column: 44 }, // Address | ||
], | ||
}, | ||
{ | ||
description: "class method", | ||
fileName: "file1.ts", | ||
range: { | ||
start: { line: 22, character: 4 }, | ||
end: { line: 22, character: 30 }, | ||
}, | ||
positions: [ | ||
{ row: 13, column: 29 }, // BaseClass | ||
{ row: 13, column: 55 }, // FirstInterface | ||
{ row: 13, column: 72 }, // SecondInterface | ||
{ row: 21, column: 33 }, // Person | ||
{ row: 21, column: 43 }, // Address | ||
], | ||
}, | ||
]; | ||
|
||
describe("RootPathContextService", () => { | ||
describe("TypeScript should return expected snippets when editing inside a:", () => { | ||
test.each(TEST_CASES)( | ||
"should look for correct type definitions when editing inside a $description", | ||
async ({ fileName, range, positions }) => { | ||
await testRootPathContext("typescript", fileName, range, positions); | ||
}, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 14 additions & 2 deletions
16
core/autocomplete/context/root-path-context/test/typescript/file1.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
import { Address, Person } from "./types"; | ||
import { | ||
Address, | ||
Person, | ||
BaseClass, | ||
FirstInterface, | ||
SecondInterface, | ||
// @ts-ignore | ||
} from "./types"; | ||
|
||
function getAddress(person: Person): Address { | ||
return person.address; | ||
} | ||
|
||
class Group { | ||
class Group extends BaseClass implements FirstInterface, SecondInterface { | ||
people: Person[]; | ||
|
||
constructor(people: Person[]) { | ||
super(); | ||
this.people = people; | ||
} | ||
|
||
getPersonAddress(person: Person): Address { | ||
return getAddress(person); | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
core/autocomplete/context/root-path-context/test/typescript/types.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.