public static ImmutableArray <MoveFileCodeAction> Create(State state) { Debug.Assert(state.RelativeDeclaredNamespace != null); // Since all documents have identical folder structure, we can do the computation on any of them. var document = state.Document; // In case the relative namespace is "", the file should be moved to project root, // set `parts` to empty to indicate that. var parts = state.RelativeDeclaredNamespace.Length == 0 ? ImmutableArray <string> .Empty : state.RelativeDeclaredNamespace.Split(new[] { '.' }).ToImmutableArray(); // Invalid char can only appear in namespace name when there's error, // which we have checked before creating any code actions. Debug.Assert( parts.IsEmpty || parts.Any(s => s.IndexOfAny(Path.GetInvalidPathChars()) < 0) ); var projectRootFolder = FolderInfo.CreateFolderHierarchyForProject( document.Project ); var candidateFolders = FindCandidateFolders( projectRootFolder, parts, ImmutableArray <string> .Empty ); return(candidateFolders.SelectAsArray( folders => new MoveFileCodeAction(state, folders) )); }