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 ( 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).

Comment actions Permalink

You could use an interpolated string with the nameof operator:

$"Method {nameof(Bla)} says hi"

You'll get full intellisense within the placeholder. And if you rename the method, the string will automatically be updated to match.

Comment actions Permalink

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.


Please sign in to leave a comment.