public interface Scalafmt
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear internal caches such as classloaded Scalafmt instances.
|
static Scalafmt |
create(java.lang.ClassLoader loader)
Classload a new instance of this Scalafmt instance.
|
ScalafmtSession |
createSession(java.nio.file.Path config)
Create a ScalafmtSession to format a batch of files using fixed configuration.
|
java.lang.String |
format(java.nio.file.Path config,
java.nio.file.Path file,
java.lang.String code)
Format a single file with the given .scalafmt.conf configuration.
|
Scalafmt |
withDefaultVersion(java.lang.String defaultVersion)
Deprecated.
|
Scalafmt |
withMavenRepositories(java.lang.String... repositories)
Builder method.
|
Scalafmt |
withReporter(ScalafmtReporter reporter)
Builder method.
|
Scalafmt |
withRespectProjectFilters(boolean respectExcludeFilters)
Builder method.
|
Scalafmt |
withRespectVersion(boolean respectVersion)
Deprecated.
|
java.lang.String format(java.nio.file.Path config,
java.nio.file.Path file,
java.lang.String code)
config - the absolute path to the configuration file. This file must exist or
an exception will be thrown.file - relative or absolute path to the file being formatted. Used only for the path
name, the file does not have to exist on disk.code - the text contents to format.Scalafmt withRespectProjectFilters(boolean respectExcludeFilters)
respectExcludeFilters - If true (default), returns the original file contents when
formatting a file that does not matches the project settings
in .scalafmt.conf. If false, formats every file that is passed
to the format(Path, Path, String) method regardless
of .scalafmt.conf settings.@Deprecated Scalafmt withRespectVersion(boolean respectVersion)
respectVersion - If true (default), refuses to format files when the 'version' setting
is missing in .scalafmt.conf and users must update .scalafmt.conf to
format files. If false, falls back to the default version provided
via withDefaultVersion(String).@Deprecated Scalafmt withDefaultVersion(java.lang.String defaultVersion)
defaultVersion - the fallback Scalafmt version to use when there is no 'version'
setting in `.scalafmt.conf`; N.B. ignored when
withRespectVersion(boolean) is trueScalafmt withReporter(ScalafmtReporter reporter)
reporter - Use this instance to report errors and information messagesScalafmt withMavenRepositories(java.lang.String... repositories)
repositories - maven repositories to use when resolvingvoid clear()
static Scalafmt create(java.lang.ClassLoader loader)
loader - the classloader containing the 'scalafmt-dynamic' module.java.util.NoSuchElementException - if the classloader does not have the 'scalafmt-dynamic' module.ScalafmtSession createSession(java.nio.file.Path config)
config - location of the configuration file