Skip to content

Commit 8fb93bb

Browse files
committed
properly add parentheses to all java methods in PC
1 parent 1e29a19 commit 8fb93bb

21 files changed

+68
-68
lines changed

presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object AutoImports:
2323
def renameConfigMap(config: PresentationCompilerConfig)(using
2424
Context
2525
): Map[Symbol, String] =
26-
config.symbolPrefixes.nn.asScala.flatMap { (from, to) =>
26+
config.symbolPrefixes().nn.asScala.flatMap { (from, to) =>
2727
val pkg = SemanticdbSymbols.inverseSemanticdbSymbol(from)
2828
val rename = to.stripSuffix(".").stripSuffix("#")
2929
List(pkg, pkg.map(_.moduleClass)).flatten
@@ -246,7 +246,7 @@ object AutoImports:
246246
// see WorksheetProvider.worksheetScala3AdjustmentsForPC
247247
val indent =
248248
if pos.source.path.isWorksheet &&
249-
editPos.getStart().nn.getCharacter == 0
249+
editPos.getStart().nn.getCharacter() == 0
250250
then indent0.drop(2)
251251
else indent0
252252
val topPadding =

presentation-compiler/src/main/dotty/tools/pc/AutoImportsProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ final class AutoImportsProvider(
2929
)(using ReportContext):
3030

3131
def autoImports(isExtension: Boolean): List[AutoImportsResult] =
32-
val uri = params.uri.nn
33-
val text = params.text.nn
32+
val uri = params.uri().nn
33+
val text = params.text().nn
3434
val filePath = Paths.get(uri)
3535
driver.run(uri, SourceFile.virtual(filePath.toString, text))
3636

presentation-compiler/src/main/dotty/tools/pc/CompletionItemResolver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object CompletionItemResolver extends ItemResolver:
3030
.orElse(
3131
search.symbolDocumentation(gsym.companion)
3232
) match
33-
case Some(info) if item.getDetail != null =>
33+
case Some(info) if item.getDetail() != null =>
3434
enrichDocs(
3535
item,
3636
info,

presentation-compiler/src/main/dotty/tools/pc/ConvertToNamedArgumentsProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ final class ConvertToNamedArgumentsProvider(
2323
):
2424

2525
def convertToNamedArguments: Either[String, List[l.TextEdit]] =
26-
val uri = params.uri.nn
27-
val text = params.text.nn
26+
val uri = params.uri().nn
27+
val text = params.text().nn
2828
val filePath = Paths.get(uri)
2929
driver.run(uri, SourceFile.virtual(filePath.toString, text))
3030

presentation-compiler/src/main/dotty/tools/pc/ExtractMethodProvider.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ final class ExtractMethodProvider(
3838
extends ExtractMethodUtils:
3939

4040
def extractMethod(): List[TextEdit] =
41-
val text = range.text.nn
42-
val uri = range.uri.nn
41+
val text = range.text().nn
42+
val uri = range.uri().nn
4343
val filePath = Paths.get(uri)
4444
val source = SourceFile.virtual(filePath.toString, text)
4545
driver.run(uri, source)

presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ object HoverProvider:
3232
driver: InteractiveDriver,
3333
search: SymbolSearch
3434
)(implicit reportContext: ReportContext): ju.Optional[HoverSignature] =
35-
val uri = params.uri.nn
36-
val text = params.text.nn
35+
val uri = params.uri().nn
36+
val text = params.text().nn
3737
val sourceFile = SourceFile.virtual(uri, text)
3838
driver.run(uri, sourceFile)
3939

@@ -126,7 +126,7 @@ object HoverProvider:
126126

127127
val docString = symbolTpes
128128
.flatMap(symTpe => search.symbolDocumentation(symTpe._1))
129-
.map(_.docstring)
129+
.map(_.docstring())
130130
.mkString("\n")
131131
printer.expressionType(exprTpw) match
132132
case Some(expressionType) =>

presentation-compiler/src/main/dotty/tools/pc/InferredTypeProvider.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ final class InferredTypeProvider(
6262
adjustOpt: Option[AdjustTypeOpts] = None
6363
): List[TextEdit] =
6464
val retryType = adjustOpt.isEmpty
65-
val uri = params.uri.nn
65+
val uri = params.uri().nn
6666
val filePath = Paths.get(uri).nn
6767

68-
val sourceText = adjustOpt.map(_.text).getOrElse(params.text.nn)
68+
val sourceText = adjustOpt.map(_.text).getOrElse(params.text().nn)
6969
val source =
7070
SourceFile.virtual(filePath.toString(), sourceText)
7171
driver.run(uri, source)
@@ -187,7 +187,7 @@ final class InferredTypeProvider(
187187
Some(
188188
AdjustTypeOpts(
189189
removeType(vl.namePos.end, tpt.sourcePos.end - 1),
190-
tpt.sourcePos.toLsp.getEnd.nn
190+
tpt.sourcePos.toLsp.getEnd().nn
191191
)
192192
)
193193
)
@@ -226,7 +226,7 @@ final class InferredTypeProvider(
226226
Some(
227227
AdjustTypeOpts(
228228
removeType(lastColon, tpt.sourcePos.end - 1),
229-
tpt.sourcePos.toLsp.getEnd.nn
229+
tpt.sourcePos.toLsp.getEnd().nn
230230
)
231231
)
232232
)
@@ -255,7 +255,7 @@ final class InferredTypeProvider(
255255
val firstEnd = patterns(0).endPos.end
256256
val secondStart = patterns(1).startPos.start
257257
val hasDot = params
258-
.text.nn
258+
.text().nn
259259
.substring(firstEnd, secondStart).nn
260260
.exists(_ == ',')
261261
if !hasDot then

presentation-compiler/src/main/dotty/tools/pc/PcCollector.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ abstract class PcCollector[T](
3333
params: VirtualFileParams
3434
):
3535
private val caseClassSynthetics: Set[Name] = Set(nme.apply, nme.copy)
36-
val uri = params.uri.nn
36+
val uri = params.uri().nn
3737
val filePath = Paths.get(uri).nn
38-
val sourceText = params.text.nn
38+
val sourceText = params.text().nn
3939
val source =
4040
SourceFile.virtual(filePath.toString(), sourceText)
4141
driver.run(uri, source)
@@ -49,7 +49,7 @@ abstract class PcCollector[T](
4949
val offsetParams =
5050
params match
5151
case op: OffsetParams => op
52-
case _ => CompilerOffsetParams(uri, sourceText, 0, params.token.nn)
52+
case _ => CompilerOffsetParams(uri, sourceText, 0, params.token().nn)
5353
val pos = driver.sourcePosition(offsetParams)
5454
val rawPath =
5555
Interactive

presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class PcDefinitionProvider(
3636
definitions(findTypeDef = true)
3737

3838
private def definitions(findTypeDef: Boolean): DefinitionResult =
39-
val uri = params.uri.nn
40-
val text = params.text.nn
39+
val uri = params.uri().nn
40+
val text = params.text().nn
4141
val filePath = Paths.get(uri)
4242
driver.run(
4343
uri,
@@ -54,7 +54,7 @@ class PcDefinitionProvider(
5454
if findTypeDef then findTypeDefinitions(path, pos, indexedContext)
5555
else findDefinitions(path, pos, indexedContext)
5656

57-
if result.locations.nn.isEmpty() then fallbackToUntyped(pos)(using ctx)
57+
if result.locations().nn.isEmpty() then fallbackToUntyped(pos)(using ctx)
5858
else result
5959
end definitions
6060

presentation-compiler/src/main/dotty/tools/pc/PcInlineValueProviderImpl.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ final class PcInlineValueProviderImpl(
2727
) extends PcCollector[Occurence](driver, params)
2828
with InlineValueProvider:
2929

30-
val text = params.text.nn.toCharArray().nn
30+
val text = params.text().nn.toCharArray().nn
3131

32-
val position: l.Position = pos.toLsp.getStart.nn
32+
val position: l.Position = pos.toLsp.getStart().nn
3333

3434
override def collect(parent: Option[Tree])(
3535
tree: Tree,

0 commit comments

Comments
 (0)