Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8497801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:13:44+00:00 2026-06-11T00:13:44+00:00

I’d like to format the document: give it indentation and stuff like that. Ctrl

  • 0

I’d like to format the document: give it indentation and stuff like that.

Ctrl K + Ctrl D/F in Visual Studio doesn’t work for F#, does anybody have any workaround for that? It does work for C# though…

EDIT: What I’d like to do is to copy-paste some code from an external source. I usually use Ctrl K + Ctrl D to format it, and it works for C#. However, in an .fs file, it doesn’t seem to work. On top of that, indentation seems to be pretty much a must-have for F#…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:13:46+00:00Added an answer on June 11, 2026 at 12:13 am

    F# is indentation sensitive, so if you copy valid code from one location to another, the only thing that you might need to do is to make sure it has the right offset from the left side. For example, say you have:

    let test () = 
      printfn "Hello world" // (*)
    
    let another () = 
      for i in 0 .. 10 do
        test()              // (#)
      printfn "finished"
    

    Now, if you wanted to copy the line (*) and use it instead of a call to test, just Copy & Paste would turn your code into the following:

    let another () = 
      for i in 0 .. 10 do
      printfn "Hello world" // (*)
      printfn "finished"
    

    This has a different meaning though! It repeates both of the printfn lines 10 times. So, instead what you would want to get is this:

    let another () = 
      for i in 0 .. 10 do
        printfn "Hello world" // (*)
      printfn "finished"
    

    The way to do Copy & Paste in Visual Studio to keep the same meaning of code is to paste the copied code as usual (Ctrl+V) and then, while the code is still selected, correct the indentation. To indent the code further use Tab and to indent it less far use Shift+Tab.

    This way, you can use Copy and Paste for F# code just fine. You do not need to reformat the entire block, because valid F# code copied to another place will automatically be well formatted. You just need to fix the indentation.

    Regarding the #light mode mentioned in comments – in earlier versions of F#, it was possible to use additional keywords and semicolons instead of indentation-sensitive mode. The modern indentation-sensitive style was called #light, but it is now default and you do not need to worry about the legacy style.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.