Skip to content

Commit c342a21

Browse files
authored
Remove imports from symbols (microsoft#1951)
1 parent 8d42298 commit c342a21

File tree

2 files changed

+1
-30
lines changed

2 files changed

+1
-30
lines changed

src/LanguageServer/Impl/Indexing/SymbolIndexWalker.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -124,28 +124,6 @@ private void GetKinds(FunctionDefinition node, out SymbolKind symbolKind, out st
124124
}
125125
}
126126

127-
public override bool Walk(ImportStatement node) {
128-
foreach (var (nameNode, nameString) in node.Names.Zip(node.AsNames, (name, asName) => asName != null ? (asName, asName.Name) : ((Node)name, name.MakeString()))) {
129-
var span = nameNode.GetSpan(_ast);
130-
_stack.AddSymbol(new HierarchicalSymbol(nameString, SymbolKind.Module, span, existInAllVariable: ExistInAllVariable(nameString)));
131-
}
132-
133-
return false;
134-
}
135-
136-
public override bool Walk(FromImportStatement node) {
137-
if (node.IsFromFuture) {
138-
return false;
139-
}
140-
141-
foreach (var name in node.Names.Zip(node.AsNames, (name, asName) => asName ?? name)) {
142-
var span = name.GetSpan(_ast);
143-
_stack.AddSymbol(new HierarchicalSymbol(name.Name, SymbolKind.Module, span, existInAllVariable: ExistInAllVariable(name.Name)));
144-
}
145-
146-
return false;
147-
}
148-
149127
public override bool Walk(AssignmentStatement node) {
150128
WalkIfNotLibraryMode(node.Right);
151129

src/LanguageServer/Test/SymbolIndexWalkerTests.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,7 @@ from os.path import ( join as osjoin2, exists as osexists, expanduser )
196196
";
197197

198198
var symbols = WalkSymbols(code);
199-
symbols.Should().BeEquivalentToWithStrictOrdering(new[] {
200-
new HierarchicalSymbol("sys", SymbolKind.Module, new SourceSpan(1, 8, 1, 11)),
201-
new HierarchicalSymbol("np", SymbolKind.Module, new SourceSpan(2, 17, 2, 19)),
202-
new HierarchicalSymbol("osjoin", SymbolKind.Module, new SourceSpan(3, 29, 3, 35)),
203-
new HierarchicalSymbol("osjoin2", SymbolKind.Module, new SourceSpan(4, 31, 4, 38)),
204-
new HierarchicalSymbol("osexists", SymbolKind.Module, new SourceSpan(4, 50, 4, 58)),
205-
new HierarchicalSymbol("expanduser", SymbolKind.Module, new SourceSpan(4, 60, 4, 70)),
206-
});
199+
symbols.Should().BeEmpty();
207200
}
208201

209202
[TestMethod, Priority(0)]

0 commit comments

Comments
 (0)