Skip to content

Daemon methods

The Biome daemon uses JSON-RPC, a lightweight RPC (remote procedure call) protocol that can be leveraged by third-party clients, such as editor extensions.

Clients send requests with the following JSON payload, where method is one of the methods listed on this page. Below is an example of a biome/open_project request:

{
"jsonrpc": "2.0",
"id": 1,
"method": "biome/open_project",
"params": {
"path": "/Some/path",
"openUninitialized": false
}
}

Accepts SupportsFeatureParams.

interface SupportsFeatureParams {
features: FeatureName;
inlineConfig?: Configuration;
/**
* Features that shouldn't be enabled
*/
notRequestedFeatures?: FeatureName;
path: string;
projectKey: number;
skipIgnoreCheck?: boolean;
}

Returns FileFeaturesResult.

interface FileFeaturesResult {
featuresSupported: FeaturesSupported;
}

Accepts UpdateSettingsParams.

interface UpdateSettingsParams {
configuration: Configuration;
extendedConfigurations?: unknown[][];
moduleGraphResolutionKind?: string;
projectKey: number;
workspaceDirectory?: string;
}

Returns UpdateSettingsResult.

interface UpdateSettingsResult {
diagnostics: Diagnostic[];
}

Accepts OpenProjectParams.

interface OpenProjectParams {
/**
* Whether the folder should be opened as a project, even if no `biome.json` can be found.
*/
openUninitialized: boolean;
/**
* The path to open
*/
path: string;
}

Returns OpenProjectResult.

interface OpenProjectResult {
/**
* A unique identifier for this project
*/
projectKey: number;
}

Accepts ScanProjectParams.

interface ScanProjectParams {
/**
* Forces scanning of the folder, even if it is already being watched.
*/
force: boolean;
projectKey: number;
scanKind: ScanKind;
verbose?: boolean;
/**
* Whether the watcher should watch this path. Does nothing if the watcher is already watching this path.
*/
watch: boolean;
}

Returns ScanProjectResult.

interface ScanProjectResult {
/**
* A list of child configuration files found inside the project
*/
configurationFiles: string[];
/**
* Diagnostics reported while scanning the project.
*/
diagnostics: Diagnostic[];
/**
* Duration of the scan.
*/
duration: Duration;
}

Accepts OpenFileParams.

interface OpenFileParams {
content: FileContent;
documentFileSource?: DocumentFileSource;
inlineConfig?: Configuration;
path: string;
/**
* Set to `true` to persist the node cache used during parsing, in order to speed up subsequent reparsing if the document has been edited. This should only be enabled if reparsing is to be expected, such as when the file is opened through the LSP Proxy.
*/
persistNodeCache?: boolean;
projectKey: number;
}

Returns OpenFileResult.

interface OpenFileResult {
diagnostics: Diagnostic[];
}

Accepts ChangeFileParams.

interface ChangeFileParams {
content: string;
inlineConfig?: Configuration;
path: string;
projectKey: number;
version: number;
}

Returns ChangeFileResult.

interface ChangeFileResult {
diagnostics: Diagnostic[];
}

Accepts CloseFileParams.

interface CloseFileParams {
path: string;
projectKey: number;
}

Returns void.

Accepts FileExitsParams.

interface FileExitsParams {
filePath: string;
}

Returns boolean.

Accepts PathIsIgnoredParams.

interface PathIsIgnoredParams {
/**
* Whether the path is ignored for specific features e.g. `formatter.includes`. When this field is empty, Biome checks only `files.includes`.
*/
features: FeatureName;
/**
* Controls how to ignore check should be done
*/
ignoreKind?: IgnoreKind;
/**
* Whether the path is a directory. Used to skip stat calls when the caller already knows the file type from the filesystem traversal.
*/
isDir?: boolean;
/**
* The path to inspect
*/
path: string;
projectKey: number;
}

Returns boolean.

Accepts UpdateModuleGraphParams.

interface UpdateModuleGraphParams {
path: string;
projectKey: number;
/**
* The kind of update to apply to the module graph
*/
updateKind: string;
}

Returns void.

Accepts GetSyntaxTreeParams.

interface GetSyntaxTreeParams {
path: string;
projectKey: number;
}

Returns GetSyntaxTreeResult.

interface GetSyntaxTreeResult {
ast: string;
cst: string;
}

Accepts CheckFileSizeParams.

interface CheckFileSizeParams {
path: string;
projectKey: number;
}

Returns CheckFileSizeResult.

interface CheckFileSizeResult {
fileSize: number;
limit: number;
}

Accepts GetFileContentParams.

interface GetFileContentParams {
path: string;
projectKey: number;
}

Returns string.

Accepts GetControlFlowGraphParams.

interface GetControlFlowGraphParams {
cursor: number;
path: string;
projectKey: number;
}

Returns string.

Accepts GetFormatterIRParams.

interface GetFormatterIRParams {
path: string;
projectKey: number;
}

Returns string.

Accepts GetTypeInfoParams.

interface GetTypeInfoParams {
path: string;
projectKey: number;
}

Returns string.

Accepts GetRegisteredTypesParams.

interface GetRegisteredTypesParams {
path: string;
projectKey: number;
}

Returns string.

Accepts GetSemanticModelParams.

interface GetSemanticModelParams {
path: string;
projectKey: number;
}

Returns string.

Accepts GetModuleGraphParams.

interface GetModuleGraphParams {}

Returns GetModuleGraphResult.

interface GetModuleGraphResult {
data: object;
}

Accepts PullDiagnosticsParams.

interface PullDiagnosticsParams {
categories: RuleCategories;
/**
* Minimum severity for a diagnostic to be included. Diagnostics with a severity below this threshold are ignored entirely (not counted, not serialized). Defaults to [`Severity::Hint`] (include everything).
*/
diagnosticLevel?: Severity;
/**
* Rules to apply on top of the configuration
*/
enabledRules?: string[];
/**
* When true, promote assist diagnostics (`assist/*`) to error severity before applying the diagnostic_level filter.
*/
enforceAssist?: boolean;
/**
* When `true`, diagnostics include code suggestions for rule fixes.
*/
includeCodeFix?: boolean;
inlineConfig?: Configuration;
/**
* Max limit of diagnostics types to pull. This limit is meant to cap the number of [Diagnostic] to pull. However, the workspace still processes ALL diagnostics coming from the analyzer to compute their severity. If no value is provided, the workspace will pull all diagnostics.
*/
maxDiagnostics?: unknown;
only?: string[];
path: string;
projectKey: number;
skip?: string[];
}

Returns PullDiagnosticsResult.

interface PullDiagnosticsResult {
diagnostics: Diagnostic[];
errors: number;
infos: number;
/**
* Number of parse errors (subset of `errors`). Used by `--skip-parse-errors` to distinguish parse errors from analyzer errors.
*/
parseErrors: number;
skippedDiagnostics: number;
warnings: number;
}

Accepts PullActionsParams.

interface PullActionsParams {
categories?: RuleCategories;
/**
* When `false`, returned actions have `suggestion: None` (no `BatchMutation` computed). Used by `codeAction/resolve` to defer edit computation.
*/
computeActions?: boolean;
enabledRules?: string[];
inlineConfig?: Configuration;
only?: string[];
path: string;
projectKey: number;
range?: TextRange;
skip?: string[];
suppressionReason?: unknown;
}

Returns PullActionsResult.

interface PullActionsResult {
actions: CodeAction[];
}

Accepts PullDiagnosticsAndActionsParams.

interface PullDiagnosticsAndActionsParams {
categories?: RuleCategories;
enabledRules?: string[];
inlineConfig?: Configuration;
only?: string[];
path: string;
projectKey: number;
skip?: string[];
}

Returns PullDiagnosticsAndActionsResult.

interface PullDiagnosticsAndActionsResult {
diagnostics: unknown[][];
}

Accepts FormatFileParams.

interface FormatFileParams {
inlineConfig?: Configuration;
path: string;
projectKey: number;
}

Returns Printed.

interface Printed {
code: string;
range?: TextRange;
sourcemap: SourceMarker[];
verbatimRanges: TextRange[];
}

Accepts FormatRangeParams.

interface FormatRangeParams {
inlineConfig?: Configuration;
path: string;
projectKey: number;
range: TextRange;
}

Returns Printed.

interface Printed {
code: string;
range?: TextRange;
sourcemap: SourceMarker[];
verbatimRanges: TextRange[];
}

Accepts FormatOnTypeParams.

interface FormatOnTypeParams {
inlineConfig?: Configuration;
offset: number;
path: string;
projectKey: number;
}

Returns Printed.

interface Printed {
code: string;
range?: TextRange;
sourcemap: SourceMarker[];
verbatimRanges: TextRange[];
}

Accepts FixFileParams.

interface FixFileParams {
/**
* Rules to apply to the file
*/
enabledRules?: string[];
fixFileMode: FixFileMode;
inlineConfig?: Configuration;
only?: string[];
path: string;
projectKey: number;
ruleCategories: RuleCategories;
shouldFormat: boolean;
skip?: string[];
suppressionReason?: unknown;
}

Returns FixFileResult.

interface FixFileResult {
/**
* List of all the code actions applied to the file
*/
actions: FixAction[];
/**
* New source code for the file with all fixes applied
*/
code: string;
/**
* Number of errors
*/
errors: number;
/**
* number of skipped suggested fixes
*/
skippedSuggestedFixes: number;
}

Accepts RenameParams.

interface RenameParams {
newName: string;
path: string;
projectKey: number;
symbolAt: number;
}

Returns RenameResult.

interface RenameResult {
/**
* List of text edit operations to apply on the source code
*/
indels: TextEdit;
/**
* Range of source code modified by this rename operation
*/
range: TextRange;
}

Accepts ParsePatternParams.

interface ParsePatternParams {
defaultLanguage: GritTargetLanguage;
pattern: string;
}

Returns ParsePatternResult.

interface ParsePatternResult {
patternId: string;
}

Accepts SearchPatternParams.

interface SearchPatternParams {
path: string;
pattern: string;
projectKey: number;
}

Returns SearchResults.

interface SearchResults {
matches: TextRange[];
path: string;
}

Accepts DropPatternParams.

interface DropPatternParams {
pattern: string;
}

Returns void.