Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

fix vscode 1.29.0's breaking feature: eol=auto #66

Closed
wants to merge 1 commit into from

Conversation

gfx
Copy link

@gfx gfx commented Nov 14, 2018

Fix #65

workaround before this PR

Set files.eol to "\n" or "\r\n" in vscode settings. auto is a new feture introduced in v1.29.0

@gfx gfx force-pushed the fix-vscode-1.29.0-eol-auto branch from 2ab51a6 to 50d6a84 Compare November 14, 2018 01:10
@@ -265,9 +265,12 @@ class MarkdownTocTools {

private createToc(editBuilder : TextEditorEdit, headerList : any[], insertPosition : Position) {
let lineEnding = <string> workspace.getConfiguration("files").get("eol");
if (lineEnding === "auto") {
lineEnding = "\n";
Copy link
Author

Choose a reason for hiding this comment

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

I think it should come from the current document 🤔

Choose a reason for hiding this comment

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

Right, should be better taken either from current document, or probably vscode provides some API to resolve auto to os-specific value.

@3ygun
Copy link

3ygun commented Nov 18, 2018

@gfx wanted to link the original VSCode changes

Don't know if you can call one of those getEol methods and/or import OS and do the check yourself

@ctsstc
Copy link

ctsstc commented Jan 5, 2019

Now seeing that #72 looks to be a duplicate of this, although a slightly different implementation.

@ctsstc
Copy link

ctsstc commented Jan 5, 2019

From #72 (review)

Seems that the VSCode snippet builder builds snippets the same way via an array and then joins them together. It seems they are only using '\n' for all cases. Maybe the secret is to just do \n and post processing will handle the rest.

VSCode's snippet building:
https://github.com/Microsoft/vscode/blob/82863aac3b43b9559057295afcf5f99edd9f5f22/src/vs/workbench/parts/snippets/electron-browser/snippetsFile.ts#L227

VSCode's snippet implementation example:
https://code.visualstudio.com/docs/editor/userdefinedsnippets#_global-snippets

I dug around in the VSCode Extension API and couldn't really find anything about determining the OS EOL's value.

Looks like we should be able to use require('os').EOL though.

@JedBartlett
Copy link

Should this be closed then to let #72 go through?

@gfx
Copy link
Author

gfx commented Apr 27, 2020

Closed in favor of #80

@gfx gfx closed this Apr 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"auto" inserted instead of line breaks in TOC
5 participants