microsoft / microsoft/vscode-powerquery
[BUG] Encode Selection as M Text Value is missing escapes on complex values
Open
@JordanBoltonMN is already working on this.
Since Sep 22, 2022.
bug
- Dominant language
- TypeScript
- Stars
- 108
- Forks
- 25
- Avg merge
- 8d 22h
- Merged PRs (30d)
- 2
Description
Expected behavior
I'm expecting the selected value will escaped quotes, converting it to a raw string.
I thought it would simplify adding the Code part of function's metadata ( Documentation.Examples )
For example this
let
x = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcszNr8hMzszJycxT0EgsVjBUcFTQVIrVwSbjjFNGAY8uhEwBskRxfkppLhYpoFkwWaBkLAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Raw Name" = _t])
in
x
Expected Output
let
x = "Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText(""i45WcszNr8hMzszJycxT0EgsVjBUcFTQVIrVwSbjjFNGAY8uhEwBskRxfkppLhYpoFkwWaBkLAA="", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#""Raw Name"" = _t])"
in
x
Actual behavior
let
x =
Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText(""i45WcszNr8hMzszJycxT0EgsVjBUcFTQVIrVwSbjjFNGAY8uhEwBskRxfkppLhYpoFkwWaBkLAA="", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#(#)""Raw Name"" = _t])
in
x
To Reproduce
https://user-images.githubusercontent.com/3892031/191777597-0dbda18e-dcf0-4915-84b6-7e5cf7129332.mp4
Environment
| Name | Version |
|---|---|
| Extension | PowerQuery.vscode-powerquery@0.1.45 |
| Code | code: 1.71.2, 74b1f979648cc44d385a2286793c226e611f59e7, x64 |
Pwsh>
code.cmd --show-versions --list-extensions | sls 'powerquery'
code.cmd --version | Join-String -sep ', ' -op 'vscode: '
Solution?
A naive replace appears to be working, at least for this sample
- Replace
"with"" - Surround that with
""
Pwsh> $Content -replace '"', '""'
| Join-String -op '"' -os '"'
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.