inlay hints and ssh: nyx->hungtr

nix-components
pegasust 2022-11-22 03:48:24 +00:00
parent 2beefdb943
commit c63c5b3ae6
2 changed files with 27 additions and 5 deletions

View File

@ -113,6 +113,7 @@ Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs)
Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*)
Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis
Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration
Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts
-- UI & colorscheme -- UI & colorscheme
Plug('gruvbox-community/gruvbox') -- theme provider Plug('gruvbox-community/gruvbox') -- theme provider
@ -373,7 +374,7 @@ remap('n', '<leader>gs', function() require('neogit').open({}) end);
-- LSP settings -- LSP settings
-- This function gets run when an LSP connects to a particular buffer. -- This function gets run when an LSP connects to a particular buffer.
local on_attach = function(_client, bufnr) local on_attach = function(client, bufnr)
-- NOTE: Remember that lua is a real programming language, and as such it is possible -- NOTE: Remember that lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself -- to define small helper and utility functions so you don't have to repeat yourself
-- many times. -- many times.
@ -412,6 +413,9 @@ local on_attach = function(_client, bufnr)
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>wl', function() nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
-- enable inlay hints if available
require('inlay-hints').on_attach(client, bufnr)
end, '[W]orkspace [L]ist Folders') end, '[W]orkspace [L]ist Folders')
end end
@ -516,6 +520,16 @@ require('mason-lspconfig').setup({
ensure_installed = servers, ensure_installed = servers,
automatic_installation = true automatic_installation = true
}) })
local inlay_hint_tsjs = {
includeInlayEnumMemberValueHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayParameterNameHints = 'all', -- "none" | "literals" | "all"
inlcudeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayVariableTypeHints = true,
};
require('mason-lspconfig').setup_handlers({ require('mason-lspconfig').setup_handlers({
-- default handler -- default handler
function(server_name) function(server_name)
@ -541,6 +555,7 @@ require('mason-lspconfig').setup_handlers({
library = vim.api.nvim_get_runtime_file('', true) library = vim.api.nvim_get_runtime_file('', true)
}, },
telemetry = { enable = false }, telemetry = { enable = false },
hint = {enable = true,},
format = { format = {
enable = true, enable = true,
defaultConfig = { defaultConfig = {
@ -558,7 +573,11 @@ require('mason-lspconfig').setup_handlers({
capabilities = capabilities, capabilities = capabilities,
-- Monorepo support: spawn one instance of lsp within the git -- Monorepo support: spawn one instance of lsp within the git
-- repos. -- repos.
root_dir = require('lspconfig.util').root_pattern('.git') root_dir = require('lspconfig.util').root_pattern('.git'),
settings = {
javascript = inlay_hint_tsjs,
typescript = inlay_hint_tsjs,
}
} }
end, end,
-- ["rust_analyzer"] = function() -- ["rust_analyzer"] = function()
@ -595,7 +614,9 @@ require("rust-tools").setup {
-- callback to execute once rust-analyzer is done initializing the workspace -- callback to execute once rust-analyzer is done initializing the workspace
-- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error"
on_initialized = nil, on_initialized = function()
require ('inlay-hints').set_all()
end,
-- automatically call RustReloadWorkspace when writing to a Cargo.toml file. -- automatically call RustReloadWorkspace when writing to a Cargo.toml file.
reload_workspace_from_cargo_toml = true, reload_workspace_from_cargo_toml = true,
@ -751,7 +772,8 @@ require("rust-tools").setup {
vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc })
end end
on_attach(client, bufnr); on_attach(client, bufnr)
require('inlay-hints').on_attach(client, bufnr)
nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation') nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation')
end, end,

View File

@ -35,7 +35,7 @@ Host ocolo-lab
# NixOS Pegasust@Linode # NixOS Pegasust@Linode
Host nyx Host nyx
HostName nyx.pegasust.com HostName nyx.pegasust.com
User nyx User hungtr
Port 22 Port 22
Host lizzi Host lizzi