@@ -60,6 +60,14 @@ class Completions(
60
60
61
61
private lazy val shouldAddSnippet =
62
62
path match
63
+ case (_ : (Import | Export )) :: _ => false
64
+ case _ :: (_ : (Import | Export )) :: _ => false
65
+ // UnApply has patterns included in MatchCaseCompletions
66
+ case _ :: (_ : UnApply ) :: _ => false
67
+ case _ => true
68
+
69
+ private lazy val shouldAddSuffix = shouldAddSnippet &&
70
+ (path match
63
71
/* In case of `method@@()` we should not add snippets and the path
64
72
* will contain apply as the parent of the current tree.
65
73
*/
@@ -72,11 +80,8 @@ class Completions(
72
80
case _ :: (withcursor @ Select (fun, name)) :: (appl : GenericApply ) :: _
73
81
if appl.fun == withcursor && name.decoded == Cursor .value =>
74
82
false
75
- case (_ : (Import | Export )) :: _ => false
76
- case _ :: (_ : (Import | Export )) :: _ => false
77
- // UnApply has patterns included in MatchCaseCompletions
78
- case _ :: (_ : UnApply ) :: _ => false
79
- case _ => true
83
+ case _ => true )
84
+
80
85
81
86
private lazy val isNew : Boolean = Completion .isInNewContext(adjustedPath)
82
87
@@ -198,12 +203,12 @@ class Completions(
198
203
private def findSuffix (symbol : Symbol ): CompletionAffix =
199
204
CompletionAffix .empty
200
205
.chain { suffix => // for [] suffix
201
- if shouldAddSnippet && symbol.info.typeParams.nonEmpty then
206
+ if shouldAddSuffix && symbol.info.typeParams.nonEmpty then
202
207
suffix.withNewSuffixSnippet(Affix (SuffixKind .Bracket ))
203
208
else suffix
204
209
}
205
210
.chain { suffix => // for () suffix
206
- if shouldAddSnippet && symbol.is(Flags .Method ) then
211
+ if shouldAddSuffix && symbol.is(Flags .Method ) then
207
212
val paramss = getParams(symbol)
208
213
paramss match
209
214
case Nil => suffix
@@ -224,7 +229,7 @@ class Completions(
224
229
else suffix
225
230
}
226
231
.chain { suffix => // for {} suffix
227
- if shouldAddSnippet && isNew && isAbstractType(symbol) then
232
+ if shouldAddSuffix && isNew && isAbstractType(symbol) then
228
233
if suffix.hasSnippet then suffix.withNewSuffix(Affix (SuffixKind .Template ))
229
234
else suffix.withNewSuffixSnippet(Affix (SuffixKind .Template ))
230
235
else suffix
0 commit comments