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
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# outline-parser - Changelog

## 2.0.0-beta.1

### General

- **(BREAKING)** Renamed Scala packages from `com.financialforce.*` to `io.github.apexdevtools.*` to align with the Maven group ID `io.github.apex-dev-tools`.
- `com.financialforce.oparser` → `io.github.apexdevtools.oparser`
- `com.financialforce.types` → `io.github.apexdevtools.types`
- `com.financialforce.types.base` → `io.github.apexdevtools.types.base`
- Consumers must update all imports.

- **(BREAKING)** Merged the `apex-types` library into this artifact. The previously separate `apex-types` dependency is no longer required and should be removed from consuming projects.
- All type interfaces (`io.github.apexdevtools.types.*`), base types (`Modifier`, `Annotation`, `Location`), the `io.github.apexdevtools.api.*` Issue API, and the `io.github.apexdevtools.spi.AnalysisProvider` SPI are now provided directly by `outline-parser`.

- **(BREAKING)** `Location` semantics changed to match ANTLR conventions:
- `lineOffset` is now 0-based (previously 1-based).
- End positions are now exclusive — locations represent the half-open interval `[start, end)` for both columns and byte offsets.

- **(BREAKING)** Removed `intern()` methods and static caches on `Annotation` and `Modifier` companion objects (and corresponding `intern()` calls in `Types.scala` factory methods). The caches ignored the `location` field when comparing equality, returning cached instances with wrong locations under parallel use. Consumers relying on `intern()` should construct instances directly.

- Added optional `location` field to `Modifier` and `Annotation`, populated during parsing:
- Compound modifiers (e.g. `with sharing`) get a spanned location covering both tokens.
- Annotations get a span from `@` through any parameter list.

- Fixed multi-line string tokenization (Salesforce Summer '26 `'''…'''` literals) to correctly handle multi-byte characters and avoid mis-tokenizing trailing content.

### Build & dependencies

- Removed the `apex-ls` test dependency. The JVM comparison test suite now uses `apex-parser` (5.x) directly via `ApexParserFactory`, eliminating the outline-parser ↔ apex-ls cycle. JS-side sample comparison is dropped; the JS test suite is reduced to `SmokeTest`.
- Upgraded Scala.js to `1.18.2`.
- Updated sbt and plugin dependencies to latest stable versions.

### JS / NPM

- Bumped peer `@apexdevtools/apex-parser` to `^5.0.0` (was `^4.3.1`).
- Raised minimum Node version to `^20.19.0 || ^22.13.0 || >=24` (was `>=14.0.0`), matching the requirements of `apex-parser 5.x`.
- Moved `@apexdevtools/apex-parser` to `devDependencies`.

## 1.3.0

Last release of the pre-merge line. See git history for prior changes; this changelog begins with the 2.0.0 line.
7 changes: 5 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ lazy val parser = crossProject(JSPlatform, JVMPlatform)
name := "outline-parser",
scalacOptions += "-deprecation",
libraryDependencies ++= Seq(
"org.scalatest" %%% "scalatest" % "3.2.9" % Test,
"io.github.apex-dev-tools" %%% "apex-ls" % "6.0.2" % Test
"org.scalatest" %%% "scalatest" % "3.2.9" % Test
)
)
.jvmSettings(
build := buildJVM.value,
Test / fork := true,
libraryDependencies ++= Seq(
"io.github.apex-dev-tools" % "apex-parser" % "5.0.0" % Test,
"org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4" % Test
),
packageOptions += Package.ManifestAttributes(
"Class-Path" -> (Compile / dependencyClasspath).value.files.map(_.getName.trim).mkString(" "),
"Implementation-Build" -> java.time.Instant.now().toEpochMilli.toString
Expand Down
133 changes: 26 additions & 107 deletions js/npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@apexdevtools/outline-parser",
"devDependencies": {
"@apexdevtools/apex-parser": "^4.3.1"
"@apexdevtools/apex-parser": "^5.0.0"
},
"engines": {
"node": ">=14.0.0"
"node": "^20.19.0 || ^22.13.0 || >=24"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ package io.github.apexdevtools.oparser.cmds

import io.github.apexdevtools.oparser._
import io.github.apexdevtools.oparser.testutil.{AntlrParser, ClassScanner}
import com.nawforce.pkgforce.path.PathLike
import com.nawforce.runtime.platform.Path

import java.nio.file.{Files, Path, Paths}
import java.util.concurrent.atomic.AtomicLong
import scala.collection.parallel.CollectionConverters.ImmutableIterableIsParallelizable

// Command for comparing outputs with apex-parser on one or many files
// NOTE: This needs to live in 'test' due to apex-ls dependency
object ApexParserCompare {
def main(args: Array[String]): Unit = {
System.exit(ApexParserCompare.run(args))
Expand Down Expand Up @@ -46,7 +44,7 @@ object ApexParserCompare {
}

private def parseSeq(display: Boolean, test: Boolean, onlyANTLR: Boolean, inPath: String): Int = {
val absolutePath = Path(inPath)
val absolutePath = Paths.get(inPath).toAbsolutePath
println("SEQUENTIAL " + absolutePath.toString)

val start = System.currentTimeMillis()
Expand All @@ -71,11 +69,11 @@ object ApexParserCompare {
}

private def parsePar(display: Boolean, test: Boolean, onlyANTLR: Boolean, inPath: String): Int = {
val absolutePath = Path(inPath)
val absolutePath = Paths.get(inPath).toAbsolutePath
println("PARALLEL " + absolutePath.toString)

val start = System.currentTimeMillis()
val files = ClassScanner.scan(absolutePath)
val files = ClassScanner.scan(absolutePath).toVector
val timeForFiles = System.currentTimeMillis() - start

val all = files.par.map(p => parseFileWithStatus(display, test, onlyANTLR, p))
Expand Down Expand Up @@ -127,7 +125,7 @@ object ApexParserCompare {
display: Boolean,
test: Boolean,
onlyANTLR: Boolean,
file: PathLike
file: Path
): Int = {
try {
parseFile(display, test, onlyANTLR, file)
Expand All @@ -140,14 +138,9 @@ object ApexParserCompare {
}
}

private def parseFile(
display: Boolean,
test: Boolean,
onlyANTLR: Boolean,
file: PathLike
): Unit = {
private def parseFile(display: Boolean, test: Boolean, onlyANTLR: Boolean, file: Path): Unit = {
var start = System.currentTimeMillis()
val contentsBytes = file.readBytes().getOrElse(Array())
val contentsBytes = Files.readAllBytes(file)
addReadFileTime(System.currentTimeMillis() - start)
start = System.currentTimeMillis()
val contentsString: String = new String(contentsBytes, "utf8")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@
package io.github.apexdevtools.oparser.testutil

import io.github.apexdevtools.types.base.Location
import com.nawforce.pkgforce.path.PathLike
import com.nawforce.runtime.parsers.CodeParser.ParserRuleContext
import com.nawforce.runtime.platform.Path
import org.antlr.v4.runtime.ParserRuleContext

import java.nio.file.{Path, Paths}

/* Additional ANTLR helpers for things not supported by apex-ls */
object AntlrOps {
type AntlrCollection[T] = java.util.List[T]

def samplesDir(): Option[PathLike] = {
def samplesDir(): Option[Path] = {
try {
Option(System.getenv("SAMPLES"))
.filter(_.nonEmpty)
.map(Path(_))
.map(Paths.get(_))
} catch {
case _: Throwable => None
}
Expand All @@ -31,10 +30,10 @@ object AntlrOps {
Location(
context.start.getLine,
context.start.getCharPositionInLine,
0, // byte offset not calculated
0, // byte offset not calculated
context.stop.getLine,
context.stop.getCharPositionInLine + context.stop.getText.length,
0 // byte offset not calculated
0 // byte offset not calculated
)
}
}
Expand Down
Loading
Loading