Goldsmith LSP Defaults - WhoIsSethDaniel/goldsmith.nvim GitHub Wiki
When Goldsmith configures your LSP servers it sets many fields that are passed on to lspconfig. Each of these may be overridden by the user. What fields are set and what values are used for each field? The following is a list of each field and a description of the value set for each field.
filetypes
Sets the filetypes that should trigger starting a particular server (or servers). For gopls this field is set to 'go' and 'gomod'. For null-ls this field is set to 'go' for the go-related linters and formatters.
flags
Pass extra flags to lspconfig for the given server. For gopls this field is set to:
{
debounce_text_changes = 500
}
settings
For gopls this is the gopls specific configuration. Goldsmith will set a number of defaults or will add some things to a provided configuration. If there are conflicts between the user configuration and the settings Goldsmith wants to set the user configuration wins. Some of the settings Goldsmith will set are dependent on the version of gopls. The following is what will be set for version 0.7.1:
{
diagnosticsDelay = '500ms',
experimentalPostfixCompletions = true,
experimentalUseInvalidMetadata = true,
gofumpt = true,
staticcheck = true,
usePlaceholders = true,
codelenses = {
gc_details = true,
},
}
root_dir
For gopls this is set to
require('lspconfig.util').root_pattern('go.work', 'go.mod', '.git') or require('lspconfig.util').path.dirname(fname)
capabilities
A default set of capabilities is set using vim.lsp.protocol.make_client_capabilities(). There are a few capabilities that are set by Goldsmith:
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.preselectSupport = true
capabilities.textDocument.completion.completionItem.commitCharactersSupport = true
on_attach
For all servers that Goldsmith supports a default on_attach function will be provided. It will also wrap any given on_attach function. This ensures that the user's on_attach will run while also running the Goldsmith on_attach code.