Skip to content
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

Use new dataflow that will provide files in project file order. #2793

Closed
KevinRansom opened this issue Sep 6, 2017 · 9 comments
Closed

Use new dataflow that will provide files in project file order. #2793

KevinRansom opened this issue Sep 6, 2017 · 9 comments
Assignees
Labels
Area-F# Specific to the F# language. Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Milestone

Comments

@KevinRansom
Copy link
Member

Propagate file order to workspace projects.

@davkean davkean self-assigned this Sep 6, 2017
@davkean davkean added the Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc label Sep 6, 2017
@davkean davkean added this to the 15.5 milestone Sep 6, 2017
@davkean davkean added Area-F# Specific to the F# language. Feature Request labels Sep 6, 2017
@cartermp
Copy link
Contributor

cartermp commented Oct 2, 2017

For any folks coming here from the test day:

This is what prevents Solution Explorer from displaying F# files in their compile order specified by the project file.

@forki
Copy link

forki commented Oct 12, 2017

Any time frame for this "feature request"?

@davkean
Copy link
Member

davkean commented Oct 12, 2017

I'll be working on this next week, prototype here from CPS, except we need to change IProjectTreeCustomizablePropertyValues2.DisplayOrder instead adding a flag:

        [Export(typeof(IProjectTreePropertiesProviderDataSource))]
        [AppliesTo("OrderedTree")]
        private class TreeItemOrderPropertyProviderSource : ChainedProjectValueDataSourceBase<IProjectTreePropertiesProvider>, IProjectTreePropertiesProviderDataSource
        {
            [Import(ExportContractNames.Scopes.UnconfiguredProject)]
            private IOrderedSourceItemsDataSourceService OrderedItemSource { get; set; }

            [ImportingConstructor]
            public TreeItemOrderPropertyProviderSource(UnconfiguredProject project)
                : base(project.Services)
            {

            }

            protected override IDisposable LinkExternalInput(ITargetBlock<IProjectVersionedValue<IProjectTreePropertiesProvider>> targetBlock)
            {
                this.JoinUpstreamDataSources(this.OrderedItemSource);

                TreeItemOrderPropertyProvider latestTreeItemOrderPropertyProvider = null;
                var providerProducerBlock = new TransformBlock<IProjectVersionedValue<IReadOnlyCollection<ProjectItemIdentity>>, IProjectVersionedValue<IProjectTreePropertiesProvider>>(
                    orderedItems =>
                    {
                        if (latestTreeItemOrderPropertyProvider?.OrderedItems != orderedItems.Value)
                        {
                            latestTreeItemOrderPropertyProvider = new TreeItemOrderPropertyProvider(orderedItems.Value);
                        }

                        return new ProjectVersionedValue<IProjectTreePropertiesProvider>(latestTreeItemOrderPropertyProvider, orderedItems.DataSourceVersions);
                    });

                providerProducerBlock.LinkTo(targetBlock, new DataflowLinkOptions() { PropagateCompletion = true });
                return this.OrderedItemSource.SourceBlock.LinkTo(providerProducerBlock, new DataflowLinkOptions() { PropagateCompletion = true });
            }

            private class TreeItemOrderPropertyProvider : IProjectTreePropertiesProvider
            {
                public TreeItemOrderPropertyProvider(IReadOnlyCollection<ProjectItemIdentity> orderedItems)
                {
                    this.OrderedItems = orderedItems;
                }

                public IReadOnlyCollection<ProjectItemIdentity> OrderedItems { get; }

                public void CalculatePropertyValues(IProjectTreeCustomizablePropertyContext propertyContext, IProjectTreeCustomizablePropertyValues propertyValues)
                {
                    if (propertyContext.ParentNodeFlags.Contains(ProjectTreeFlags.ProjectRoot) && !propertyContext.IsFolder)
                    {
                        int index = this.OrderedItems.TakeWhile(item => !string.Equals(item.EvaluatedInclude, propertyContext.ItemName, StringComparison.OrdinalIgnoreCase)).Count();
                        propertyValues.Flags = propertyValues.Flags.Add($"Order:{index}");
                    }
                }
            }
        }

@Pilchie
Copy link
Member

Pilchie commented Oct 12, 2017

Adding @natidea - can you take a look at this?

@Pilchie
Copy link
Member

Pilchie commented Oct 30, 2017

Moving back to 15.5 - @natidea has the changes here ready to go.

@Pilchie
Copy link
Member

Pilchie commented Nov 10, 2017

@natidea this should be closed now, right?

@natidea
Copy link
Contributor

natidea commented Nov 10, 2017

Closed via #2930

@natidea natidea closed this as completed Nov 10, 2017
@natidea natidea added the Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed. label Nov 10, 2017
@dhwed
Copy link

dhwed commented Nov 21, 2017

@natidea When I re-order files in my fsproj in VS15.5 preview 4, the Solution Explorer does not update. Renaming the files in the fsproj does cause the Solution Explorer to update though.

This isn't a major issue, as I can just unload and reload the project after re-ordering the files.

@cartermp
Copy link
Contributor

@dhwed This is currently expected. @natidea / @Pilchie is there an issue tracking the lack of update prior to rename or reload?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-F# Specific to the F# language. Feature-Language-Service Populating the Roslyn workspace with references, source files, analyzers, etc Resolution-Fixed The bug has been fixed, refer to the milestone to see in which release it was fixed.
Projects
None yet
Development

No branches or pull requests

8 participants