-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with nested snippet insertion #39594
Comments
Can you open the console (Help -> Toggle Developer Tools -> Console) and share any error messages there with call stacks? |
I will once I'm able to reproduce it. I restarted so it might be a little bit before the error starts up again. |
I'm getting this error with a custom code snippet (elm.json, for elm language in this case): "Function definition w/ 2 arguments": {
"prefix": "fn2",
"body": [
"$1 : $2 -> $3 -> $4",
"$1 $5 $6 =",
" $0"
],
"description": "Function definition w/ 2 arguments"
}, while this is working:
After restarting vscode it's working as expected. |
Exciting... I have been getting this via error telemetry since a long time but was never able to reproduce. |
Not exciting... @Braincompiler I jump on your snippet but it seems that you are taking this issue hostage as it unrelated to the invalid argument issue mentioned before. Still, please try to prodive reproducible steps. Just inserting the snippet doesn't do it, sadly... |
@tnrich I am sorry but we do need steps for this... Also, don't believe that all illegal-argument errors have the same cause. It's a general we use and it can occur in different places and be triggered in different ways |
@jrieken why was my comment deleted? |
Because you are taking this issue as hostage. There is roughly 20 different places in the code that can trigger this error. @tnrich Has not yet provided reproducible steps nor a stack trace which means it's not clear how and when this happens. So I wonder what data points make you believe that you encounter this exact same issue? Why are you so sure it's not a different issue? Last, why do you think saying me too, also without reproducible steps, is of any help? It's not that we don't like issues and we do value feedback but don't take an issue hostage. Please create a new issue. Once steps are available we might know for sure that an issue is a duplicate. Saying "I see this too" on an 'needs-more-info' issue without having more insights is a logical flaw. |
@jrieken I find your tone and response to be overly aggressive and dramatic, and not a good way to carry out user support. My issue also occurred whilst using tab to autocomplete things, hence why I commented and although I did forgot to include reproducible steps, I did include error information and a screenshot. 'Taking hostage' is a gross exaggeration, I did not deman a solution, I simply contirbuted extra information. Perhaps, instead of just deleting the comment without explanation, you could have asked me for further information, and thus sped up the resolution of an open issue? |
Yes, you are right. Deleting the comment wasn't the nice thing to do and I am sorry for that. To explain my self (not to justify): When you get lots of issues every day you'll develop an allergy towards missing information. Again, please file a new issue. It doesn't cost much. When an error occurs try to remember what you just did and then try to reproduce. That's the most valuable thing to do. Thanks |
@tnrich Please clarify you understanding "tab complete". Is this
|
|
Okay, it started happening again. Not sure what caused it to start still. Here is the stack trace @ramya-rao-a
Hmm my copy didn't seem to get the whole message so here is a screenshot of the stack trace: Hope it helps! |
@tnrich Interesting and I'd really like to know the steps leading up to that but this isn't the 'Illegal Arguments' error you have mentioned in the beginning. Is it that this error happens and that it also shows the error message in the UI? |
Drilling into this black hole... There is something off with nested snippets. I can tell that by the stack traces and I have seen this via error telemetry. It's just not clear to me how exactly that happens 😕 The 'Invalid arguments' error is, I believe, a side-effect of that. The snippet-logic wants to compute the next cursor positions, fails, and computes an empty array of selections. The editor will refuse to accept that and throw that error... (there are many other code paths leading to this but I take this as the most likely case). |
I have pushed a change that prevents the 'in-your-face-error' and that adds lots of logging, esp. it will write the snippets and merge attempting to a log-file. That is information we cannot automatically collect as telemetry... @tnrich @Braincompiler This requires your help! When snippets, esp. snippets or IntelliSense inside another snippet, act weirdly check the error log (F1 > Show Logs... > Renderer) for line around |
Sure this is #1118? Yeah, maybe yours is the same... Initially I was not aware that the bad snippet behaviour can cause the 'Invalid arguments' error to pop up. Because of that I mentally put things into different bugs. Separate issue or not doesn't matter much at this point. What I need is repro-steps... Is this plain snippets and completions or anything fancy like starting with multiple cursors? |
My steps to easily reproduce are using the following custom snippet in powershell:
As you can see it uses multiple cursors. Either this will cause the issue straight away, or the next time IntelliSense is used the issue occurs. If that enough info? If not I will happily try to get more, or bow out. |
@james-woodbridge I owe you a beer. I mean it, I am in London early next Feb. I believe the culprit is changing the selection when inside a repeated placeholder and when invoking another snippets (nested insertion). Steps to reproduce this:
|
Pushed a fix, will be in next insiders build. Tricky, crazy issue... The snippet controller tracks the current selection while a snippet is being inserted and cancels snippet mode when the selection leaves a placeholder range. That logic was flawed and wouldn't cancel snippet mode when the selection changes from n to 1 while still being on a placeholder (see above staying on |
@jrieken I will take you up on that beer - there are quite a few good pubs around here and it's always good to meet new people :) |
I couldn't leave a comment on any of the many issues that seemingly address this error:
#26907
#27015
#26915
#27015
because they were all locked. I am still definitely hitting this error and am on the latest possible stable vscode version:
Here is a screenshot of the issue popping up:
I'm not sure what causes the error to start occurring, but once it starts, every time I try to tab complete anything I get this annoying message and the cursor position gets off in a funky way such that I can't use my regular snippets.
The text was updated successfully, but these errors were encountered: