-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Change default newLine, forceConsistentCasingInFileNames #52298
Change default newLine, forceConsistentCasingInFileNames #52298
Conversation
* Default newline is now lf instead of os-specific * forceConsistentCasingInFilenames now defaults to true
a9aece8
to
6744c10
Compare
src/services/completions.ts
Outdated
const newLineChar = getNewLineCharacter(options, maybeBind(host, host.getNewLine)); | ||
const newLineChar = getNewLineCharacter(options); |
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.
Just to double check, this won't cause our completion snippets to have the wrong newlines, right? This is sort of awkward because it's the input newline character we'd want in snippets, not the output type. I'm not sure if host.getNewLine
here was overriding that choice or what, but I guess there's no way this code could have determined the "right" thing to use without using the SourceFile, so, I'm confused.
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.
Hm, the current errors in baselines seem to imply that it does matter?
After this merges, I think I'll send a PR which tries to add it to |
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.
As Jake mentioned, this is changing up the source-authored newlines used for edits in the LS with the output newlines. Am I missing something or is that intentional?
Probably need to update |
I'm guessing that function is what those snippet printers are supposed to use. |
Yes, I would assume most instances of |
I'm also guessing nobody's noticed because VS Code normalizes them to the desired endings? |
I'm going to try a reduced subset of this PR to avoid the LS implications, which we don't really want to touch |
Pared down at #52336 |
OK, I think this is good to go. I've manually tested both settings as well |
Co-authored-by: Jake Bailey <[email protected]>
@@ -27,7 +27,21 @@ Output:: | |||
>> Screen clear | |||
[[90m12:00:15 AM[0m] Starting compilation in watch mode... | |||
|
|||
[[90m12:00:20 AM[0m] Found 0 errors. Watching for file changes. | |||
[96mb.ts[0m:[93m1[0m:[93m43[0m - [91merror[0m[90m TS1149: [0mFile name '/A.ts' differs from already included file name '/a.ts' only in casing. |
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.
whats this diff?
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.
Oh because default changed. can you change the test to set forceConsistenCasing to true and false instead of using default so it is actually checking what the test is suppose to check.
@@ -27,7 +27,21 @@ Output:: | |||
>> Screen clear | |||
[[90m12:00:15 AM[0m] Starting compilation in watch mode... | |||
|
|||
[[90m12:00:20 AM[0m] Found 0 errors. Watching for file changes. | |||
[96mb.ts[0m:[93m1[0m:[93m43[0m - [91merror[0m[90m TS1149: [0mFile name '/A.ts' differs from already included file name '/a.ts' only in casing. |
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.
Oh because default changed. can you change the test to set forceConsistenCasing to true and false instead of using default so it is actually checking what the test is suppose to check.
@@ -2437,7 +2437,7 @@ export function createLanguageService( | |||
} | |||
|
|||
function getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined { | |||
return JsDoc.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position, options); | |||
return JsDoc.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, /*formatSettings*/ undefined), syntaxTreeCache.getCurrentSourceFile(fileName), position, options); |
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.
Not that you should fix it in this PR, but it seems like a bug that we don't have this for JSDoc comments.
Co-authored-by: Sheetal Nandi <[email protected]>
@typescript-bot user test tsserver Just for fun. |
Heya @DanielRosenwasser, I've started to run the diff-based user code test suite (tsserver) on this PR at d40ab04. You can monitor the build here. Update: The results are in! |
Heya @DanielRosenwasser, I've started to run the diff-based top-repos suite (tsserver) on this PR at d40ab04. You can monitor the build here. Update: The results are in! |
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.
LGTM (again); I'm pretty sure those last two remaining /*formatSettings*/ undefined
are preexisting bugs we should report somewhere.
@DanielRosenwasser Here are the results of running the user test suite comparing Everything looks good! |
@@ -781,7 +781,7 @@ class LanguageServiceShimObject extends ShimBase implements LanguageServiceShim | |||
} | |||
|
|||
private realizeDiagnostics(diagnostics: readonly Diagnostic[]): { message: string; start: number; length: number; category: string; }[] { | |||
const newLine = getNewLineOrDefaultFromHost(this.host); | |||
const newLine = getNewLineOrDefaultFromHost(this.host, /*formatSettings*/ undefined); |
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.
I think this one is probably okay.
@DanielRosenwasser Here are the results of running the top-repos suite comparing Everything looks good! |
Per discussion at #52296