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

Fix #921: Add smart indent support #994

Merged
merged 1 commit into from Jan 27, 2019

Conversation

Projects
None yet
4 participants
@MangelMaxime
Copy link
Contributor

MangelMaxime commented Jan 25, 2019

Update the language configuration on the fly and notify the user:

2019-01-25 16 36 48

Code wrote with smart indent enabled:
2019-01-25 16 37 18

Code wrote with smart indent disabled:
2019-01-25 16 39 12

@jschiefer

This comment has been minimized.

Copy link

jschiefer commented Jan 25, 2019

typeClass 🤣

@Krzysztof-Cieslak Krzysztof-Cieslak merged commit ab9c07d into ionide:master Jan 27, 2019

@inosik

This comment has been minimized.

Copy link
Contributor

inosik commented Feb 4, 2019

Doesn't seem to work for me, even after restarting VS Code.

@MangelMaxime

This comment has been minimized.

Copy link
Contributor Author

MangelMaxime commented Feb 4, 2019

Did you set FSharp: Smart indent and Editor: Auto Indentto true?

@inosik

This comment has been minimized.

Copy link
Contributor

inosik commented Feb 4, 2019

My bad, I disabled "Auto Indent" long time ago, because I thought it would be annoying when moving code around 😅

It's nice when you're typing new code, but moving existing code around isn't working properly:

2019-02-04_10-09-44

I don't think we can fix this in Ionide.

@MangelMaxime

This comment has been minimized.

Copy link
Contributor Author

MangelMaxime commented Feb 4, 2019

Smart indent is kind of really hard to set up in Ionide because we are working on a language that is indentation based.

In other languages, it's really easy to determine the block. Because in general, you can identify them with opening and closing symbols: {} or ; or [], etc.

When working on the F# smart indent, I took the decision to make it minimal and auto-indent where it as the best chances to be "correct".

For example, when creating a module MyModule = the code is always indented.
When defining a let x = the code after that is generally indented.

When I compare my experience with or without smart indent it's pretty similar when creating code. Before smart-indent, I had to indent myself to the right.
Now, it's always indented to the right but I sometimes need to de-indent.

In your gif, I am not sure why fetchGif is being indented to the right. This is VSCode determining that it should but I would expect it to not change.

Perhaps this is a bug/limitation on their side?

Also, I didn't use yet smart-indent on a daily I only tested it when creating the feature but thanks for the reminder I will activate it :) And will see if we can improve things or if there are bugs etc. :)

@inosik

This comment has been minimized.

Copy link
Contributor

inosik commented Feb 4, 2019

The documentation comment seems to break something:

2019-02-04_11-27-09

Doesn't happen with normal // comments, though.

@MangelMaxime MangelMaxime deleted the MangelMaxime:feature/smart_indent branch Feb 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment