-
Notifications
You must be signed in to change notification settings - Fork 790
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
Saving a script file under a different name results in loss of colorization #1944
Comments
We should test similar scenarios in projects as well (e.g. adding/deleting/renaming files in projects) |
I can't repro this on master from up until here: 4b8aafd |
Can't repro either, using VisualFSharpOpenSource from a few days ago. |
Got it to repro: It looks like reserved keywords aren't getting colorized, but type information is. Repro steps (on latest master):
type BST<'T> =
| Empty
| Node of 'T * BST<'T> * BST<'T>
let getStringAsync(str: string) = async { return str }
let fooAsync() = async {
let! str1 = getStringAsync "hello"
let! str2 = getStringAsync "world"
return str1 + str2
} Now rename it to |
Looks like |
I didn't even need to rename the file. I added the file to an existing project, pasted the code, saved it and then I suffered the same discolouration as above. |
This would happen if the |
Simple repro is to rename a script file in Solution Explorer. Cause of this bug is that we currently don't handle script file renaming. Roslyn exports a |
The reason this is happening is because in FSharpLanguageService we're listening on Workspace.DocumentClosed. This is fired when the script file is renamed, and so we remove the single-file project. DocumentOpened is never fired again and neither is SetupNewTextView (what we use to setup single file projects). @Pilchie do you know what the proper way to setup single-file projects is? What event should we be listening to that will fire when a document is renamed? |
@majocha We can't use MiscellaneousFileWorkspace until dotnet/roslyn#17263 is made available. See dotnet/roslyn#17263 (comment) |
…ion (add support changing project references) Fixes dotnet#2916, fixes dotnet#1944
I can confirm that this does not appear to be fixed by #3025 |
Is there any eta or plan for this fix? |
Not at the moment, no. |
Shame - I fixed this is #2909. |
I’m actually keen on getting that PR worked on, or at least chunks pulled out and merged. But we sinply lack the bandwidth right now due to .NET Core platform and tooling bringup. |
I’ll pull out the fix for this issue now and take a stab at using the MiscellaneousFilesWorkspace - that’s the proper fix (but we couldn’t use it back then) |
@saul Awesome! Just in terms of timeframe, VS 15.6 release is unlikely to take a fix like this since we're nearly locked down, but 15.7 is still quite open. |
Just as an update, renaming a Now that we depend on updated Roslyn and editor binaries, we could probably fix this a lot easier than before. |
Closing as fixed. Note that we're also in the process of letting Roslyn effectively handle this all for us with a proper workspace here: dotnet/roslyn#31134 |
Saving a script file under a different name results in loss of colorization
Repro steps
Provide the steps required to reproduce the problem
Take script1.fsx containing some F# code. Observe its colors
Save it as script2.fsx. Observe its colors
Expected behavior
Colorized in both cases
Actual behavior
Colorized only prior to the save-as operation
Known workarounds
close/open the file
The text was updated successfully, but these errors were encountered: