Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHandle block comments with text on the same line as <# #> #2848
Conversation
| } | ||
| } | ||
| } | ||
|
|
||
| await vscode.workspace.fs.writeFile(targetResource, new TextEncoder().encode(retArr.join("\n"))); | ||
| await vscode.workspace.fs.writeFile(targetResource, new TextEncoder().encode(retArr.join(EOL))); |
rjmholt
Jul 31, 2020
Member
This will replace newlines in a script when it changes operating systems. For example, if we have a script checked in to git and you edit it, then I edit it, I'll change all the newlines in it. Harder to implement an alternative, but something we should aim not to do -- I wouldn't want my text editor silently reencoding line endings as a side-effect of an unrelated operation. I think worth documenting and/or opening a new issue for
TylerLeonhardt
Jul 31, 2020
Author
Member
So to solve this, I included metadata at the document level that says which line ending that file uses
| @@ -78,7 +77,7 @@ function CreateCell(cellKind: vscode.CellKind, source: string[], metadata: IPowe | |||
| cellKind, | |||
| language: cellKind === vscode.CellKind.Markdown ? "markdown" : "powershell", | |||
| outputs: [], | |||
| source: source.join(EOL), | |||
| source: source.join("\n"), | |||
TylerLeonhardt
Aug 3, 2020
Author
Member
This is only used in the rendering of notebooks so \n is totally fine.
|
@rjmholt I believe this is good to go. |
526fb22
into
PowerShell:master
PR Summary
Fixes #2845
This will better support block comments with stuff on the line:
and also make sure that saving doesn't mess up the style it previously used.
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an
xbetween the square brackets.Please mark anything not applicable to this PR
NA.WIP:to the beginning of the title and remove the prefix when the PR is ready