aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2023-11-19 21:53:03 -0800
committerGitHub <noreply@github.com>2023-11-20 13:53:03 +0800
commite8842b9590de41f5b9c81a877d33bef828f7621e (patch)
tree2885575cd7d35f133ae7c8b7115eeca6d50d889b /lua
parentfix(rust-analyzer): don't run cargo if Cargo.toml is not found (#2905) (diff)
downloadnvim-lspconfig-e8842b9590de41f5b9c81a877d33bef828f7621e.tar
nvim-lspconfig-e8842b9590de41f5b9c81a877d33bef828f7621e.tar.gz
nvim-lspconfig-e8842b9590de41f5b9c81a877d33bef828f7621e.tar.bz2
nvim-lspconfig-e8842b9590de41f5b9c81a877d33bef828f7621e.tar.lz
nvim-lspconfig-e8842b9590de41f5b9c81a877d33bef828f7621e.tar.xz
nvim-lspconfig-e8842b9590de41f5b9c81a877d33bef828f7621e.tar.zst
nvim-lspconfig-e8842b9590de41f5b9c81a877d33bef828f7621e.zip
feat: add support for slangd (#2907)
`slangd` is the language server for [slang](https://github.com/shader-slang/slang), a shader language that extends HLSL with additional features.
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/server_configurations/slangd.lua44
1 files changed, 44 insertions, 0 deletions
diff --git a/lua/lspconfig/server_configurations/slangd.lua b/lua/lspconfig/server_configurations/slangd.lua
new file mode 100644
index 00000000..642b4ddf
--- /dev/null
+++ b/lua/lspconfig/server_configurations/slangd.lua
@@ -0,0 +1,44 @@
+local util = require 'lspconfig.util'
+local bin_name = 'slangd'
+
+if vim.fn.has 'win32' == 1 then
+ bin_name = 'slangd.exe'
+end
+
+return {
+ default_config = {
+ cmd = { bin_name },
+ filetypes = { 'hlsl', 'shaderslang' },
+ root_dir = util.find_git_ancestor,
+ single_file_support = true,
+ },
+ docs = {
+ description = [[
+https://github.com/shader-slang/slang
+
+The `slangd` binary can be downloaded as part of [slang releases](https://github.com/shader-slang/slang/releases) or
+by [building `slang` from source](https://github.com/shader-slang/slang/blob/master/docs/building.md).
+
+The server can be configured by passing a "settings" object to `slangd.setup{}`:
+
+```lua
+require('lspconfig').slangd.setup{
+ settings = {
+ slang = {
+ predefinedMacros = {"MY_VALUE_MACRO=1"},
+ inlayHints = {
+ deducedTypes = true,
+ parameterNames = true,
+ }
+ }
+ }
+}
+```
+Available options are documented [here](https://github.com/shader-slang/slang-vscode-extension/tree/main?tab=readme-ov-file#configurations)
+or in more detail [here](https://github.com/shader-slang/slang-vscode-extension/blob/main/package.json#L70).
+]],
+ default_config = {
+ root_dir = [[util.find_git_ancestor]],
+ },
+ },
+}