This commit is contained in:
Belal Elsabbagh
2025-11-11 22:09:44 +02:00
parent b65ce36d2a
commit 16a3109430
12 changed files with 178 additions and 56 deletions

View File

@@ -183,11 +183,6 @@ input {
} }
} }
# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures {
workspace_swipe = false
}
# Example per-device config # Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more # See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
device { device {

View File

@@ -145,8 +145,9 @@ vim.lsp.enable {
'pyright', 'pyright',
'ruff', 'ruff',
'julials', 'julials',
'sveltels', 'svelte-language-server',
'rust-analyzer', 'rust-analyzer',
'emmet-language-server',
'tsls', 'tsls',
'yamlls', 'yamlls',
'astrols', 'astrols',

View File

@@ -0,0 +1,28 @@
---@brief
---
--- https://github.com/bash-lsp/bash-language-server
---
--- `bash-language-server` can be installed via `npm`:
--- ```sh
--- npm i -g bash-language-server
--- ```
---
--- Language server for bash, written using tree sitter in typescript.
---@type vim.lsp.Config
return {
cmd = { 'bash-language-server', 'start' },
settings = {
bashIde = {
-- Glob pattern for finding and parsing shell script files in the workspace.
-- Used by the background analysis features across files.
-- Prevent recursive scanning which will cause issues when opening a file
-- directly in the home directory (e.g. ~/foo.sh).
--
-- Default upstream pattern is "**/*@(.sh|.inc|.bash|.command)".
globPattern = vim.env.GLOB_PATTERN or '*@(.sh|.inc|.bash|.command)',
},
},
filetypes = { 'bash', 'sh' },
}

View File

@@ -0,0 +1,71 @@
---@brief
--- https://biomejs.dev
---
--- Toolchain of the web. [Successor of Rome](https://biomejs.dev/blog/annoucing-biome).
---
--- ```sh
--- npm install [-g] @biomejs/biome
--- ```
---
--- ### Monorepo support
---
--- `biome` supports monorepos by default. It will automatically find the `biome.json` corresponding to the package you are working on, as described in the [documentation](https://biomejs.dev/guides/big-projects/#monorepo). This works without the need of spawning multiple instances of `biome`, saving memory.
local util = require 'lspconfig.util'
---@type vim.lsp.Config
return {
cmd = function(dispatchers, config)
local cmd = 'biome'
local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/biome'
if local_cmd and vim.fn.executable(local_cmd) == 1 then
cmd = local_cmd
end
return vim.lsp.rpc.start({ cmd, 'lsp-proxy' }, dispatchers)
end,
filetypes = {
'astro',
'css',
'graphql',
'html',
'javascript',
'javascriptreact',
'json',
'jsonc',
'svelte',
'typescript',
'typescript.tsx',
'typescriptreact',
'vue',
},
workspace_required = true,
root_dir = function(bufnr, on_dir)
-- The project root is where the LSP can be started from
-- As stated in the documentation above, this LSP supports monorepos and simple projects.
-- We select then from the project root, which is identified by the presence of a package
-- manager lock file.
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock' }
-- Give the root markers equal priority by wrapping them in a table
root_markers = vim.fn.has 'nvim-0.11.3' == 1 and { root_markers, { '.git' } } or vim.list_extend(root_markers, { '.git' })
-- We fallback to the current working directory if no project root is found
local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd()
-- We know that the buffer is using Biome if it has a config file
-- in its directory tree.
local filename = vim.api.nvim_buf_get_name(bufnr)
local biome_config_files = { 'biome.json', 'biome.jsonc' }
biome_config_files = util.insert_package_json(biome_config_files, 'biome', filename)
local is_buffer_using_biome = vim.fs.find(biome_config_files, {
path = filename,
type = 'file',
limit = 1,
upward = true,
stop = vim.fs.dirname(project_root),
})[1]
if not is_buffer_using_biome then
return
end
on_dir(project_root)
end,
}

View File

@@ -0,0 +1,21 @@
return {
cmd = { 'emmet-language-server', '--stdio' },
filetypes = {
'astro',
'css',
'eruby',
'html',
'htmlangular',
'htmldjango',
'javascriptreact',
'less',
'pug',
'sass',
'scss',
'svelte',
'templ',
'typescriptreact',
'vue',
},
root_markers = { '.git' },
}

View File

@@ -15,6 +15,15 @@ return {
runtime = { runtime = {
version = 'LuaJIT', version = 'LuaJIT',
}, },
diagnostics = {
globals = { 'vim' }, -- Add 'vim' to the list of global variables
},
workspace = {
library = {
vim.env.VIMRUNTIME, -- Include Neovim's runtime files for better completion
-- Add other library paths if needed, e.g., for plugins
},
},
}, },
}, },
} }

View File

@@ -0,0 +1,46 @@
---@brief
---
--- https://github.com/sveltejs/language-tools/tree/master/packages/language-server
---
--- Note: assuming that [ts_ls](#ts_ls) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage).
---
--- `svelte-language-server` can be installed via `npm`:
--- ```sh
--- npm install -g svelte-language-server
--- ```
---@type vim.lsp.Config
return {
cmd = { 'svelteserver', '--stdio' },
filetypes = { 'svelte' },
root_dir = function(bufnr, on_dir)
local fname = vim.api.nvim_buf_get_name(bufnr)
-- Svelte LSP only supports file:// schema. https://github.com/sveltejs/language-tools/issues/2777
if vim.uv.fs_stat(fname) ~= nil then
local root_markers = { 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml', 'bun.lockb', 'bun.lock', 'deno.lock' }
root_markers = vim.fn.has 'nvim-0.11.3' == 1 and { root_markers, { '.git' } } or vim.list_extend(root_markers, { '.git' })
-- We fallback to the current working directory if no project root is found
local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd()
on_dir(project_root)
end
end,
on_attach = function(client, bufnr)
-- Workaround to trigger reloading JS/TS files
-- See https://github.com/sveltejs/language-tools/issues/2008
vim.api.nvim_create_autocmd('BufWritePost', {
pattern = { '*.js', '*.ts' },
group = vim.api.nvim_create_augroup('lspconfig.svelte', {}),
callback = function(ctx)
-- internal API to sync changes that have not yet been saved to the file system
client:notify('$/onDidChangeTsOrJsFile', { uri = ctx.match })
end,
})
vim.api.nvim_buf_create_user_command(bufnr, 'LspMigrateToSvelte5', function()
client:exec_cmd {
title = 'Migrate Component to Svelte 5 Syntax',
command = 'migrate_to_svelte_5',
arguments = { vim.uri_from_bufnr(bufnr) },
}
end, { desc = 'Migrate Component to Svelte 5 Syntax' })
end,
}

View File

@@ -1,38 +0,0 @@
local function migrate_to_svelte_5()
local clients = vim.lsp.get_clients {
bufnr = 0,
name = 'svelte',
}
for _, client in ipairs(clients) do
client:exec_cmd {
command = 'migrate_to_svelte_5',
arguments = { vim.uri_from_bufnr(0) },
}
end
end
return {
default_config = {
cmd = { 'svelteserver', '--stdio' },
filetypes = { 'svelte' },
root_dir = { 'node_modules', '.git', 'package.json' },
},
commands = {
MigrateToSvelte5 = {
migrate_to_svelte_5,
description = 'Migrate Component to Svelte 5 Syntax',
},
},
docs = {
description = [[
https://github.com/sveltejs/language-tools/tree/master/packages/language-server
Note: assuming that [ts_ls](#ts_ls) is setup, full JavaScript/TypeScript support (find references, rename, etc of symbols in Svelte files when working in JS/TS files) requires per-project installation and configuration of [typescript-svelte-plugin](https://github.com/sveltejs/language-tools/tree/master/packages/typescript-plugin#usage).
`svelte-language-server` can be installed via `npm`:
```sh
npm install -g svelte-language-server
```
]],
},
}

View File

@@ -31,7 +31,7 @@ return {
rust = { 'rustfmt', lsp_format = 'fallback' }, rust = { 'rustfmt', lsp_format = 'fallback' },
json = { 'biome', 'prettier', stop_after_first = true }, json = { 'biome', 'prettier', stop_after_first = true },
vue = { 'biome', 'prettier' }, vue = { 'biome', 'prettier' },
svelte = { 'biome', 'prettier' }, svelte = { 'biome', 'prettier', stop_after_first = true },
php = { 'pint', 'intelephense', stop_after_first = true }, php = { 'pint', 'intelephense', stop_after_first = true },
}, },
formatters = { formatters = {

View File

@@ -1,10 +0,0 @@
return {
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
},
},
}

View File

@@ -1 +0,0 @@
return { 'Bilal2453/luvit-meta', lazy = true }