Repository navigation
Improve fake script support - #402
Conversation
|
I need some support on these points:
|
…o improve_fake_script_support Conflicts: paket.lock src/FsAutoComplete.Core/Commands.fs src/FsAutoComplete.Core/CompilerServiceInterface.fs src/FsAutoComplete.Core/SimplifyNameAnalyzer.fs
As I'm already running into issues after merging latest master I guess we should not underestimate this... |
|
Maybe the following could work for us: This would be only needed when there are (relevant) breaking changes in If that process turns out to be too slow (Would say at least half a day until all builds/checks have run and the PR is Reviewed/merged). We could add a manual release path for https://www.nuget.org/packages/Fake.Runtime/ and https://www.nuget.org/packages/Fake.Core.Context/ (ie just |
matthid
left a comment
There was a problem hiding this comment.
Some general comments regarding the changes in this PR. Let me know if I should send some of them in a separate PR.
| symbolUse, partialName.QualifyingIdents, plidStartCol, partialName.PartialIdent) | ||
| if symbolUse.RangeAlternate.EndLine <> symbolUse.RangeAlternate.StartLine then | ||
| // Problem: EndColumn > lineStr.Length -> logic needs to account for multiple lines.. | ||
| symbolUse, [], 0, "" |
There was a problem hiding this comment.
There seems to be a logic flaw here (something changed with the merge as there was a conflict, but I think this is still true)
There was a problem hiding this comment.
I'm not sure if I understand why this needs to be changed. How can symbol usage be longer than one line? Can you post some sample code for that?
There was a problem hiding this comment.
The code in question was this
let depsFile = File.ReadAllText (gitDirectory </> "paket.dependencies")
let replacedFile =
depsFile
.Replace("// FAKE_MYGET_FEED (don't edit this line)", "source https://www.myget.org/F/fake-vsts/api/v3/index.json")
.Replace("prerelease // FAKE_VERSION (don't edit this line)", nugetVersion)
File.WriteAllText(gitDirectory </> "paket.dependencies", replacedFile)And I think Replace was marked the usage then is from depsFile to the next line until ( which is longer than the last line
| Fake.Runtime.Trace.VerboseLevel.Verbose [] file [] true false | ||
| let prepared = Fake.Runtime.FakeRuntime.prepareFakeScript config | ||
| let isFakeScript = prepared.DependencyType <> Fake.Runtime.FakeRuntime.PreparedDependencyType.DefaultDependencies | ||
| if not isFakeScript then return projOptions |
There was a problem hiding this comment.
Until this isFakeScript check it should be pretty fast. prepareFakeScript basically does tokenize the script, which I feel is acceptable.
in the fake branch there is all the logic for downloading NuGet packages and resolving the proper arguments...
|
I'll take a look at that tomorrow.
The easiest way to test it should be using If you can build Ionide locally (i know it's bit problematic) you can try using ionide-vscode-fsharp |
|
OK, in general I like that. My only worry is already mentioned fact that
I'm not sure, it just works for me, have you run
We update our internal state of the files on every keystroke. For something like detection of Paket header changes I guess we should use the same strategy as for typechecking - we use debouncer, and we start typechecking after user stopped writing for 500ms (exact timing can be different for this feature) - https://github.com/fsharp/FsAutoComplete/blob/master/src/FsAutoComplete/FsAutoComplete.Lsp.fs#L84 As for detecting changes in |
Tell me about it... I'm maintaining Fsharp.formatting and FAKE both having fcs dependency and one running within the other ;)...
Oh thanks, I'll try that
Thanks for the pointers I'll try to take a look. What is your stand of PR size. Smaller features like it is now or complete UX story, or is it on me? Note that I noticed another advantage of this PR. You no longer need the |
I'm fine with either, but you need to remember that I update FSAC in Ionide fairly often, without any timeline, so the smaller features needs to make sense standalone without other parts. If something works only together with other features you want to add then go for a bigger PR, if something works just fine alone (like improvements in this PR) then small PRs are way to go |
|
I'll review later tonight |
enricosada
left a comment
There was a problem hiding this comment.
i added some feedback.
i think we should try to minize deps, or do it out of process.
| |> List.filter (fun arg -> arg <> "--") | ||
|
|
||
| "--simpleresolution" :: "--targetprofile:netstandard" :: "--nowin32manifest" :: args | ||
| |> List.toArray No newline at end of file |
There was a problem hiding this comment.
can we discuss about it?
mostly i'd like to avoid the deps on FAKE/paket and transitive (mono.cecil) because these constraint us later.
If we can minimize the surface, better.
we can use paket github refs to the fake .fs, or create an ah hoc assembly
Or use it out of process, as console app, so who care about deps.
if is a script initialization thing (paket), i'd like to move it in DPW.
so every fsx load support the nuget paket syntax OOTB
There was a problem hiding this comment.
i'd like to avoid the deps
I'm not sure if we have a problem here. FAKE is important, getting good UX in FSAC/Ionide seems really important from my point of view.
Also, FAKE is well maintained and regularly released project so it would bottleneck us on releases, and @matthid said he'd be open to giving us release rights for the packages we need.
I'd be in favor of merging this.
There was a problem hiding this comment.
Yes I am in favor too.
There is no problem, and don’t think we’ll get stuck.
And it’s lovely to have FAKE supported ootb.
Just trying to figure out if we can somehow minimize deps.
If not, that’s it, not hard feeling.
Maybe the only thing is that because is just a fsx -> fsharpprojectiption I’d like to move that logic in DPW, so:
- is easier to test
- works if anyone want to get the options for a fake script
I need anyway to complicate it a bit the fsx initalization to support in DPW some scenarios (choose tfm, dotnet fsi vs fsi)
But I can refactor our later, np
Yes technically it is possible and a good idea for sure, but I think really expensive (coding time) as well. Also, it will make us move very slowly. Maybe we can reconsider this after we have figured out how everything works and what our integration points are. I think this PR already encapsulates that by starting a new Note: For listing targets in the outline (or some other features I have in mind) I already need to spawn external processes because of assembly-locking. Maybe this is then an opportunity to split this out as well (no promises ;)) On the other hand, it will cost performance as well. Spawning another process is not the fastest thing in the world. Especially on windows (though it seems to get better)
How is that project related to this? I don't think I understand. There is no project file involved here? Btw. I waited for the general |
DPW is going to be the lib who gather the project system info (FCS initialization options, solution explorer info, installed .net locations, etc). In you diff, you change the FCS options after are read in let! projOptions = fsxBinder.GetProjectOptionsFromScriptBy(targetFramework, file, source)my idea is to move that initialization logic inside that, maybe modifying it a bit fsxBinder.notification |> Event.subscribe .. // subscribe to notifications, like restore started, etc
// initialize options and restore packages as needed
do! fsxBinder.InitializeProjectOptionsFromScriptBy(targetFramework, file, source)
// get fcs options
let projOptions = fsxBinder.GetProjectOptionsFromScriptBy(file) |
|
I just would like to add:
I don't think we will get far with this approach, we definitely need to do external process and some IPC magic (either webserver or just stdin/out). The reason is that while I only added a few lines they actually do a lot behind the scenes and actually need most of the dependencies... |
|
yes, 👍 for the out of process. |
|
If we want to do out of process and IPC then LSP with custom endpoints is good communication protocol ;-) we’re already doing it for Background Service |
|
I think I will look at the suggested refactoring (moving the code to the DPW, which wasn't there when I started the PR, only after the merge). But the rest will follow on separate PRs. Out of process only when there is a technical need (ie later). This is because I think this PR will already improve the situation a lot as it is today. Even without change detection you can just reload/reopen the script and it will be fine. It shouldn't touch "regular" scripts but if people report issues should be able to easily revert this or make the |
|
Feel free to leave the code here, i’ll refactor out in DPW later |
|
merged, thanks @matthid ! |



playing around with the code. Goal is:
Fake.Runtimewhen opening a scriptAutomatically suggest updating dependencies when header changesTODO:
Check why colorization is not working in theExtension Development HostFake.Runtimeand remove reflection based code(optional) Progress indicator when restoring packagesI started with the code in https://github.com/ionide/ionide-vscode-fsharp, now there are conflicts. Do I need to update the ionide-vscode-fsharp reference?
Note: for this small change it is already working way better than expected:
FAKEis defined and the IDE shows the correct code-pathsbuild.fsxfile ionide-vscode-fsharp#839 and Add reference to netstandard to prevent issues "You must add a reference to assembly netstandard"? fsprojects/FAKE#1938