is there a way to get auto-completion inside comment string literals?
Quite often when writing comments or log messages I mention class/method names, like "method <Bla> says hi", and I often wish that R# would offer auto-completion.
Obviously I don't expect full intellisense (since, you know, the code isn't compilable), but at least hippie-completion (https://www.jetbrains.com/help/idea/auto-completing-code.html#hippie_completion) would be nice. Sublime Text does it, and every time I'm like "wow that's convenient!"
And maybe it shouldn't be automatic, but explicitly invoked with the usual keyboard shortcuts (alt+right arrow).
Please sign in to leave a comment.
You could use an interpolated string with the nameof operator:
You'll get full intellisense within the placeholder. And if you rename the method, the string will automatically be updated to match.
Yes, I forgot to mention it initially but I know about nameof, it's great in some cases but not as straightforward and lo-tech (requires string concatenation which would occur at runtime, unless the compiler detects this case and inlines it?).
Also, that's not applicable to comments.