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?
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.)
I think that renaming should use |foo 123|
as @gus-massa says; the fact that it doesn't is a bug.
If this is changed in DrRacket does racket-langserver automatically get the enhancement?
S.
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)
Thank you
So does DrRacket use the langserver now?
S.
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.
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
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.
Shamefully, I use this feature to add new arguments to functions.
awesome! Or maybe right parens?
“Shamefully, I use this feature to add new arguments to functions."
+1
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.