Skip to content

xsbti.FileChanges uses URI #7252

@eed3si9n

Description

@eed3si9n

steps

Unreleased xsbti.FileChanges looks like

/** A collection of TextEdits that belong to a given URI. */
public interface FileChanges {

  /** The URI that the edits belong to. */
  URI uri();

  /** The edits belonging to the URI. */
  List<TextEdit> edits();
}

problem

At the BSP level, SourceItem is tracked as URI.

expectation

We probably should use Optional[String] and Optional[File] like we do currently in Position - https://github.com/sbt/sbt/blob/v1.9.0-RC2/internal/util-interface/src/main/java/xsbti/Position.java#L25-L27:

public interface Position {
....

  Optional<String> sourcePath();

  Optional<File> sourceFile();

notes

Inside the compiler, source files are represented as virtual SourceFiles, and currently we send information from the compiler to Zinc:

using Optional[String] and Optional[File].

At the BSP server level in https://github.com/sbt/sbt/blob/v1.9.0-RC2/main/src/main/scala/sbt/internal/server/BuildServerReporter.scala we already know the association between source files and problems (after the compilation is done), and BSP server also knows how to convert the source file into URI that it told the BSP client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions