Repository: rust-lang/rust-enhanced (language: rust)

Issue:
[ST4] Accept replacement inline button missing
### Sublime Text Version
Sublime Text 4 (Build 4081)

### Rust Enhanced Version
v2.22.0

### Operating system
OS Name Linux Mint (Cinnamon)
Version 20

### Expected behavior
I should see the "accept replacement" message/button inline, with no errors in the console.

### Actual behavior
I don't see the button and associated text:

![image](https://user-images.githubusercontent.com/800791/89776155-38a4dc00-db01-11ea-8f3c-b90c1de4134f.png)

With this error log:

```
Parse Error: =2d755782-fdf6-4abf-86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -fdf6-4abf-86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -4abf-86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: " class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: id=2d755782-fdf6-4abf-86a5-bf217e635c2c"  code: Unknown entity
Parse Error: ">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: =2d755782-fdf6-4abf-86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -fdf6-4abf-86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -4abf-86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -86a5-bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: -bf217e635c2c" class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: " class="rust-button">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
Parse Error: id=2d755782-fdf6-4abf-86a5-bf217e635c2c"  code: Unknown entity
Parse Error: ">Accept Replacement:</a> thing</div>

</div>

</body>
 code: Unexpected character
```

### Steps to reproduce
1. Run `cargo new --lib bug-demo`
2. Paste this code into `src/lib.rs`:

    ```rust
    fn thing() {
        //
    }

    fn main() {
        thang()
    }
    ```

3. Open Sublime log with <kbd>Ctrl</kbd> + <kbd>`</kbd>

This issue is also present with `rust-analyzer` (via LSP plugin) disabled, so I don't believe it's a conflict between the two.

### References
N/A








Discussion / hints:
When is sublime text 4 released? Is it a private build?
Dev versions are available on the Discord #announcements channel: https://discord.com/channels/280102180189634562/650695903446827011

I've also encountered this issue. Any news on when this might be fixed?
Bump - still happening on Build 4092
Seems like the URL parsing done by Sublime Text has changed and doesn't accept the `&` in the URL encoded replacement info anymore. A quick hack is to just replace that character...

```diff
diff --git a/rust/messages.py b/rust/messages.py
index 19c2a58..294c59d 100644
--- a/rust/messages.py
+++ b/rust/messages.py
@@ -150,7 +150,7 @@ class Message:
             urllib.parse.urlencode({
                 'id': self.id,
                 'replacement': self.suggested_replacement,
-            }),
+            }).replace("&", "SEKOFRUHNSDIXFHSDUI"),
             html_suggestion,
         )

@@ -371,6 +371,7 @@ def erase_status(view):


 def _click_handler(view, url, hide_popup=False):
+    url = url.replace("SEKOFRUHNSDIXFHSDUI", "&")
     if url == 'hide':
         clear_messages(view.window(), soft=True)
         if hide_popup:
```
@Bobo1239 that fix works perfectly. Thanks!
Ah, the one downside of this workaround is that every time rust-enhanced updates, I need to hack it back in... 
It would be great to have a proper fix upstreamed.

Fix patch:
diff --git a/rust/messages.py b/rust/messages.py
index 19c2a58a..65a30cbe 100644
--- a/rust/messages.py
+++ b/rust/messages.py
@@ -146,13 +146,13 @@ def _render_suggested_replacement(self):
         html_suggestion = html_suggestion\
             .replace(' ', '&nbsp;')\
             .replace('\n', '<br>\n')
-        return replacement_template % (
-            urllib.parse.urlencode({
-                'id': self.id,
-                'replacement': self.suggested_replacement,
-            }),
-            html_suggestion,
-        )
+        url_param = urllib.parse.urlencode({
+            'id': self.id,
+            'replacement': self.suggested_replacement,
+        })
+        if int(sublime.version()) > 4000:
+            url_param = url_param.replace('&', '&amp;')
+        return replacement_template % (url_param, html_suggestion)
 
     def suggestion_count(self):
         """Number of suggestions in this message.


Test patch: