-
Notifications
You must be signed in to change notification settings - Fork 156
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
When removing a file clear its diagnostics #1005
When removing a file clear its diagnostics #1005
Conversation
Issue might be: ProjectOptions for that file are still cached -> might still behaves like it's part of project.
Why not? It's still a F# file inside current workspace -- just without project. |
What I mean is it should not generates diagnostics as if the file was still part of the project. It should consider the file independent. |
Thank you @Booksbaum , your solution seems to be working. @baronfel I think there still one thing left to clean which is the pipeline hints but that less invasive that the diagnostics. |
The build errors are formatting related, run The changes look reasonable to me, I'd need to check in Ionide but I think those are computed at the same time codelens are, s if you also send the 'workspace/codeLens/refresh' notification (from the LspClient) to get the editor to re-request those. |
I also get bitten by the formatting issues. If the formatting is required I think it be easier it was just run by default on the changed files instead of failing later. In one of my project, I started using Husky.Net which allow to add git hooks and others stuff in your project. With a Husky task like this one: {
"tasks": [
{
"name": "dotnet-format",
"command": "dotnet",
"args": [ "fantomas", "${staged}" ],
"include": [ "**/*.fs", "**/*.fsi" ]
}
]
} and this pre-commit code The only step required to have that working is to restore the dotnet tools and I think call What do you think about this workflow? |
My initial thoughts are
Go ahead and add it and we can see how it looks |
It is possible to not use Husky and directly attach to the git hook mechanism. However, we will need to handle more logic as we will not "benefit" from the Husky task runner. I will have a look at what this involve and if possible show both implementation for comparaison. |
8aafe9b
to
c66d184
Compare
Hello @baronfel I don't think the failing tests are related to my changes. If yes, don't hesitate to tell me :) This PR should be ready to be merged. The issues we discussed about the auto formatting will be addressed in another PR. |
I agree on all counts. Going to kick the CI again since I know some of those failures are transient, and then we'll merge. Thank you for your time and attention on this! |
…ions Fix bug where the file was still being consider part of the project on FSAC resulting in generating wrong diagnostic when editing the removed file.
c66d184
to
f3e1b23
Compare
force-pushed a merge resolution that also applies the fix to the new adaptive LSP server |
Related to ionide/ionide-vscode-fsharp#1768
This PR apply the fix suggested by @Krzysztof-Cieslak on ionide/ionide-vscode-fsharp#1768 (comment)
fsac_clear_diag_when_removing_file.mp4
It works however, if user start to edit the file again. New diagnostics are computed for this file. I believe that we need to remove/clear/unregister something else too.
Example:
fsac_new_diag_generated_after_removing_file.mp4
Editing the file should not generate diagnostics for
Log.fs
file.