snippet_support = false
verbosity = 2

[server]
# exit session if no requests were received during given period in seconds
# works only in unix sockets mode (-s/--session)
# set to 0 to disable
timeout = 1800 # seconds = 30 minutes

[language_server.angular]
filetypes = ["angular"]
roots = [".angular", ".git"]
command = "node"
args = [
    "/home/lelgenio/.config/yarn/global/node_modules/@angular/language-server",
    "--ngProbeLocations",
    "/home/lelgenio/.config/yarn/global/node_modules",
    "--tsProbeLocations",
    "/home/lelgenio/.config/yarn/global/node_modules",
    "--stdio",
]

[language_server.bash-language-server]
filetypes = ["sh"]
roots = [".git", ".hg"]
command = "bash-language-server"
args = ["start"]

[language_server.clangd]
filetypes = ["c", "cpp"]
roots = ["compile_commands.json", ".clangd", ".git", ".hg"]
command = "clangd"

[language_server.css-language-server]
filetypes = ["css"]
roots = ["package.json", ".git", ".hg"]
command = "vscode-css-languageserver"
args = ["--stdio"]

[language_server.less-language-server]
filetypes = ["less"]
roots = ["package.json", ".git", ".hg"]
command = "vscode-css-languageserver"
args = ["--stdio"]

[language_server.html-language-server]
filetypes = ["html"]
roots = ["package.json"]
command = "vscode-html-languageserver"
args = ["--stdio"]
settings_section = "_"
[language_server.html-language-server.settings._]
# quotePreference = "single"
# javascript.format.semicolons = "insert"

[language_server.typescript-language-server]
filetypes = ["javascript", "typescript"]
roots = ["package.json", "tsconfig.json", "jsconfig.json", ".git", ".hg"]
command = "typescript-language-server"
args = ["--stdio"]
settings_section = "_"
[language_server.typescript-language-server.settings._]
# quotePreference = "double"
# typescript.format.semicolons = "insert"

[language_server.json-language-server]
filetypes = ["json"]
roots = ["package.json"]
command = "vscode-json-languageserver"
args = ["--stdio"]

[language_server.nil]
filetypes = ["nix"]
command = "nil"
roots = ["flake.nix", "shell.nix", ".git"]
[language_server.nil.settings.nil]
formatting.command = [ "nixfmt" ]

[language_server.intelephense]
filetypes = ["php"]
roots = [".htaccess", "composer.json"]
command = "intelephense"
args = ["--stdio"]
settings_section = "intelephense"
[language_server.intelephense.settings.intelephense]
storagePath = "/tmp/intelephense"

format.braces = "k&r"
environment.includePaths = [
    "./vendor",
    "./vendor/autoload",
    "./vendor/laravel/framework/",
    "./vendor/laravel/framework/src/",
    "./vendor/laravel/framework/src/Illuminate/"
]
files.exclude = [
    "**/.git/**",
    "**/.svn/**",
    "**/.hg/**",
    "**/.direnv/**",
    "**/CVS/**",
    "**/.DS_Store/**",
    "**/node_modules/**",
    "**/bower_components/**",
    "**/resources/views/**"
]
stubs = [
    "apache", "bcmath", "bz2", "calendar", "com_dotnet", "Core", "ctype",
    "curl", "date", "dba", "dom", "enchant", "exif", "FFI", "fileinfo", "filter",
    "fpm", "ftp", "gd", "gettext", "gmp", "hash", "iconv", "imagick", "imap",
    "intl", "json", "ldap", "libxml", "mbstring", "meta", "mysqli", "oci8",
    "odbc", "openssl", "pcntl", "pcre", "PDO", "pdo_ibm", "pdo_mysql", "pdo_pgsql",
    "pdo_sqlite", "pgsql", "Phar", "posix", "pspell", "readline", "Reflection",
    "session", "shmop", "SimpleXML", "snmp", "soap", "sockets", "sodium",
    "SPL", "sqlite3", "standard", "superglobals", "sysvmsg", "sysvsem", "sysvshm",
    "tidy", "tokenizer", "xml", "xmlreader", "xmlrpc", "xmlwriter", "xsl",
    "Zend OPcache", "zip", "zlib",
]


[language_server.rust-analyzer]
filetypes = ["rust"]
roots = ["Cargo.toml"]
command = "sh"
args = [
    "-c",
    """
        if path=$(rustup which rust-analyzer 2>/dev/null); then
            "$path"
        else
            rust-analyzer
        fi
    """,
]
[language_server.rust-analyzer.settings.rust-analyzer]
# See https://rust-analyzer.github.io/manual.html#configuration
# cargo.features = []
checkOnSave.command = "clippy"
hoverActions.enable = false # kak-lsp doesn't support this at the moment

[language_server.godot]
filetypes = ["gd", "gdscript", "gdscript3"]
roots = ["project.godot", ".git/"]
command = "nc"
args = [ "localhost", "6008"]

# Semantic tokens support
# See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
# for the default list of tokens and modifiers.
# However, many language servers implement their own values.
# Make sure to check the output of `lsp-capabilities` and each server's documentation and source code as well.
# Examples:
# - TypeScript: https://github.com/microsoft/vscode-languageserver-node/blob/main/client/src/common/semanticTokens.ts
# - Rust Analyzer: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/syntax_highlighting.rs
[semantic_tokens]
faces = [
    {face="documentation", token="comment", modifiers=["documentation"]},
    {face="comment", token="comment"},
    {face="function", token="function"},
    {face="keyword", token="keyword"},
    {face="module", token="namespace"},
    {face="operator", token="operator"},
    {face="string", token="string"},
    {face="type", token="type"},
    {face="default+d", token="variable", modifiers=["readonly"]},
    {face="default+d", token="variable", modifiers=["constant"]},
    {face="variable", token="variable"},
]
