Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
17d1a6b
tests for moce to another file
navya9singh Mar 7, 2023
98bfb65
Works in moving to an existing blank file
navya9singh Mar 7, 2023
ea8de38
new change
navya9singh Mar 7, 2023
393b093
test2 almost works
navya9singh Mar 10, 2023
fe30722
Part 2 works for test2
navya9singh Mar 13, 2023
f54ece7
generating list of file with test cases
navya9singh Mar 21, 2023
9bfd52d
Test cases working as expected
navya9singh Mar 26, 2023
58f2c9d
cleanup of tests and renaming to "move to file"
navya9singh Mar 26, 2023
e10b530
Merge branch 'main' of https://github.com/microsoft/TypeScript into t…
navya9singh Mar 26, 2023
5603210
Resolving merge conflict changes
navya9singh Mar 26, 2023
dffe218
all tests pass
navya9singh Mar 27, 2023
28d8258
duplicate code cleanup
navya9singh Mar 27, 2023
6ff1f26
deleting 'triggerReason' property
navya9singh Mar 28, 2023
4f09254
added export and deleted duplicated code
navya9singh Mar 30, 2023
0866cfc
move exports to new file, fix doChange as needed
navya9singh Mar 30, 2023
6884d00
combining createnewFile with moveToFileAndNewFile
navya9singh Mar 30, 2023
f98a457
removing `changeExistingFile` from textChanges
navya9singh Mar 31, 2023
eec2935
fix for an 'allowImportingTsExtensions' bug
navya9singh Apr 5, 2023
9fd4778
cleanup, fixes after removing `changeExistingFile`
navya9singh Apr 5, 2023
b1cf74c
fixi testcases & add getSynthesizedDeepClone
navya9singh Apr 5, 2023
2274ca1
Merge branch 'main' of https://github.com/microsoft/TypeScript into t…
navya9singh Apr 5, 2023
53c5fa2
test needs to be fixed
navya9singh Apr 5, 2023
93bca9c
Ensure cloned NodeArrays have a text range set
andrewbranch Apr 6, 2023
7cb66dd
fixes for suggesting a list of files
andrewbranch Apr 5, 2023
63d2a83
Ensure cloned NodeArrays have a text range set
andrewbranch Apr 6, 2023
a681bc9
Allow ImportAdder to insert imports into a new file
andrewbranch Apr 5, 2023
52674ac
importAdder changes for MoveToFile
navya9singh Apr 7, 2023
a7aad23
Merge branch 'task29988' of https://github.com/microsoft/TypeScript i…
navya9singh Apr 7, 2023
5666218
adding, cleaning up tests
navya9singh Apr 10, 2023
7a12e5f
Merge branch 'main' of https://github.com/microsoft/TypeScript into t…
navya9singh Apr 10, 2023
9c5efd5
Reverting changes for impoart adder for new file
navya9singh Apr 10, 2023
6068ec4
Accepting baselines
navya9singh Apr 10, 2023
9387f67
FmoduleSpecifier fixes and cleanup
navya9singh Apr 10, 2023
4862931
Not needed
navya9singh Apr 10, 2023
f0e870d
Adressing pr comments
navya9singh Apr 12, 2023
b010444
adding new tests
navya9singh Apr 12, 2023
5ecf83d
Fixing errors, accepting baselines
navya9singh Apr 13, 2023
567a3c5
Removing exports, small changes
navya9singh Apr 13, 2023
8af19ff
Adressing pr comments
navya9singh Apr 17, 2023
08b9243
Merge branch 'task29988' of https://github.com/microsoft/TypeScript i…
navya9singh Apr 17, 2023
6675cb7
Merge branch 'main' of https://github.com/microsoft/TypeScript into t…
navya9singh Apr 17, 2023
f4e73aa
Fixing baselines
navya9singh Apr 17, 2023
38471a8
adressing comments
navya9singh Apr 18, 2023
0439ddc
Merge branch 'main' of https://github.com/microsoft/TypeScript into t…
navya9singh Apr 20, 2023
9734d4d
Changes for new api protocol
navya9singh Apr 20, 2023
003113c
fixing tests
navya9singh Apr 20, 2023
28d8564
accepting baselines
navya9singh Apr 21, 2023
e61ad6d
Simplifying fileSuggestions in session.ts
navya9singh Apr 21, 2023
ea6441d
Fixing return statement
navya9singh Apr 21, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplifying fileSuggestions in session.ts
  • Loading branch information
navya9singh committed Apr 21, 2023
commit e61ad6d1e537951994691d1af07394b6ea1ee2ca
21 changes: 4 additions & 17 deletions src/server/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2714,24 +2714,11 @@ export class Session<TMessage = string> implements EventSender {
return result;
}

private getMoveToRefactoringFileSuggestions(args: protocol.GetMoveToRefactoringFileSuggestionsRequestArgs): { newFilename: string, files: string[] }{
private getMoveToRefactoringFileSuggestions(args: protocol.GetMoveToRefactoringFileSuggestionsRequestArgs): { newFileName: string, files: string[] }{
const { file, project } = this.getFileAndProject(args);
const allFiles: string[] = [];
let fileName = "";
updateProjectIfDirty(project);
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
if (scriptInfo) {
const { newFileName, files } = project.getLanguageService().getMoveToRefactoringFileSuggestions(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file));
if (files) {
for (const file of files) {
if (!allFiles.includes(file)) {
allFiles.push(file);
}
}
}
fileName = newFileName;
}
return { newFilename: fileName, files: allFiles };
const scriptInfo = project.getScriptInfoForNormalizedPath(file)!;
const { newFileName, files } = project.getLanguageService().getMoveToRefactoringFileSuggestions(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file));
return { newFileName, files };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const { newFileName, files } = project.getLanguageService().getMoveToRefactoringFileSuggestions(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file));
return { newFileName, files };
return project.getLanguageService().getMoveToRefactoringFileSuggestions(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file));
}

private organizeImports(args: protocol.OrganizeImportsRequestArgs, simplifiedResult: boolean): readonly protocol.FileCodeEdits[] | readonly FileTextChanges[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Info seq [hh:mm:ss:mss] request:
Info seq [hh:mm:ss:mss] response:
{
"response": {
"newFilename": "/C.d.ts",
"newFileName": "/C.d.ts",
"files": [
"/a/file3.d.ts"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Info seq [hh:mm:ss:mss] request:
Info seq [hh:mm:ss:mss] response:
{
"response": {
"newFilename": "/C.js",
"newFileName": "/C.js",
"files": [
"/file2.js",
"/file5.js"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Info seq [hh:mm:ss:mss] request:
Info seq [hh:mm:ss:mss] response:
{
"response": {
"newFilename": "/ka.ts",
"newFileName": "/ka.ts",
"files": [
"/file7.ts"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Info seq [hh:mm:ss:mss] request:
Info seq [hh:mm:ss:mss] response:
{
"response": {
"newFilename": "/project/a/ka.ts",
"newFileName": "/project/a/ka.ts",
"files": [
"/project/a/file4.ts",
"/project/b/file2.ts",
Expand Down