-
Notifications
You must be signed in to change notification settings - Fork 111
Add check for Files>EOL ==="auto" and set it to "\n" #72
base: master
Are you sure you want to change the base?
Conversation
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
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
As for tests there doesn't seem to currently be any implemented on this repository yet.
Using |
@ctsstc - updated as requested. Also, I don't know the ramifications of changing the "module resolution" to "node", but I had to do that to get it to compile for me, so I've included it in the commit. |
// See https://github.com/AlanWalk/markdown-toc/issues/65 | ||
lineEnding = "\n"; | ||
lineEnding = require('os').EOL; |
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.
Should probably change this to an import at the top of the file
import { EOL } from 'os';
This also allows for a change on line 249 in the insertAnchor
method where it builds the text
variable.
This
let text = [ '<a id="markdown-', name, '" name="', name, '"></a>\n' ];
Can be changed to
let text = [ '<a id="markdown-', name, '" name="', name, '"></a>', EOL ];
I too wasn't sure if we'd have the node namespace available for the extension, so I'm glad you dug into that, but I don't know much about it myself either. |
Hey guys, It would be great if we could have this merged and part of the latest release. Cheers!! |
Please merge and deploy this!!!!!!!!!!!!!!!!! |
Nevermind I just installed https://github.com/yzhang-gh/vscode-markdown instead!!!!!! |
I managed to fix all the tslints (which is required to build new version) and merge the pull request. If you found any issue related to code refactoring, please create new issue (and pull request if you can fix it). Many thanks |
In the spirit of "be the change you want to see", I humbly propose this short solution that fixes issue #65.
FWIW - I haven't tested this conclusively, but it worked for me and saved me from having to change system-wide settings.