@@ -62,14 +62,14 @@ final class InferredTypeProvider(
62
62
adjustOpt : Option [AdjustTypeOpts ] = None
63
63
): List [TextEdit ] =
64
64
val retryType = adjustOpt.isEmpty
65
- val uri = params.uri
66
- val filePath = Paths .get(uri)
65
+ val uri = params.uri().nn
66
+ val filePath = Paths .get(uri).nn
67
67
68
- val sourceText = adjustOpt.map(_.text).getOrElse(params.text)
68
+ val sourceText = adjustOpt.map(_.text).getOrElse(params.text().nn )
69
69
val source =
70
- SourceFile .virtual(filePath.toString, sourceText)
70
+ SourceFile .virtual(filePath.toString() , sourceText)
71
71
driver.run(uri, source)
72
- val unit = driver.currentCtx.run.units.head
72
+ val unit = driver.currentCtx.run.nn. units.head
73
73
val pos = driver.sourcePosition(params)
74
74
val path =
75
75
Interactive .pathTo(driver.openedTrees(uri), pos)(using driver.currentCtx)
@@ -78,15 +78,15 @@ final class InferredTypeProvider(
78
78
val indexedCtx = IndexedContext (locatedCtx)
79
79
val autoImportsGen = AutoImports .generator(
80
80
pos,
81
- params.text ,
81
+ sourceText ,
82
82
unit.tpdTree,
83
83
unit.comments,
84
84
indexedCtx,
85
85
config
86
86
)
87
87
88
88
def removeType (nameEnd : Int , tptEnd : Int ) =
89
- sourceText.substring(0 , nameEnd) +
89
+ sourceText.substring(0 , nameEnd).nn +
90
90
sourceText.substring(tptEnd + 1 , sourceText.length())
91
91
92
92
def optDealias (tpe : Type ): Type =
@@ -134,7 +134,7 @@ final class InferredTypeProvider(
134
134
def baseEdit (withParens : Boolean ): TextEdit =
135
135
val keywordOffset = if isParam then 0 else 4
136
136
val endPos =
137
- findNamePos(params.text , vl, keywordOffset).endPos.toLsp
137
+ findNamePos(sourceText , vl, keywordOffset).endPos.toLsp
138
138
adjustOpt.foreach(adjust => endPos.setEnd(adjust.adjustedEndPos))
139
139
new TextEdit (
140
140
endPos,
@@ -148,11 +148,10 @@ final class InferredTypeProvider(
148
148
toCheckFor : Char ,
149
149
blockStartPos : SourcePosition
150
150
) =
151
- val text = params.text
152
- val isParensFunction : Boolean = text(applyEndingPos) == toCheckFor
151
+ val isParensFunction : Boolean = sourceText(applyEndingPos) == toCheckFor
153
152
154
153
val alreadyHasParens =
155
- text (blockStartPos.start) == '('
154
+ sourceText (blockStartPos.start) == '('
156
155
157
156
if isParensFunction && ! alreadyHasParens then
158
157
new TextEdit (blockStartPos.toLsp, " (" ) :: baseEdit(withParens =
@@ -188,7 +187,7 @@ final class InferredTypeProvider(
188
187
Some (
189
188
AdjustTypeOpts (
190
189
removeType(vl.namePos.end, tpt.sourcePos.end - 1 ),
191
- tpt.sourcePos.toLsp.getEnd()
190
+ tpt.sourcePos.toLsp.getEnd().nn
192
191
)
193
192
)
194
193
)
@@ -227,7 +226,7 @@ final class InferredTypeProvider(
227
226
Some (
228
227
AdjustTypeOpts (
229
228
removeType(lastColon, tpt.sourcePos.end - 1 ),
230
- tpt.sourcePos.toLsp.getEnd()
229
+ tpt.sourcePos.toLsp.getEnd().nn
231
230
)
232
231
)
233
232
)
@@ -256,8 +255,8 @@ final class InferredTypeProvider(
256
255
val firstEnd = patterns(0 ).endPos.end
257
256
val secondStart = patterns(1 ).startPos.start
258
257
val hasDot = params
259
- .text()
260
- .substring(firstEnd, secondStart)
258
+ .text().nn
259
+ .substring(firstEnd, secondStart).nn
261
260
.exists(_ == ',' )
262
261
if ! hasDot then
263
262
val leftParen = new TextEdit (body.startPos.toLsp, " (" )
@@ -309,7 +308,7 @@ final class InferredTypeProvider(
309
308
val end = if withBacktick then idx + 1 else idx
310
309
val pos = tree.source.atSpan(Span (start, end, start))
311
310
Some (pos)
312
- case None if idx < text.length =>
311
+ case None if idx < text.length() =>
313
312
val ch = text.charAt(idx)
314
313
if ch == realName.head then
315
314
lookup(idx + 1 , Some ((idx, realName.tail)), withBacktick)
0 commit comments