Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ class CompletionProvider(
val text = params.text().nn
val offset = params.offset().nn
val query = Completion.naiveCompletionPrefix(text, offset)

if offset > 0 && text.charAt(offset - 1).isUnicodeIdentifierPart
&& !CompletionProvider.allKeywords.contains(query) then false -> text
def isValidLastChar =
val lastChar = text.charAt(offset - 1)
lastChar.isUnicodeIdentifierPart || lastChar == '.'
if offset > 0 && isValidLastChar && !CompletionProvider.allKeywords.contains(query) then false -> text
else
val isStartMultilineComment =

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,22 @@ class CompilerCachingSuite extends BasePCSuite:
assert(contextPostCursor == contextPostSecond)
checkCompilationCount(4)

@Test
def `dot-compilation-does-not-corrupt-cache`: Unit =
val contextPreCompilation = getContext()

val fakeParams = CompilerOffsetParams(Paths.get("Test.scala").toUri(), "def hello = 1.", 14, EmptyCancelToken)
presentationCompiler.complete(fakeParams).get(timeout.length, timeout.unit)
val contextPostFirst = getContext()
assert(contextPreCompilation != contextPostFirst)
checkCompilationCount(4)

presentationCompiler.complete(fakeParams).get(timeout.length, timeout.unit)
val contextPostSecond = getContext()
assert(contextPreCompilation != contextPostFirst)
assert(contextPostSecond == contextPostFirst)
checkCompilationCount(4)

@Test
def `compilation-for-same-snippet-is-cached`: Unit =
val contextPreCompilation = getContext()
Expand Down