trait LegacyPatchOps extends PatchOps
- Alphabetic
- By Inheritance
- LegacyPatchOps
- PatchOps
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Deprecated Value Members
-
final
def
addGlobalImport(symbol: Symbol)(implicit index: v0.SemanticdbIndex): v0.Patch
Add an import on symbol among the global imports.
Add an import on symbol among the global imports.
This patch is not reference, unlike removeImportee(Importee). It is only necessary to use this patch once per tree, duplicate symbols are ignored.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
addGlobalImport(importer: Importer): v0.Patch
Add this importer to the global imports at the top of this file.
Add this importer to the global imports at the top of this file.
It is OK to pass in a quasiquote here. The importer has no attached semantic information, so it's not possible to deduplicate Importers.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
addLeft(tree: Tree, toAdd: String): v0.Patch
Add the string toAdd to the first token of tree.
Add the string toAdd to the first token of tree. Does not remove tokens.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
addLeft(tok: scala.meta.Token, toAdd: String): v0.Patch
Add the string toAdd to the left side of token, while keeping token.
Add the string toAdd to the left side of token, while keeping token.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
addRight(tree: Tree, toAdd: String): v0.Patch
Add the string toAdd to the last token of tree.
Add the string toAdd to the last token of tree. Does not remove tokens.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
addRight(tok: scala.meta.Token, toAdd: String): v0.Patch
Add the string toAdd to the right side of token, while keeping token.
Add the string toAdd to the right side of token, while keeping token.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
lint(msg: v0.Diagnostic): v0.Patch
Report a linter message.
Report a linter message.
To construct a LintMessage, start by creating a lint category. Example:
class MyLinter extends Rule { val divisionByZero = scalafix.LintCategory.error("Division by zero!") val divisionTree: scala.meta.Tree = ??? PatchOps.lint(divisionByZero.at(divisionTree.pos)) }
Each LintCategory is assigned a unique identifier, which is formatted as "RuleName.categoryID". The divisionByZero example would have the id "MyLinter.divisionByZero". A LintCategory has a default severity level (warning, error) that the user can override in .scalafix.conf.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
removeGlobalImport(symbol: Symbol)(implicit index: v0.SemanticdbIndex): v0.Patch
Remove importees that resolve to symbol.
Remove importees that resolve to symbol.
Note, this patch is not reference, unlike removeImportee(Importee). It is only necessary to use this patch once per tree, duplicate symbols are ignored.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
removeImportee(importee: Importee): v0.Patch
Remove this particular instance of Importee.
Remove this particular instance of Importee.
Handles tricky cases like trailing commas or curly braces. Example, removeImportee(b) in
import a.{b, c}
producesimport a.c
.Note,
importee
instance is by reference, so removing quasiquotes (example,removeImportee(importee"b")
) does nothing.- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
removeToken(token: scala.meta.Token): v0.Patch
Replace single token with empty string.
Replace single token with empty string.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
removeTokens(tokens: Iterable[scala.meta.Token]): v0.Patch
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
removeTokens(tokens: Tokens): v0.Patch
Replace all tokens with empty string.
Replace all tokens with empty string.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
renameSymbol(fromSymbol: Global, toName: String)(implicit index: v0.SemanticdbIndex): v0.Patch
Replace appearances of names that reference fromSymbol with toName.
Replace appearances of names that reference fromSymbol with toName.
toName should be a legal identifier, it cannot be a tree such as
foo()
. Use this patch for example to rename a methods on a class.- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
replaceSymbol(fromSymbol: Global, toSymbol: Global)(implicit index: v0.SemanticdbIndex): v0.Patch
Replace references/call-sites to fromSymbol with references to toSymbol.
Replace references/call-sites to fromSymbol with references to toSymbol.
toSymbol must be a static method or a globally accessible object. toSymbol should not be path dependent. To rename a class method, use renameSymbol.
Experimental. May produce broken code in some cases. This is the same patch as
replace:com.foo/com.bar
from sbt-scalafix.- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
replaceSymbols(toReplace: Seq[(String, String)])(implicit noop: DummyImplicit, index: v0.SemanticdbIndex): v0.Patch
Helper for calling replaceSymbols without needing _*
Helper for calling replaceSymbols without needing _*
Defers work to replaceSymbols((String, String)*). Needs a dummy implicit to differentiate from replaceSymbols((String, String)*) after type erasure
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
replaceSymbols(toReplace: (String, String)*)(implicit index: v0.SemanticdbIndex): v0.Patch
Shorthand for calling replaceSymbol from strings.
Shorthand for calling replaceSymbol from strings.
String values are treated as Symbol.Global.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
replaceToken(token: scala.meta.Token, toReplace: String): v0.Patch
Replace the entire contents of this Token with toReplace.
Replace the entire contents of this Token with toReplace.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)
-
final
def
replaceTree(from: Tree, to: String): v0.Patch
Replace all tokens of tree contents with toReplace.
Replace all tokens of tree contents with toReplace.
- Definition Classes
- LegacyPatchOps → PatchOps
- Annotations
- @deprecated
- Deprecated
(Since version 0.6.0)