c

scalafix.internal.rewrite

RewriteCtxImpl

case class RewriteCtxImpl(tree: Tree, config: config.ScalafixConfig) extends rewrite.RewriteCtx with Product with Serializable

Self Type
RewriteCtxImpl
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. RewriteCtxImpl
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. RewriteCtx
  7. PatchOps
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new RewriteCtxImpl(tree: Tree, config: config.ScalafixConfig)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addGlobalImport(symbol: scala.meta.Symbol)(implicit sctx: util.SemanticCtx): 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
    RewriteCtxImplPatchOps
  5. def addGlobalImport(importer: Importer): 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
    RewriteCtxImplPatchOps
  6. def addLeft(tree: Tree, toAdd: String): 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
    RewriteCtxImplPatchOps
  7. def addLeft(tok: scala.meta.Token, toAdd: String): 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
    RewriteCtxImplPatchOps
  8. def addRight(tree: Tree, toAdd: String): 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
    RewriteCtxImplPatchOps
  9. def addRight(tok: scala.meta.Token, toAdd: String): 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
    RewriteCtxImplPatchOps
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. lazy val comments: AssociatedComments

    Find comments/docstrings associated with tree nodes.

    Find comments/docstrings associated with tree nodes. *

    Definition Classes
    RewriteCtxImplRewriteCtx
  13. val config: config.ScalafixConfig
    Definition Classes
    RewriteCtxImplRewriteCtx
  14. def debug(values: Text[Any]*)(implicit fileLine: FileLine): Unit
  15. def debugSemanticCtx()(implicit sctx: util.SemanticCtx, fileLine: FileLine): Unit

    Print out the contents of SemanticCtx for this input only.

    Print out the contents of SemanticCtx for this input only. *

    Definition Classes
    RewriteCtxImplRewriteCtx
  16. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  19. lazy val input: scala.meta.Input

    The input where the tree was parsed from.

    The input where the tree was parsed from.

    This is typically either Input.VirtualFile for semantic rewrites and Input.File for syntactic rewrites. For Input.VirtualFile, it is possible to trace back to the original file path via SemanticCtx.sourcepath.

    Definition Classes
    RewriteCtxImplRewriteCtx
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. def lint(msg: LintMessage): Patch

    Report a linter message.

    Report a linter message.

    To construct a LintMessage, start by creating a lint category. Example:

    class MyLinter extends Rewrite {
      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 "RewriteName.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
    RewriteCtxImplPatchOps
  22. lazy val matchingParens: MatchingParens

    Find matching open/close pairs of parens/braces/brackets.

    Find matching open/close pairs of parens/braces/brackets. *

    Definition Classes
    RewriteCtxImplRewriteCtx
  23. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  24. final def notify(): Unit
    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  26. def printLintMessage(msg: LintMessage, owner: RewriteName): Unit
    Definition Classes
    RewriteCtxImplRewriteCtx
  27. def removeGlobalImport(symbol: scala.meta.Symbol)(implicit sctx: util.SemanticCtx): 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
    RewriteCtxImplPatchOps
  28. def removeImportee(importee: Importee): 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} produces import a.c.

    Note, importee instance is by reference, so removing quasiquotes (example, removeImportee(importee"b")) does nothing.

    Definition Classes
    RewriteCtxImplPatchOps
  29. def removeToken(token: scala.meta.Token): Patch

    Replace single token with empty string.

    Replace single token with empty string.

    Definition Classes
    RewriteCtxImplPatchOps
  30. def removeTokens(tokens: Tokens): Patch

    Replace all tokens with empty string.

    Replace all tokens with empty string.

    Definition Classes
    RewriteCtxImplPatchOps
  31. def renameSymbol(fromSymbol: Global, toName: String)(implicit sctx: util.SemanticCtx): 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
    RewriteCtxImplPatchOps
  32. def replaceSymbol(fromSymbol: Global, toSymbol: Global)(implicit sctx: util.SemanticCtx): 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
    RewriteCtxImplPatchOps
  33. def replaceSymbols(toReplace: (String, String)*)(implicit sctx: util.SemanticCtx): Patch

    Shorthand for calling replaceSymbol from strings.

    Shorthand for calling replaceSymbol from strings.

    String values are treated as Symbol.Global.

    Definition Classes
    RewriteCtxImplPatchOps
  34. def replaceToken(token: scala.meta.Token, toReplace: String): Patch

    Replace the entire contents of this Token with toReplace.

    Replace the entire contents of this Token with toReplace.

    Definition Classes
    RewriteCtxImplPatchOps
  35. def replaceTree(from: Tree, to: String): Patch

    Replace all tokens of tree contents with toReplace.

    Replace all tokens of tree contents with toReplace.

    Definition Classes
    RewriteCtxImplPatchOps
  36. def sctx(implicit sctx: util.SemanticCtx): util.SemanticCtx

    Get SemanticCtx for this single tree alone.

    Get SemanticCtx for this single tree alone.

    Definition Classes
    RewriteCtxImplRewriteCtx
  37. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  38. def syntax: String
  39. def toString(): String
    Definition Classes
    RewriteCtxImpl → AnyRef → Any
  40. lazy val tokenList: TokenList

    Traverse tokens as a doubly linked list.

    Traverse tokens as a doubly linked list. *

    Definition Classes
    RewriteCtxImplRewriteCtx
  41. lazy val tokens: Tokens

    The tokenized tokens of this this tree.

    The tokenized tokens of this this tree. *

    Definition Classes
    RewriteCtxImplRewriteCtx
  42. def toks(t: Tree): Tokens
    Definition Classes
    RewriteCtxImplRewriteCtx
  43. val tree: Tree
    Definition Classes
    RewriteCtxImplRewriteCtx
  44. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def matching: MatchingParens
    Definition Classes
    RewriteCtx
    Annotations
    @deprecated
    Deprecated

    (Since version 0.5.0) Renamed to matchingParens

  2. def rename(name: Name, toReplace: String): patch.Patch
    Definition Classes
    PatchOps
    Annotations
    @deprecated
    Deprecated

    (Since version 0.5.0) Use replaceTree instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from rewrite.RewriteCtx

Inherited from PatchOps

Inherited from AnyRef

Inherited from Any

Ungrouped