Improve error message “Literal '\n' not allowed.” when searching project for a multi-line string
roryokane opened this issue · 4 comments
- VS Code version: Code 1.24.0 (6a6e02c, 2018-06-06T17:37:01.579Z)
- OS version: Linux x64 4.15.0-22-generic
Steps to Reproduce:
The same steps as for #49287.
- Open “SEARCH” (find in files)
- Activate the regular expression search
- Type anything with “\n”
- An error will be shown: “Literal '\n' not allowed.”
Issue #13155 “Support multi-line search for Global search” requests that a search containing \n
works instead of not showing an error. That's not what this issue is about.
This issue is about the error message wording.
Literal '\n' not allowed.
This error message makes me think “Why? \n
is valid in regexes, right? Yes, I think it is. Hmm, maybe I can paste a literal newline? No, VSCode refuses to paste it. Why is this happening? Let me search the error message.” And eventually I find #13155.
The message would be clearer if it changed “not allowed” to “not supported”:
Literal '\n' currently not supported.
This way, I understand that I didn't do anything wrong when I entered my regex, and that I have to use a different tool to search for this regex.
The error message could even include a link to open the relevant issue in the user's web browser:
Literal '\n' not yet supported. (details)
(I changed “currently not” into “not yet” there because that might be necessary for the error message to fit in the limited space it has.)
Changing the error message should be a lot quicker than waiting for #13155 to be actually solved, so I think it would be worth doing even though this error will eventually go away.
(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:
I tweaked the error message. I don't think that linking to the feature request would really help anyone, but emphasizing that it's not supported makes sense.
But it is supported in the per-file search.