Skip to content
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

Added Opening Brace as trigger character for formatAfterKeyStroke #1042

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

akshita31
Copy link
Contributor

@akshita31 akshita31 commented Dec 5, 2017

Issue : dotnet/vscode-csharp#1591

Added { as trigger character for formatting changes request.

Please review : @DustinCampbell @TheRealPiotrP @rchande

@akshita31
Copy link
Contributor Author

omnisharp-vscode side : dotnet/vscode-csharp#1906

@DustinCampbell
Copy link
Contributor

I'm a little worried about this change. What happens in the following case?

  1. Set "editor.autoClosingBrackets": false in the VS Code settings.
  2. Start with this code;
    class C
    {
        void M1()
        $$
    
        void M2()
        {
        }
    }
  3. Type { at the caret position ($$)

Does the declaration of M2() get indented? If so, this might not be the right approach.

@akshita31
Copy link
Contributor Author

ezgif com-video-to-gif

It doesn't indent M2()

Copy link
Contributor

@DustinCampbell DustinCampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for verifying the behavior

@akshita31
Copy link
Contributor Author

akshita31 commented Dec 5, 2017

Just noticed a problem with this change. After the format the caret symbol should appear just before the closing brace so that on hitting enter we have a proper indentation

ezgif com-video-to-gif

@DustinCampbell
Copy link
Contributor

Maybe debug and see if it's got the correct span for the format?

@akshita31
Copy link
Contributor Author

akshita31 commented Dec 14, 2017

Tried to edit the span on hitting enter (for this particular case) to include three lines - the previous line(opening brace) , the current line and the nextLine (closing brace), but doing that deletes the spaces in the current line.
incorrect_cursor

I think this is related to auto-indent in vscode. Hence I have filed a bug in vscode here

cc @rchande

@filipw filipw added the blocked label Jan 29, 2018
@gabrieldechichi
Copy link

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants