Skip to content

Commit

Permalink
chore: Update Scalameta to 4.8.11
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Oct 3, 2023
1 parent 785d3f7 commit 1c140f6
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ trait Completions { this: MetalsGlobal =>
def inferStart(
pos: Position,
text: String,
charPred: Char => Boolean
charPred: Int => Boolean
): Int = {
def fallback: Int = {
var i = pos.point - 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import scala.meta.internal.tokenizers.Chars._
*/
object ScaladocUtils {

/** Is character a whitespace character (but not a new line)? */
def isWhitespace(c: Char) =
c == ' ' || c == '\t' || c == CR

/**
* Returns index of string `str` following `start` skipping longest
* sequence of whitespace characters characters (but no newlines)
Expand Down Expand Up @@ -194,6 +198,10 @@ object ScaladocUtils {
else
str

/** Can character form part of a doc comment variable xxx? */
def isVarPart(c: Char) =
'0' <= c && c <= '9' || 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z'

/**
* Returns index following variable, or start index if no variable was recognized
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ class JavaToplevelMtags(val input: Input.VirtualFile) extends MtagsIndexer {
val ch = reader.ch
if (ch != SU && Character.isJavaIdentifierPart(ch)) {
reader.nextChar()
kwOrIdent(start, builder.append(ch))
kwOrIdent(start, builder.append(ch.toChar))
} else if (builder.isEmpty) {
throw new Exception(
s"Unexpected symbol at word pos: '$ch'. Line: '$readCurrentLine'"
)
} else {
val pos = Position.Range(input, start, reader.charOffset)

val pos = Position.Range(input, start, reader.endCharOffset)
builder.mkString match {
case "package" => Token.Package
case "class" => Token.Class
Expand Down Expand Up @@ -133,13 +134,13 @@ class JavaToplevelMtags(val input: Input.VirtualFile) extends MtagsIndexer {
parseToken
case _ =>
val token = kwOrIdent(
reader.charOffset - 1,
new StringBuilder().append(first).append(next)
reader.begCharOffset,
new StringBuilder().append(first.toChar).append(next.toChar)
)
(token, true)
}
case _ =>
val token = kwOrIdent(reader.charOffset, new StringBuilder(first))
val token = kwOrIdent(reader.endCharOffset, new StringBuilder(first))
(token, true)
}
}
Expand Down Expand Up @@ -205,15 +206,15 @@ class JavaToplevelMtags(val input: Input.VirtualFile) extends MtagsIndexer {

@tailrec
private def toNextNonWhiteSpace(): Unit = {
if (isWhitespace(reader.ch)) {
if (isWhitespace(reader.ch.toChar)) {
reader.nextChar()
toNextNonWhiteSpace()
}
}

private def readCurrentLine: String = {
def loop(builder: StringBuilder): String = {
val ch = reader.ch
val ch = reader.ch.toChar
if (ch == '\n' || ch == SU)
builder.mkString
else {
Expand All @@ -224,7 +225,7 @@ class JavaToplevelMtags(val input: Input.VirtualFile) extends MtagsIndexer {
}

val lineOffset = reader.lineStartOffset
val existing = input.text.substring(lineOffset, reader.charOffset)
val existing = input.text.substring(lineOffset, reader.endCharOffset)
loop(new StringBuilder().append(existing))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,6 @@ class ScalaToplevelMtags(
case WHITESPACE =>
nextIsNL()
case COMMENT =>
scanner.skipComment()
nextIsNL()
case _ => false
}
Expand Down
2 changes: 1 addition & 1 deletion project/V.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ object V {
val scalaCli = "1.0.4"
val scalafix = "0.11.1"
val scalafmt = "3.7.14"
val scalameta = "4.8.10"
val scalameta = "4.8.11"
val scribe = "3.12.2"
val qdox = "2.0.3"

Expand Down

0 comments on commit 1c140f6

Please sign in to comment.