Settings
The Fortitude Language Server provides a set of configuration options to customise its behaviour along
with the ability to use an existing fpm.toml or fortitude.toml file to configure the
linter. This is done by providing these settings while initialising the server. VS Code provides a
UI to configure these settings, while other editors may require manual configuration. The
setup section provides instructions on where to place these settings as per the editor.
Top-level
configuration
The configuration setting allows you to configure editor-specific Fortitude behavior. This can be done
in one of the following ways:
- Configuration file path: Specify the path to a
fortitude.tomlorfpm.tomlfile that contains the configuration. User home directory and environment variables will be expanded. - Inline JSON configuration: Directly provide the configuration as a JSON object.
The default behavior, if configuration is unset, is to load the settings from the project's
configuration (a fortitude.toml or fpm.toml in the project's directory), consistent with when
running Fortitude on the command-line.
The configurationPreference setting controls the precedence if both an
editor-provided configuration (configuration) and a project level configuration file are present.
Resolution order
In an editor, Fortitude supports three sources of configuration, prioritised as follows (from highest to lowest):
- Specific settings: Individual settings like
lineLengthorlint.selectdefined in the editor fortitude.configuration: Settings provided via theconfigurationfield (either a path to a configuration file or an inline configuration object)- Configuration file: Settings defined in a
fortitude.tomlorfpm.tomlfile in the project's directory (if present)
For example, if the line length is specified in all three sources, Fortitude will use the value from the
lineLength setting.
Default value: null
Type: string
Example usage:
Using configuration file path:
Using inline configuration:
configurationPreference
The strategy to use when resolving settings across VS Code and the filesystem. By default, editor
configuration is prioritized over fortitude.toml and fpm.toml files.
"editorFirst": Editor settings take priority over configuration files present in the workspace."filesystemFirst": Configuration files present in the workspace takes priority over editor settings."editorOnly": Ignore configuration files entirely i.e., only use editor settings.
Default value: "editorFirst"
Type: "editorFirst" | "filesystemFirst" | "editorOnly"
Example usage:
exclude
A list of file patterns to exclude from linting. See the documentation for more details.
Default value: null
Type: string[]
Example usage:
lineLength
The line length to use for the linter.
Default value: null
Type: int
Example usage:
fixAll
Whether to register the server as capable of handling source.fixAll code actions.
Default value: true
Type: bool
Example usage:
logLevel
The log level to use for the server.
Default value: "info"
Type: "trace" | "debug" | "info" | "warn" | "error"
Example usage:
logFile
Path to the log file to use for the server.
If not set, logs will be written to stderr.
Default value: null
Type: string
Example usage:
codeAction
Enable or disable code actions provided by the server.
fixViolation.enable
Whether to display Quick Fix actions to autofix violations.
Default value: true
Type: bool
Example usage:
check
Settings specific to the Fortitude linter.
preview
Whether to enable Fortitude's preview mode when linting.
Default value: null
Type: bool
Example usage:
select
Rules to enable by default. See the documentation.
Default value: null
Type: string[]
Example usage:
extendSelect
Rules to enable in addition to those in check.select.
Default value: null
Type: string[]
Example usage:
ignore
Rules to disable by default. See the documentation.
Default value: null
Type: string[]
Example usage:
VS Code specific
Additionally, the Fortitude extension provides the following settings specific to VS Code. These settings are not used by the language server and are only relevant to the extension.
enable
Whether to enable the Fortitude extension. Modifying this setting requires restarting VS Code to take effect.
Default value: true
Type: bool
Example usage:
importStrategy
Strategy for loading the fortitude executable.
fromEnvironmentfinds Fortitude in the environment, falling back to the bundled versionuseBundleduses the version bundled with the extension
Default value: "fromEnvironment"
Type: "fromEnvironment" | "useBundled"
Example usage:
interpreter
A list of paths to Python interpreters. Even though this is a list, only the first interpreter is used.
The interpreter is used to find the fortitude executable when
fortitude.importStrategy is set to fromEnvironment.
Default value: []
Type: string[]
Example usage:
path
A list of path to fortitude executables.
The first executable in the list which is exists is used. This setting takes precedence over the
fortitude.importStrategy setting.
Default value: []
Type: string[]
Example usage:
trace.server
The trace level for the language server. Refer to the LSP specification for more information.
Default value: "off"
Type: "off" | "messages" | "verbose"
Example usage: