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

[WIP] Run FSharp.Formatting on FCS only #432

Merged
merged 50 commits into from
Apr 23, 2017

Conversation

cloudRoutine
Copy link
Member

  • remove dependency on VFPT.Core
  • upgrade to FSharp 4.1
  • colorize more token types
  • upgrade to netcore?

@matthid after this maybe we could work on polishing up the infrastructure for this repo, setting up the dotliquid lib, and making this generally easier to work with?

I know I need to adjust the tests since there are a lot more token kinds and I'm not sure that the changes I made are working quite right. It'll probably be a while before I get around to finishing this, I've got a lot of other things I'm working on atm

@matthid
Copy link
Member

matthid commented Apr 2, 2017

@cloudRoutine not sure what you mean.

regarding these changes: I generally like the move away from vfpt, because it will get rid of some weird errors when the api of fcs broke. However: Our lobrary users still have the same problem (like vfpt.core has). Really the problem is that fcs breaks its api all the time and all core fsharp projects need to fix it.

Isn't the correct dependency Fsharp.editing for colorization?

Maybe it's easier if this pr contains no colorization changes and just the updates?

Copy link
Member

@matthid matthid left a comment

Choose a reason for hiding this comment

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

Good stuff on the way :)

// Force load
if (typeof<System.Web.Razor.ParserResults>.Assembly.GetName().Version.Major <= 2) then
failwith "Wrong System.Web.Razor Version loaded!"

#r "../System.ValueTuple/lib/portable-net40+sl4+win8+wp8/System.ValueTuple.dll"
Copy link
Member

Choose a reason for hiding this comment

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

Btw this dependency was removed in latest FCS ...

@@ -59,7 +64,7 @@ module private Helpers =
let defines = defines |> Option.map (fun (s:string) ->
s.Split([| ' '; ';'; ',' |], StringSplitOptions.RemoveEmptyEntries) |> List.ofSeq)
// Create source tokenizer
let sourceTok = SourceTokenizer(defaultArg defines [], file)
let sourceTok = FSharpSourceTokenizer(defaultArg defines [], file)
Copy link
Member

Choose a reason for hiding this comment

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

space :)

//| _ when island.Length > 1 ->
// // Try to find some information about the last part of the identifier
// let tip = checkResults.GetIdentTooltip(line + 1, token.LeftColumn + 2, lines.[line], [ processDoubleBackticks body ])
// Async.RunSynchronously tip |> Option.bind ToolTipReader.tryFormatTip
Copy link
Member

Choose a reason for hiding this comment

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

Just remove when this is no longer needed.

FSharp.Formatting.Common.Log.errorf "Language Service Error (%s, %s, %A): %O" str1 str2 opts exn)
let fsChecker = FSharpChecker.Create()
//do fsChecker.SetCriticalErrorHandler(fun exn str1 str2 opts ->
// FSharp.Formatting.Common.Log.errorf "Language Service Error (%s, %s, %A): %O" str1 str2 opts exn)
Copy link
Member

Choose a reason for hiding this comment

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

I never have seen this error message. Do we need something similar now. Or can we just remove this?


// let! symbolUses = checkResults.GetAllUsesOfAllSymbolsInFile () |> liftAsync
// return checkResults, symbolUses
//}
Copy link
Member

Choose a reason for hiding this comment

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

dito

Copy link
Member Author

Choose a reason for hiding this comment

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

i'm still getting all of the build configuration kinks worked out, i'll come back around and polish it up all spiffy once it actually works again 😉

{ opts with OtherOptions = Helpers.parseOptions str }
| _ -> opts

// Run the second phase - perform type checking
let checkResults, symbolUses = getTypeCheckInfo(file, source, opts) |> Async.RunSynchronously
//let! (checkResults, symbolUses) = getTypeCheckInfo(file, source, opts)
Copy link
Member

Choose a reason for hiding this comment

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

comment

@@ -358,8 +365,13 @@ type CodeFormatAgent() =
// Receive parameters for the next parsing request
let! request, (chnl:AsyncReplyChannel<_>) = agent.Receive()
try
let! res, errs = processSourceCode request
chnl.Reply(Choice1Of2(res |> Array.ofList, errs))
//let! res, errs = processSourceCode request
Copy link
Member

Choose a reason for hiding this comment

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

comment

| TokenKind.Enumeration -> CSS.Enumeration
| TokenKind.Interface -> CSS.Interface
| TokenKind.Property -> CSS.Property
| TokenKind.UnionCase -> CSS.UnionCase
Copy link
Member

Choose a reason for hiding this comment

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

I'm actually not a huge fan of this code style as it complicates adding new (longer) entries and makes the diff longer in such cases (and "blame" harder)...

But I'll probably accept without reverting this (Just for your info)

Copy link
Member Author

Choose a reason for hiding this comment

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

several of them are used in multiple places, they should not be hardcoded

Copy link
Member

Choose a reason for hiding this comment

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

What I meant was the indentation of ->. Extracting the strings is fine and good :)

Copy link
Member Author

Choose a reason for hiding this comment

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

oh, hahaha. I have a hotkey that does the formatting, the main reason I format stuff like this is to do multi-line edits, keeping it all lined up and purrty doesn't really matter to me.

@cloudRoutine
Copy link
Member Author

you're gonna have to give up on the giant github diff for this PR as a whole being anything close to readable. Although you can always go through commit by commit, and then it's pretty easy to see the changes, that's also why i title organization and formatting commits as such so they can be skipped over easily, but everyone insists on doing it the hard way /smh

@matthid
Copy link
Member

matthid commented Apr 14, 2017

Do we see comments in this PR when we comment in the commit?

@matthid
Copy link
Member

matthid commented Apr 14, 2017

The other problem is that a review is there to verify that things are still good. If I skip half of the commits because they are called "paket update or whitespace changes" nobody verifies those commits and accidential problems might introduce

  • for example some whitespaces matter in this repository
  • you might have wrongly commited other stuff in addition to whitespace changes
  • ...

@@ -102,7 +102,7 @@ let solutionFile = "FSharp.Formatting.sln"

let msbuild14 = ProgramFilesX86</>"MSBuild"</>"14.0"</>"Bin"</>"MSBuild.exe"
Copy link
Member Author

Choose a reason for hiding this comment

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

from inside the commit 😉

@cloudRoutine
Copy link
Member Author

@matthid that's fair, but at that point you might as well just read through the source straight through once I'm done.

There's a lot of technical debt that's accumulated here, and paying it off is gonna be messy 😁

@matthid
Copy link
Member

matthid commented Apr 15, 2017

There's a lot of technical debt that's accumulated here, and paying it off is gonna be messy 😁

Sorry if I disturbed you, I thought it might help :).
Ok I'll wait. Thanks for taking care of this

@cloudRoutine
Copy link
Member Author

nah you didn't bother me, I just don't want you to waste your time perusing diffs that'll probably be outdated quickly.

this stops the memory overload exception bug that prevents the test
runner from loading any tests
unless this EXACT version is used FsUnit throws all kinds of type load
exceptions
build.fsx Outdated
++ "tests/FSharp.MetadataFormat.Tests/files/**/bin"
++ "tests/FSharp.MetadataFormat.Tests/files/**/obj"
|> CleanDirs
CreateDir "tests/bin"
Copy link
Member

Choose a reason for hiding this comment

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

Something there is still not working...

.editorconfig Outdated
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
Copy link
Member

Choose a reason for hiding this comment

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

Should this be gitignored? Which editor is this?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's supposed to be commited, it's for many many editors,

Copy link
Member

Choose a reason for hiding this comment

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

thanks didn't know that :)

@cloudRoutine
Copy link
Member Author

if you're trying to fix the travis build the issues are with stuff like

Copying packages/FSharp.Core/lib/net45/FSharp.Core.dll to bin/FSharp.Core.dll

the paths aren't always full, but this isn't the real reason why stuff is failing
can you enable appveyor for this repo?

@matthid
Copy link
Member

matthid commented Apr 17, 2017

I can repro this on windows as well on a clean checkout...
But CleanDirs should create the directory if it doesn't exist. Something is wrong here

@cloudRoutine
Copy link
Member Author

cloudRoutine commented Apr 17, 2017

the paths need to be full, that's the problem, i'm fixing the same problem on an argu travis build ATM too

@matthid
Copy link
Member

matthid commented Apr 17, 2017

why?

@matthid
Copy link
Member

matthid commented Apr 17, 2017

It always worked like this?

@cloudRoutine
Copy link
Member Author

¯\_(ツ)_/¯
who knows?
Travis is the worst

@matthid
Copy link
Member

matthid commented Apr 17, 2017

I think the problem is that !! only matches existing stuff so its not the same as the old logic

@matthid
Copy link
Member

matthid commented Apr 17, 2017

so !! "tests/bin" is an empty sequence and CleanDirs never retrieves it as argument

@matthid
Copy link
Member

matthid commented Apr 17, 2017

Associated XML file '/home/travis/build/tpetricek/FSharp.Formatting/tests/bin/csharpSupport.xml' was not found.
Probably something with casing on linux... The defaults are .XML (no idea why)

@matthid matthid self-assigned this Apr 23, 2017
@matthid
Copy link
Member

matthid commented Apr 23, 2017

This Build currently fails, because FAKE is using an older FSharp.Core and it therefore doesn't work on runtime... We should update FAKE to latest FSharp.Core (fsprojects/FAKE#1527).

This is only a quickfix, the correct fix is to update to the new netcore FAKE version which doesn't have this problem. Therefore I'll add a netcore output for FSF and change to the new FAKE version to get the version3 branch green.

@matthid matthid merged commit 1eb309a into fsprojects:version3 Apr 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants