-
Notifications
You must be signed in to change notification settings - Fork 154
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
Re-enable FSharpLint integration #942
Comments
- FSAutocomplete configured through LSP - FSharpLint not enabled yet (see corresponding issue ionide/FsAutoComplete#942) - Random RPC and index out of bounds errors for FSAutocomplete, will check out later
- FSAutocomplete configured through LSP - FSharpLint not enabled yet (see corresponding issue ionide/FsAutoComplete#942) - Random RPC and index out of bounds errors for FSAutocomplete, will check out later - Using Ionide syntax highlighting support (no Treesitter grammar available, maybe I should write one?)
- FSAutocomplete configured through LSP - FSharpLint not enabled yet (see corresponding issue ionide/FsAutoComplete#942) - Random RPC and index out of bounds errors for FSAutocomplete, will check out later - Using Ionide syntax highlighting support (no Treesitter grammar available, maybe I should write one?)
- FSAutocomplete configured through LSP - FSharpLint not enabled yet (see corresponding issue ionide/FsAutoComplete#942) - Random RPC and index out of bounds errors for FSAutocomplete, will check out later - Using Ionide syntax highlighting support (no Treesitter grammar available, maybe I should write one?)
So, what's the current situation with FSharpLint integration (besides FSharpLint itself apparently having not been updated past .NET 5) ? |
It's currently disabled from an IDE integration perspective because the API of the compiler libraries it was built against and the version of those compiler libraries we use have drifted rather significantly. This is a consequence of the lack of API Binary Compatibility in the compiler libraries. Fantomas has the same problem, but that tool has circumvented the problem by creating an API surface that doesn't directly expose the compiler services, instead delegating to an external process. This model could work with fsharplint as well. |
Yeah having a layer like Fantomas does currently was my thoughts as well but I don’t have the capacity to maintain another big repo like that. |
Thanks for the update. Alas, I don't have enough to to do anything more that the odd fix here and there either |
@baronfel, I'd like to start working on FSharpLint LSP layer. Previous implementation was using I suppose we could switch to the The downside is that the file will be parsed at least twice (by FSCA & by FSharpLint); is this fine or is there a better way ? |
This is basically the trade-off that we've made with Fantomas already - luckily parsing files is typically very fast. Typechecking is the really expensive thing, does FSharpLint do that as well? |
From what I remember yeah it does. We could share an rsp file so it doesn't need to do additional cracking but unless we're on the same version of FCS, we're not gonna be able to share the typecheck results. |
So, I made a rough implementation between FSharpLint (PR) and FSAC (branch). Another question, I think the previous implementation enabled linting based on 2 criteria :
|
Re: measuring impact, the 'simplest' way would be to log a message with the elapsed duration in the linting method that's actually calling the FSharpLint service. Since this call happens out-of-proc, users shouldn't see much impact on their IDE operations - just make sure that your service can handle cancellation since if a user makes changes to a file we should cancel in-progress operations and start new ones. You can also create a System.Diagnostics.Activity and then your operation will appear in OTel traces when that mechanism is hooked up for perf analysis. Regarding enablement, I think we can ensure that the
It's great to see this progressing! |
I made a few tests (I took FSAC project as test repo):
I used the following vscode configuration during the test (anything that I should change ?) "FSharp.fsac.netCoreDllPath": "~/src/FsAutoComplete/bin/Release/net6.0/fsautocomplete.dll",
"FSharp.fsac.attachDebugger": false,
"FSharp.codeLenses.references.enabled": false,
"FSharp.codeLenses.signature.enabled": false,
"FSharp.lineLens.enabled": "never",
"FSharp.trace.server": "messages",
"Fsharp.fsac.gc.noAffinitize": true,
"FSharp.openTelemetry.enabled": true,
"FSharp.fullNameExternalAutocomplete": false,
"FSharp.externalAutocomplete": true,
"FSharp.linter": true, I still have some fixes to make; right know several lint daemons are created instead of a single one for the solution but I don't think it will dramatically change the timings. |
Yeah this is because we type check all dependent files on save as changes to a File higher up can cascade breaking changes. We don't have a different configurable strategy. Some people have asked in the past for typechecking only dependent open files or not type checking dependent files at all, but at the cost of being incorrect about any errors in dependent files. It's also runs them in parallel based on cpu cores which isn't configurable either. The main question in my mind would be, if someone updates a file, do we need to run linting on dependent files? For instance, making a change to Either way, we should probably have some type of strategies on save that:
|
I spent hours trying to make FSharpLint work in Ionide. Then I saw this thread 🤦♂️ |
There's some work going on at fsprojects/FSharpLint#637 |
We should work to update our FSharpLint dependency and verify the integration still works.
The text was updated successfully, but these errors were encountered: