helix-mods/languages.toml
James Cash 2e692dc184
Add (SWI-)Prolog LSP support (#816)
As discussed in #809 ; I also have a [tree-sitter implementation](https://github.com/jamesnvc/tree-sitter-prolog), but for reasons discussed in the linked post, I kind of gave up on that sort of static approach for making a general-purpose Prolog grammar (since it has a very flexible syntax and allows defining new operators with new precedences dynamically).

That being said, the LSP implementation here at least shows documentation and does support the semantic token API, so when Helix supports that, this should also provide highlighting.
2021-10-08 11:05:30 +09:00

329 lines
6.6 KiB
TOML

[[language]]
name = "rust"
scope = "source.rust"
injection-regex = "rust"
file-types = ["rs"]
roots = []
auto-format = true
comment-token = "//"
config = """
{
"cargo": {
"loadOutDirsFromCheck": true
},
"procMacro": {
"enable": false
}
}
"""
language-server = { command = "rust-analyzer" }
indent = { tab-width = 4, unit = " " }
[[language]]
name = "toml"
scope = "source.toml"
injection-regex = "toml"
file-types = ["toml"]
roots = []
comment-token = "#"
indent = { tab-width = 2, unit = " " }
[[language]]
name = "protobuf"
scope = "source.proto"
injection-regex = "protobuf"
file-types = ["proto"]
roots = []
comment-token = "//"
indent = { tab-width = 2, unit = " " }
[[language]]
name = "elixir"
scope = "source.elixir"
injection-regex = "elixir"
file-types = ["ex", "exs"]
roots = []
comment-token = "#"
language-server = { command = "elixir-ls" }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "json"
scope = "source.json"
injection-regex = "json"
file-types = ["json"]
roots = []
indent = { tab-width = 2, unit = " " }
[[language]]
name = "c"
scope = "source.c"
injection-regex = "c"
file-types = ["c"] # TODO: ["h"]
roots = []
comment-token = "//"
language-server = { command = "clangd" }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "cpp"
scope = "source.cpp"
injection-regex = "cpp"
file-types = ["cc", "hh", "cpp", "hpp", "h", "ipp", "tpp", "cxx", "hxx", "ixx", "txx", "ino"]
roots = []
comment-token = "//"
language-server = { command = "clangd" }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "go"
scope = "source.go"
injection-regex = "go"
file-types = ["go"]
roots = ["Gopkg.toml", "go.mod"]
auto-format = true
comment-token = "//"
language-server = { command = "gopls" }
# TODO: gopls needs utf-8 offsets?
indent = { tab-width = 4, unit = "\t" }
[[language]]
name = "javascript"
scope = "source.js"
injection-regex = "^(js|javascript)$"
file-types = ["js", "mjs"]
roots = []
comment-token = "//"
# TODO: highlights-jsx, highlights-params
indent = { tab-width = 2, unit = " " }
[[language]]
name = "typescript"
scope = "source.ts"
injection-regex = "^(ts|typescript)$"
file-types = ["ts"]
roots = []
# TODO: highlights-jsx, highlights-params
language-server = { command = "typescript-language-server", args = ["--stdio"] }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "tsx"
scope = "source.tsx"
injection-regex = "^(tsx)$" # |typescript
file-types = ["tsx"]
roots = []
# TODO: highlights-jsx, highlights-params
language-server = { command = "typescript-language-server", args = ["--stdio"] }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "css"
scope = "source.css"
injection-regex = "css"
file-types = ["css"]
roots = []
indent = { tab-width = 2, unit = " " }
[[language]]
name = "html"
scope = "text.html.basic"
injection-regex = "html"
file-types = ["html"]
roots = []
indent = { tab-width = 2, unit = " " }
[[language]]
name = "python"
scope = "source.python"
injection-regex = "python"
file-types = ["py"]
roots = []
comment-token = "#"
language-server = { command = "pyls" }
# TODO: pyls needs utf-8 offsets
indent = { tab-width = 4, unit = " " }
[[language]]
name = "nix"
scope = "source.nix"
injection-regex = "nix"
file-types = ["nix"]
roots = []
comment-token = "#"
language-server = { command = "rnix-lsp" }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "ruby"
scope = "source.ruby"
injection-regex = "ruby"
file-types = ["rb"]
roots = []
comment-token = "#"
language-server = { command = "solargraph", args = ["stdio"] }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "bash"
scope = "source.bash"
injection-regex = "bash"
file-types = ["sh", "bash"]
roots = []
comment-token = "#"
language-server = { command = "bash-language-server", args = ["start"] }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "php"
scope = "source.php"
injection-regex = "php"
file-types = ["php"]
roots = []
indent = { tab-width = 2, unit = " " }
[[language]]
name = "latex"
scope = "source.tex"
injection-regex = "tex"
file-types = ["tex"]
roots = []
comment-token = "%"
indent = { tab-width = 4, unit = "\t" }
[[language]]
name = "julia"
scope = "source.julia"
injection-regex = "julia"
file-types = ["jl"]
roots = []
comment-token = "#"
language-server = { command = "julia", args = [
"--startup-file=no",
"--history-file=no",
"--quiet",
"-e",
"""
using LanguageServer;
using Pkg;
import StaticLint;
env_path = dirname(Pkg.Types.Context().env.project_file);
server = LanguageServer.LanguageServerInstance(stdin, stdout, env_path, "");
server.runlinter = true;
run(server);
""",
] }
indent = { tab-width = 2, unit = " " }
[[language]]
name = "java"
scope = "source.java"
injection-regex = "java"
file-types = ["java"]
roots = []
indent = { tab-width = 4, unit = " " }
[[language]]
name = "ledger"
scope = "source.ledger"
injection-regex = "ledger"
file-types = ["ldg", "ledger", "journal"]
roots = []
comment-token = ";"
indent = { tab-width = 4, unit = " " }
[[language]]
name = "ocaml"
scope = "source.ocaml"
injection-regex = "ocaml"
file-types = ["ml"]
roots = []
comment-token = "(**)"
indent = { tab-width = 2, unit = " " }
[[language]]
name = "ocaml-interface"
scope = "source.ocaml.interface"
file-types = ["mli"]
roots = []
comment-token = "(**)"
indent = { tab-width = 2, unit = " "}
[[language]]
name = "lua"
scope = "source.lua"
file-types = ["lua"]
roots = []
comment-token = "--"
indent = { tab-width = 2, unit = " " }
[[language]]
name = "svelte"
scope = "source.svelte"
injection-regex = "svelte"
file-types = ["svelte"]
roots = []
indent = { tab-width = 2, unit = " " }
language-server = { command = "svelteserver", args = ["--stdio"] }
[[language]]
name = "yaml"
scope = "source.yaml"
file-types = ["yml", "yaml"]
roots = []
comment-token = "#"
indent = { tab-width = 2, unit = " " }
# [[language]]
# name = "haskell"
# scope = "source.haskell"
# injection-regex = "haskell"
# file-types = ["hs"]
# roots = []
# comment-token = "--"
#
# indent = { tab-width = 2, unit = " " }
[[language]]
name = "zig"
scope = "source.zig"
injection-regex = "zig"
file-types = ["zig"]
roots = ["build.zig"]
auto-format = true
comment-token = "//"
language-server = { command = "zls" }
indent = { tab-width = 4, unit = " " }
[[language]]
name = "prolog"
scope = "source.prolog"
roots = []
file-types = ["pl", "prolog"]
comment-token = "%"
language-server = { command = "swipl", args = [
"-g", "use_module(library(lsp_server))",
"-g", "lsp_server:main",
"-t", "halt", "--", "stdio"] }