Ionide-vscode-fsharp: Auto closing attribute brackets [<...>] causes duplicate trailing ] when editor.autoClosingBrackets is enabled

Created on 8 Dec 2018  路  7Comments  路  Source: ionide/ionide-vscode-fsharp

When "editor.autoClosingBrackets": true (or is effectively true via languageDefined), an extra trailing [ character is added.

bracket_completion

Not familiar with Ionoide internals, but guessing there is some code that inserts a >] unconditionally, when it should instead only insert a > when editor.autoClosingBrackets is effectively true.

upstream - vscode issue

Most helpful comment

It sounds like a VSCode bug, but in case anyone else is getting as infuriated with this as I was:

  • Navigate to the .vscode directory, usually located in your %USERPROFILE% directory on Windows
  • Open ./extensions/ionide.ionide-fsharp-X.X.X/language-configuration.json
  • Remove relevant patterns e.g. ["[<", ">]"], from the "autoClosingPairs" and "surroundingPairs" sections

I'd be interested to know why the issue has gone for you - I was able to reproduce using a fresh install of VSCode insiders and Ionide.

As a workaround, I can get the behaviour I want for annotations by using the following in the "autoClosingPairs" section - whether it breaks behaviour elsewhere I don't know yet so mileage may vary...

"autoClosingPairs": [
    ...
    ["[<", ">"],
 ],

All 7 comments

It seems like a bug in VSCode rather than Ionide. We just define autoClosingPairs in https://github.com/ionide/ionide-vscode-fsharp/blob/master/release/language-configuration.json, Ionide doesn't manually insert those closing characters.

Interestingly enough the issue has seemed to disappear (now it simply auto-completes the [ but not the < which is much more desired behavior). It would be nice if vscode would also pick up on your multi-character listings in the configuration you linked, but I'm sure they'll get around to fixing it in an update at some point :) Thanks for looking into this!

It sounds like a VSCode bug, but in case anyone else is getting as infuriated with this as I was:

  • Navigate to the .vscode directory, usually located in your %USERPROFILE% directory on Windows
  • Open ./extensions/ionide.ionide-fsharp-X.X.X/language-configuration.json
  • Remove relevant patterns e.g. ["[<", ">]"], from the "autoClosingPairs" and "surroundingPairs" sections

I'd be interested to know why the issue has gone for you - I was able to reproduce using a fresh install of VSCode insiders and Ionide.

As a workaround, I can get the behaviour I want for annotations by using the following in the "autoClosingPairs" section - whether it breaks behaviour elsewhere I don't know yet so mileage may vary...

"autoClosingPairs": [
    ...
    ["[<", ">"],
 ],

Oh hmm yeah it seems to have come back again for me as well. I'll leave it up to @Krzysztof-Cieslak whether or no they wan to re-open it here.
That workaround seems promising as well, since I don't think the [< character combination is used anywhere else...
Also looks like this vscode issue might be related... https://github.com/Microsoft/vscode/issues/583

The https://github.com/microsoft/vscode/issues/72177 is in danger of being closed if it doesn't receive 20 upvotes in the next 60 days. Anyone who wants a true solution to this irritation should go upvote that bug so the VS Code bug bot doesn't auto-close it. (Edit: It's now at 22 votes and is safely ensconced in the backlog.)

That issue now has 20 votes :)

Was this page helpful?
0 / 5 - 0 ratings