Skip to content

improve smart indentation #2848

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

Open
smoothdeveloper opened this issue Apr 13, 2017 · 2 comments
Open

improve smart indentation #2848

smoothdeveloper opened this issue Apr 13, 2017 · 2 comments
Labels
Area-VS-Editor VS editor support for F# code, not covered elsewhere Feature Improvement
Milestone

Comments

@smoothdeveloper
Copy link
Contributor

Repro steps

  1. define a function which spans several lines
  2. move carret on last line
  3. press Enter, and then Backspace, then Enter

Expected behavior

The cursor remains indented to the same level as the one obtained after pressing Backspace

Actual behavior

The indentation jumps back to the indeted level corresponding to last line of the function, the way it works in VS2015.

Known workarounds

None

Related information

The way it behaves in VS2015:
cursor vs2015

The way it behaves in VS2017:
cursor vs2017

In both, I have this Tabs settings:

image

The change in behaviour is rather annoying with muscle memory, and if it was unintended, this might be considered as a bug.

Provide any related information

  • Win 7 pro 64
  • using latest VS2017 F# nightly 15.4.1.17032701 (but it doesn't matter, it behaves this way since any version of VS2017)
@cartermp
Copy link
Contributor

@dungpa Had made a change to improve indentation in vs2017 a while back. I suspect there was a regression from the beginning (not @dungpa's changes), and that it hasn't quite been picked up yet.

@cartermp cartermp added this to the VS 2017 Updates milestone Apr 13, 2017
@smoothdeveloper
Copy link
Contributor Author

The implementation: https://github.com/Microsoft/visualfsharp/blob/427318deda16d340e9e61db6af220fee6e81bb78/vsintegration/src/FSharp.Editor/Formatting/IndentationService.fs

I believe we would need further information to provide to implement the logic, I'm thinking we should pass the current caret location (the column) because if user deindented, the caret location will be in a column less indented.

Any idea how I can obtain that information from the context of this class?

Any idea where to look for the way it was implemented before we migrated to rely Microsoft.CodeAnalysis?

@dsyme dsyme added the Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. label May 3, 2017
@cartermp cartermp modified the milestones: VS 2017 Updates, vFuture Jun 9, 2018
@cartermp cartermp modified the milestones: vFuture, 16.0 Jul 29, 2018
@cartermp cartermp modified the milestones: 16.0, Unknown Aug 25, 2018
@cartermp cartermp removed the Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. label Sep 3, 2020
@dsyme dsyme changed the title VS2017: change in behaviour with indentation and new lines improve smart indentation Sep 16, 2021
@dsyme dsyme added Area-VS-Editor VS editor support for F# code, not covered elsewhere and removed Area-LangService-API labels Apr 5, 2022
@vzarytovskii vzarytovskii moved this to Not Planned in F# Compiler and Tooling Jun 17, 2022
@vzarytovskii vzarytovskii reopened this Jan 4, 2024
@github-project-automation github-project-automation bot moved this from Done to In Progress in F# Compiler and Tooling Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VS-Editor VS editor support for F# code, not covered elsewhere Feature Improvement
Projects
Archived in project
Development

No branches or pull requests

5 participants