ymotongpoo / vsc-licenser

License handler extension for Visual Studio Code.
Apache License 2.0
45 stars 40 forks source link

\n in custom header does not emit a newline #77

Closed andrew-schlackman closed 4 years ago

andrew-schlackman commented 4 years ago

Documentation for custom header states: "Note: Newlines are not allowed in settings strings, so you must use \n instead". I took this to mean that \n in a custom header would be replaced by a newline when the header is inserted. However, the literal "\n" remains in the inserted header and no newline is displayed.

Runtime environment

Behaviors

Expected behavior

\n in a custom header is replaced with a newline (CRLF, LF, etc) when inserted into a file.

Actual behavior

literal "\n" is inserted into the file

Steps to reproduce the issue

  1. Set a custom header with a \n character such as "Test header\nThis is a test"
  2. Insert custom header into file
  3. Expect to see:
    Test header
    This is a test

but instead get:

Test header\nThis is a test

I'm not sure if this is intended or possible when using the setting value in this way. Perhaps an alternative could be to have a setting point to a template file on the user's system instead?

tevosouza commented 4 years ago

Hi @andrew-schlackman

Your PR is more complete and adds new functionality to the extension and this is very good. I've added only one fix to permit that we still use extensions setting to define terms and conditions and license header (just one line in custom.ts).

@ymotongpoo any thoughts about it?

tevosouza commented 4 years ago

Maybe this issue can be closed, right?

andrew-schlackman commented 4 years ago

I think the 2 PRs solve this. Thanks.