-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1737 from LaurenceWarne/add-edit-to-api
Add textEdits method to ScalafixPatch
- Loading branch information
Showing
6 changed files
with
106 additions
and
3 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
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
9 changes: 9 additions & 0 deletions
9
scalafix-cli/src/main/scala/scalafix/internal/interfaces/ScalafixTextEditImpl.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,9 @@ | ||
package scalafix.internal.interfaces | ||
|
||
import scalafix.interfaces.ScalafixPosition | ||
import scalafix.interfaces.ScalafixTextEdit | ||
|
||
final case class ScalafixTextEditImpl( | ||
position: ScalafixPosition, | ||
newText: String | ||
) extends ScalafixTextEdit |
10 changes: 9 additions & 1 deletion
10
scalafix-interfaces/src/main/java/scalafix/interfaces/ScalafixPatch.java
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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
package scalafix.interfaces; | ||
|
||
public interface ScalafixPatch {} | ||
public interface ScalafixPatch { | ||
/** | ||
* | ||
* @return This patch as an array of text edits. | ||
*/ | ||
default ScalafixTextEdit[] textEdits() { | ||
throw new UnsupportedOperationException("textEdits() is not implemented"); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
scalafix-interfaces/src/main/java/scalafix/interfaces/ScalafixTextEdit.java
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,7 @@ | ||
package scalafix.interfaces; | ||
|
||
public interface ScalafixTextEdit { | ||
ScalafixPosition position(); | ||
|
||
String newText(); | ||
} |
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