# Rename to identifier with spaces, yay

**URL:** <https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292>\
**Category:** General\
**Created:** [September 8, 2022, 5:31pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292 "2022-09-08T17:31:47Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [September 8, 2022, 5:31pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/1 "2022-09-08T17:31:47Z")

</div>

Today, just for fun, I used DrRacket's "rename identifier" to rename the identifier "foo" to "foo 123". It cheerfully did the replacement, including spaces. I should file this as a bug, yes?

---

<div class="post-metadata">

**Author:** ![gus-massa](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/gus-massa/32/507_2.png) [@gus-massa](https://racket.discourse.group/u/gus-massa)\
**Post date:** [September 8, 2022, 8:41pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/2 "2022-09-08T20:41:46Z")

</div>

It's legal to use space in identifiers. For example:

```
#lang racket
(define |foo 123| 5)
(displayln |foo 123|) ;==> 5
(displayln '|foo 123|) ;==> foo 123

```

(Anyway, I can't imagine when it's a good idea.)

---

<div class="post-metadata">

**Author:** ![samth](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/samth/32/3_2.png) [@samth](https://racket.discourse.group/u/samth)\
**Post date:** [September 8, 2022, 8:43pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/3 "2022-09-08T20:43:36Z")

</div>

I think that renaming should use `|foo 123|` as @gus-massa says; the fact that it doesn't is a bug.

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [September 9, 2022, 7:46am UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/4 "2022-09-09T07:46:03Z")

</div>

If this is changed in DrRacket does [racket-langserver](https://github.com/jeapostrophe/racket-langserver) automatically get the enhancement?

S.

---

<div class="post-metadata">

**Author:** ![dannypsnl](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dannypsnl/32/917_2.png) [@dannypsnl](https://racket.discourse.group/u/dannypsnl)\
**Post date:** [September 9, 2022, 3:13pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/5 "2022-09-09T15:13:06Z")

</div>

No, they won't since langserver new text is given from LSP client, so the fix should be in the server(I would send a PR to fix it)

Track [wrap identifier with `|` to get valid renaming by dannypsnl · Pull Request #80 · jeapostrophe/racket-langserver · GitHub](https://github.com/jeapostrophe/racket-langserver/pull/80)

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [September 9, 2022, 3:26pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/6 "2022-09-09T15:26:04Z")

</div>

Thank you 🤩

So does DrRacket use the langserver now?

S.

---

<div class="post-metadata">

**Author:** ![dannypsnl](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/dannypsnl/32/917_2.png) [@dannypsnl](https://racket.discourse.group/u/dannypsnl)\
**Post date:** [September 9, 2022, 7:05pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/7 "2022-09-09T19:05:49Z")

</div>

No, I think the situation is DrRacket and racket-langserver both use `syncheck-annotations<%>`, but due to client's difference they need to separately dealing this problem.

---

<div class="post-metadata">

**Author:** ![joskoot](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/joskoot/32/1964_2.png) [@joskoot](https://racket.discourse.group/u/joskoot)\
**Post date:** [September 10, 2022, 1:09pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/8 "2022-09-10T13:09:03Z")

</div>

TO GUS-MASSA

(Anyway, I can't imagine when it's a good idea.)

I can, for example as the first argument of procedure error.

Jos

 ![DC369554041A4649A528B20B10730B39.png](https://global.discourse-cdn.com/free1/uploads/racket/original/1X/2ad4c25f471d2cfc2782215e9bb5a535b2545175.png)

---

<div class="post-metadata">

**Author:** ![robby](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/robby/32/7_2.png) [@robby](https://racket.discourse.group/u/robby)\
**Post date:** [September 10, 2022, 4:18pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/9 "2022-09-10T16:18:17Z")

</div>

DrRacket used to do that, but it doesn't now because that is making assumptions about the syntax of identifiers that don't seem right in our LOPy world. In other words, it is on purpose that it puts just the characters there for you.

It might make sense to allow languages to specify how to turn some string into the syntax of an identifier, I suppose, and then read-based languages can do the needful. But doing it all the time is probably a bad idea.

---

<div class="post-metadata">

**Author:** ![shhyou](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@shhyou](https://racket.discourse.group/u/shhyou)\
**Post date:** [September 13, 2022, 4:06am UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/10 "2022-09-13T04:06:03Z")

</div>

Shamefully, I use this feature to add new arguments to functions.

---

<div class="post-metadata">

**Author:** ![jbclements](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/jbclements/32/11_2.png) [@jbclements](https://racket.discourse.group/u/jbclements)\
**Post date:** [September 13, 2022, 5:18am UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/11 "2022-09-13T05:18:13Z")

</div>

awesome! Or maybe right parens?

---

<div class="post-metadata">

**Author:** ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)\
**Post date:** [September 13, 2022, 10:54am UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/12 "2022-09-13T10:54:29Z")

</div>

“Shamefully, I use this feature to add new arguments to functions."

+1

---

<div class="post-metadata">

**Author:** ![notjack](https://avatars.discourse-cdn.com/v4/letter/n/e47774/32.png) [@notjack](https://racket.discourse.group/u/notjack)\
**Post date:** [September 15, 2022, 9:13pm UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/13 "2022-09-15T21:13:42Z")

</div>

A syntax property on identifiers with a regex that says what the legal characters are would at least be a minor LOP-aware improvement here, since then DrRacket could reject the replacement (or just warn about it) instead of doing the wrong thing. A similar property for how to escape characters would also work but I don't have a clear idea of what that would look like.

---

<div class="post-metadata">

**Author:** ![spdegabrielle](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/spdegabrielle/32/95_2.png) [@spdegabrielle](https://racket.discourse.group/u/spdegabrielle)\
**Post date:** [September 16, 2022, 11:41am UTC](https://racket.discourse.group/t/rename-to-identifier-with-spaces-yay/1292/14 "2022-09-16T11:41:54Z")

</div>

> [@shhyou](#):
>
> Shamefully, I use this feature to add new arguments to functions.

No shame in that!

Would this be a good [quickscript](https://docs.racket-lang.org/quickscript/index.html)?

S.
