You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Saving a script file under a different name results in loss of colorization #1944
changed the title [-]Saving a script file under a different name results in loss of colorization[/-][+][ VS2017 RC] Saving a script file under a different name results in loss of colorization[/+]on Dec 5, 2016
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.
@Pilchie@brettfo Is this something we can address from the Roslyn side? Syntactic Classification isn't called for script files under certain circumstances.
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 MiscellaneousFilesWorkspace which tracks renaming scripts by implementing IVsRunningDocTableEvents2 but we don't use it.
changed the title [-][ VS2017 RC] Saving a script file under a different name results in loss of colorization[/-][+]Saving a script file under a different name results in loss of colorization[/+]on Jul 28, 2017
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.
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
Activity
[-]Saving a script file under a different name results in loss of colorization[/-][+][ VS2017 RC] Saving a script file under a different name results in loss of colorization[/+]dsyme commentedon Dec 5, 2016
We should test similar scenarios in projects as well (e.g. adding/deleting/renaming files in projects)
cartermp commentedon Dec 5, 2016
I can't repro this on master from up until here: 4b8aafd
rojepp commentedon Dec 8, 2016
Can't repro either, using VisualFSharpOpenSource from a few days ago.
cartermp commentedon Dec 19, 2016
Got it to repro:
It looks like reserved keywords aren't getting colorized, but type information is.
Repro steps (on latest master):
Script1.fsxin a new Console ApplicationNow rename it to
Script2.fsx, and observe the above.cartermp commentedon Dec 19, 2016
Looks like
IEditorClassificationService.AddSyntacticClassificationsAsyncisn't invoked on a rename, as per @brettfo's suspicions.saul commentedon Dec 31, 2016
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.
cartermp commentedon Jan 6, 2017
@Pilchie @brettfo Is this something we can address from the Roslyn side? Syntactic Classification isn't called for script files under certain circumstances.
Pilchie commentedon Jan 6, 2017
This would happen if the
ITextSnapshotdoesn't correspond to aDocumentthat is part of theWorkspace. I don't think this a Roslyn issue.majocha commentedon Mar 20, 2017
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
MiscellaneousFilesWorkspacewhich tracks renaming scripts by implementingIVsRunningDocTableEvents2but we don't use it.6 remaining items
[-][ VS2017 RC] Saving a script file under a different name results in loss of colorization[/-][+]Saving a script file under a different name results in loss of colorization[/+]cdutcher commentedon Feb 2, 2018
Is there any eta or plan for this fix?
cartermp commentedon Feb 2, 2018
Not at the moment, no.
saul commentedon Feb 2, 2018
Shame - I fixed this is #2909.
cartermp commentedon Feb 2, 2018
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.
saul commentedon Feb 2, 2018
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)
cartermp commentedon Feb 2, 2018
@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.
cartermp commentedon Sep 5, 2018
Just as an update, renaming a
.fsfile to a.fsxtriggers this issue, forcing a re-open of the document.Now that we depend on updated Roslyn and editor binaries, we could probably fix this a lot easier than before.
saul commentedon Oct 9, 2018
Fixed by @TIHan's PR: #5733
cartermp commentedon Nov 28, 2018
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