48 references to NamespaceImportDeclaration
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
101.NamespaceImportDeclaration(namespaceSymbol.ToDisplayString(SymbolDisplayFormats.NameFormat))
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (22)
CodeGeneration\SyntaxGeneratorTests.cs (22)
1740Generator.NamespaceImportDeclaration("n"), 1744Generator.NamespaceImportDeclaration("n.m"), 1761Generator.NamespaceImportDeclaration("m")), 1767Generator.NamespaceImportDeclaration("m")), 1785Generator.NamespaceImportDeclaration("n")), 1791Generator.NamespaceImportDeclaration("m")), 1796Generator.NamespaceImportDeclaration("n"), 1798Generator.NamespaceImportDeclaration("m"), 2625AssertNamesEqual("x.y", Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y")))); 2626AssertNamesEqual(new[] { "x.y", "z" }, Generator.GetNamespaceImports(Generator.AddNamespaceImports(Generator.CompilationUnit(), Generator.NamespaceImportDeclaration("x.y"), Generator.IdentifierName("z")))); 2634TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"))); 2635TestRemoveAllNamespaceImports(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y"))); 2637TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x")), "x", []); 2638TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "x", ["y"]); 2639TestRemoveNamespaceImport(Generator.CompilationUnit(Generator.NamespaceImportDeclaration("x"), Generator.IdentifierName("y")), "y", ["x"]); 2889Assert.Equal(DeclarationKind.NamespaceImport, Generator.GetDeclarationKind(Generator.NamespaceImportDeclaration("u"))); 2912Assert.Equal("u", Generator.GetName(Generator.NamespaceImportDeclaration("u"))); 2935Assert.Equal("u", Generator.GetName(Generator.WithName(Generator.NamespaceImportDeclaration("x"), "u"))); 2958Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceImportDeclaration("u"))); 2982Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private))); 3006Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceImportDeclaration("u"))); 3029Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceImportDeclaration("u"), DeclarationModifiers.Abstract)));
Microsoft.CodeAnalysis.Features (2)
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (1)
412var import = syntaxGenerator.NamespaceImportDeclaration(name);
Completion\Providers\ImportCompletionProvider\AbstractImportCompletionProvider.cs (1)
243return syntaxGenerator.NamespaceImportDeclaration(namespaceName).WithAdditionalAnnotations(Formatter.Annotation);
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicAddImportsService.vb (1)
56result.Add(generator.NamespaceImportDeclaration(import.ToDisplayString()))
Microsoft.CodeAnalysis.VisualBasic.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicAddImportsService.vb (1)
56result.Add(generator.NamespaceImportDeclaration(import.ToDisplayString()))
Microsoft.CodeAnalysis.VisualBasic.Workspaces.UnitTests (20)
CodeGeneration\SyntaxGeneratorTests.vb (20)
1663Generator.NamespaceImportDeclaration("n"), 1667Generator.NamespaceImportDeclaration("n.m"), 1685Generator.NamespaceImportDeclaration("m")), 1694Generator.NamespaceImportDeclaration("m")), 1719Generator.NamespaceImportDeclaration("n")), 1726Generator.NamespaceImportDeclaration("m")), 1735Generator.NamespaceImportDeclaration("n"), 1737Generator.NamespaceImportDeclaration("m"), 2584Assert.Equal(DeclarationKind.NamespaceImport, Generator.GetDeclarationKind(Generator.NamespaceImportDeclaration("u"))) 2609Assert.Equal("u", Generator.GetName(Generator.NamespaceImportDeclaration("u"))) 2634Assert.Equal("u", Generator.GetName(Generator.WithName(Generator.NamespaceImportDeclaration("x"), "u"))) 2656Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.NamespaceImportDeclaration("u"))) 2684Assert.Equal(Accessibility.NotApplicable, Generator.GetAccessibility(Generator.WithAccessibility(Generator.NamespaceImportDeclaration("u"), Accessibility.Private))) 2711Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.NamespaceImportDeclaration("u"))) 2733Assert.Equal(DeclarationModifiers.None, Generator.GetModifiers(Generator.WithModifiers(Generator.NamespaceImportDeclaration("u"), DeclarationModifiers.Abstract))) 3875Generator.InsertNamespaceImports(declCU, 0, Generator.NamespaceImportDeclaration("N")), 3882Generator.InsertNamespaceImports(declCU, 1, Generator.NamespaceImportDeclaration("N")), 3890Generator.InsertNamespaceImports(declCU, 2, Generator.NamespaceImportDeclaration("N")), 3898Generator.InsertNamespaceImports(declCU, 3, Generator.NamespaceImportDeclaration("N")), 3906Generator.ReplaceNode(declCU, declX, Generator.NamespaceImportDeclaration("N")),
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ImportAdderService.cs (1)
101.NamespaceImportDeclaration(namespaceSymbol.ToDisplayString(SymbolDisplayFormats.NameFormat))