-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Not Ready] [typespec-vscode] Rename file should rename import #5674
base: main
Are you sure you want to change the base?
[Not Ready] [typespec-vscode] Rename file should rename import #5674
Conversation
❌ There is undocummented changes. Run The following packages have changes but are not documented.
Show changes |
You can try these changes here
|
@@ -587,6 +587,7 @@ function getPathComponentsRelativeTo( | |||
for (; start < fromComponents.length; start++) { | |||
relative.push(".."); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove the change from path-utils.ts file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no changed now
level: "debug", | ||
message: | ||
"The number of files marked for deletion(type=3) and creation(type=1) is not equal, " + | ||
"they must appear in pairs, see the input parameters for details: \n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
must is too strong and maybe confusing. It's still possible to be a valid scenario not for rename. I think you can just mention can't pair files properly and skip the rename handling is enough.
if (!result) { | ||
log({ | ||
level: "debug", | ||
message: `The main tsp file '${mainFile}' does not have any diagnostics.`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the message accurate? doesn't it because compile failed somehow?
|
||
if ( | ||
target.path.value === | ||
(oldFileImpVal.startsWith(".") ? oldFileImpVal : `./${oldFileImpVal}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if an absolute path is used?
); | ||
|
||
let replaceText = getRelativePathFromDirectory(fileDir, newFilePath, false); | ||
replaceText = replaceText.startsWith(".") ? replaceText : `./${replaceText}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
won't the replace text an absolute path?
@@ -0,0 +1,112 @@ | |||
import { deepStrictEqual } from "assert"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add test that if only add or only remove a file won't trigger anything.
fixed: #2470
Compiler:
Locate the file with the modified import content and modify it
Typespec-vscode:
Add implementation code such as configuration content and user-friendly operations