Package org.scalafmt.interfaces
Interface ScalafmtSession
-
public interface ScalafmtSessionA session based on a fixed configuration.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Stringformat(java.nio.file.Path file, java.lang.String code)Format a single file with the given configuration.ScalafmtResultformatOrError(java.nio.file.Path file, java.lang.String code)Format a single file with the given configuration.booleanisGitOnly()Whether this configuration intends to limit files to those managed by git.booleanmatchesProjectFilters(java.nio.file.Path file)Whether the path matches the 'project.{excludeFilters,includeFilters}' setting.
-
-
-
Method Detail
-
format
java.lang.String format(java.nio.file.Path file, java.lang.String code)Format a single file with the given configuration.- Parameters:
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.- Returns:
- the formatted contents if formatting was successful, otherwise the original text contents.
-
formatOrError
ScalafmtResult formatOrError(java.nio.file.Path file, java.lang.String code)
Format a single file with the given configuration.- Parameters:
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.- Returns:
- the formatted contents if formatting was successful, otherwise an error.
-
matchesProjectFilters
boolean matchesProjectFilters(java.nio.file.Path file)
Whether the path matches the 'project.{excludeFilters,includeFilters}' setting.- Parameters:
file- path to match- Returns:
- true if the path matched the filters
-
isGitOnly
boolean isGitOnly()
Whether this configuration intends to limit files to those managed by git.
-
-