@@ -23,7 +23,6 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
23
23
required lsp.SymbolKind kind,
24
24
required lsp.Range symbolRange,
25
25
lsp.Range ? nameRange,
26
- lsp.Range ? bodyRange, // TODO: delete if unused
27
26
String ? docComment,
28
27
String ? detail,
29
28
List <lsp.SymbolTag >? tags}) {
@@ -49,9 +48,6 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
49
48
var keep = < StylesheetDocumentSymbol > [];
50
49
51
50
for (var other in symbols) {
52
- // This probably scales terribly with document size.
53
- // A tree structure that uses ranges for lookup would probably be the ticket here.
54
- // We can maybe get away with it if we cache the result.
55
51
if (_containsRange (symbol.range, other.range)) {
56
52
symbol.children! .add (other);
57
53
} else {
@@ -90,24 +86,6 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
90
86
return false ;
91
87
}
92
88
93
- lsp.Range ? _bodyRange (sass.ParentStatement <List <sass.Statement >?> node) {
94
- if (node.children case var children? ) {
95
- if (children.isEmpty) {
96
- return null ;
97
- }
98
-
99
- return lsp.Range (
100
- start: lsp.Position (
101
- line: children.first.span.start.line,
102
- character: children.first.span.start.column),
103
- end: lsp.Position (
104
- line: children.last.span.start.line,
105
- character: children.last.span.start.column));
106
- }
107
-
108
- return null ;
109
- }
110
-
111
89
String ? _detail (sass.CallableDeclaration node) {
112
90
var arguments = node.arguments.arguments
113
91
.map <String >((arg) => arg.defaultValue != null
@@ -120,6 +98,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
120
98
@override
121
99
void visitAtRule (node) {
122
100
super .visitAtRule (node);
101
+
123
102
if (! node.name.isPlain) {
124
103
return ;
125
104
}
@@ -129,8 +108,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
129
108
name: node.name.span.text,
130
109
kind: lsp.SymbolKind .Class ,
131
110
symbolRange: toRange (node.span),
132
- nameRange: toRange (node.name.span),
133
- bodyRange: _bodyRange (node));
111
+ nameRange: toRange (node.name.span));
134
112
} else if (node.name.asPlain! .startsWith ('keyframes' )) {
135
113
var keyframesName = node.span.context.split (' ' ).elementAtOrNull (1 );
136
114
if (keyframesName != null ) {
@@ -147,8 +125,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
147
125
name: keyframesName,
148
126
kind: lsp.SymbolKind .Class ,
149
127
symbolRange: toRange (node.span),
150
- nameRange: keyframesNameRange,
151
- bodyRange: _bodyRange (node));
128
+ nameRange: keyframesNameRange);
152
129
}
153
130
}
154
131
}
@@ -161,8 +138,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
161
138
name: node.name.span.text,
162
139
kind: lsp.SymbolKind .Variable ,
163
140
symbolRange: toRange (node.span),
164
- nameRange: toRange (node.name.span),
165
- bodyRange: _bodyRange (node));
141
+ nameRange: toRange (node.name.span));
166
142
}
167
143
}
168
144
@@ -176,8 +152,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
176
152
kind: lsp.SymbolKind .Function ,
177
153
docComment: node.comment? .docComment,
178
154
symbolRange: toRange (node.span),
179
- nameRange: toRange (node.nameSpan),
180
- bodyRange: _bodyRange (node));
155
+ nameRange: toRange (node.nameSpan));
181
156
}
182
157
183
158
@override
@@ -202,8 +177,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
202
177
name: '@media ${node .query .asPlain }' ,
203
178
kind: lsp.SymbolKind .Module ,
204
179
symbolRange: toRange (node.span),
205
- nameRange: nameRange,
206
- bodyRange: _bodyRange (node));
180
+ nameRange: nameRange);
207
181
}
208
182
209
183
@override
@@ -216,8 +190,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
216
190
kind: lsp.SymbolKind .Method ,
217
191
docComment: node.comment? .docComment,
218
192
symbolRange: toRange (node.span),
219
- nameRange: toRange (node.nameSpan),
220
- bodyRange: _bodyRange (node));
193
+ nameRange: toRange (node.nameSpan));
221
194
}
222
195
223
196
@override
@@ -279,8 +252,7 @@ class DocumentSymbolsVisitor with sass.RecursiveStatementVisitor {
279
252
name: name! ,
280
253
kind: lsp.SymbolKind .Class ,
281
254
symbolRange: symbolRange! ,
282
- nameRange: nameRange,
283
- bodyRange: _bodyRange (node));
255
+ nameRange: nameRange);
284
256
}
285
257
} on sass.SassFormatException catch (_) {
286
258
// Do nothing.
0 commit comments