# Fix language injections sticking after language comment removed \(\#46134\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/797ad8cf4428a2e6209e37a09a395d354f710221)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 797ad8cf4428a2e6209e37a09a395d354f710221

Requested commit: 797ad8cf4428a2e6209e37a09a395d354f710221

Commit: 797ad8cf4428a2e6209e37a09a395d354f710221

Tree: 24911a8146b81a52c62229cc10b751692ec97a13

Author: Jeff Brennan

Committer: GitHub

## Message

````
Fix language injections sticking after language comment removed (#46134)

Closes #46104

Release Notes: 

- Fixed language injections sticking after language comment removed

---

This is working well for the Python SQL comments

![comment_sync_demo](https://github.com/user-attachments/assets/ba5160ce-4867-4b49-9f44-141ddc2730a1)

```python
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()

# sql
cmd = "SELECT col1, col2 FROM tbl"

df = spark.sql(  # sql
    """
    WITH cte AS (
        SELECT col1, col2, COUNT(*) AS n
        FROM tbl
        GROUP BY ALL
    )
    SELECT * FROM cte
    """
)
```


And go comments

![comment_sync_demo_go_updated](https://github.com/user-attachments/assets/73e81a94-e8fc-4dc3-82f8-09e966d35bc9)


```go
package main

func test() {
    var _ = /* sql */ `SELECT id, name FROM products`
    var _ = /* sql */ "SELECT id, name FROM products"

    var _ = /* sql */ `SELECT id, name FROM products`

    var _ = /* sql*/ "SELECT id, name FROM products"
}
```

Note: `f04b252dd9` was a simpler implementation that worked for
non-inline comments in Python, but produced the following Go behavior

![comment_sync_demo_go](https://github.com/user-attachments/assets/40336705-9799-4b0a-b457-4974d172e1c8)

---------

Co-authored-by: Joseph T. Lyons <JosephTLyons@gmail.com>
````

## Parents

- [a9fdd07e8d4b1eedca0cdf5362708848f3b98ef7](https://git.cafe/gitcafe/zed/commit/a9fdd07e8d4b1eedca0cdf5362708848f3b98ef7?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/797ad8cf4428a2e6209e37a09a395d354f710221?format=markdown)
