-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: add multiline comment completion (#18703)
metals backport: scalameta/metals#5739 CC: @tgodzik
- Loading branch information
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
presentation-compiler/src/main/dotty/tools/pc/completions/MultilineCommentCompletion.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package dotty.tools.pc.completions | ||
|
||
import scala.meta.pc.PresentationCompilerConfig | ||
|
||
import dotty.tools.dotc.util.SourcePosition | ||
|
||
object MultilineCommentCompletion: | ||
|
||
def contribute(config: PresentationCompilerConfig): List[CompletionValue] = | ||
val newText = if config.isCompletionSnippetsEnabled then " $0 */" else " */" | ||
List(CompletionValue.document("/* */", newText, "Multiline Comment")) | ||
|
||
def isMultilineCommentCompletion(pos: SourcePosition, text: String): Boolean = | ||
pos.point >= 2 && | ||
text.charAt(pos.point - 2) == '/' && | ||
text.charAt(pos.point - 1) == '*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters