microsoft / microsoft/typespec

Allow \ to escape newline in multi-line strings

Open
#1,777 8 comments 2 reactions 0 assignees View on GitHub
design:needed
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

Currently TypeSpec adds a newline (\n) at the end of every line except the last of a multi-line string. This is consistent with the behavior of many HLLs like JavaScript and Python. But those languages also allow a backslash (\) to escape that newline. TypeSpec should have a similar feature.

### JavaScript

```js
> foo = "bar \
... baz"
'bar baz'
>
```

### Python

```python
>>> foo = """bar \
... baz"""
>>> foo
'bar baz'
>>>
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.