From 9d3ee35b62d84f0657ef2202ebde132df5bc6cf9 Mon Sep 17 00:00:00 2001 From: Marc Jakobi Date: Sun, 26 May 2024 01:26:02 +0200 Subject: [PATCH] revert(lsp): defer attaching client to `BufEnter` (#409) This reverts commit 90bfbc588fef7e44d82e5aba8dfc787e8d3f5d1a. --- CHANGELOG.md | 7 ------- ftplugin/rust.lua | 11 ++--------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbc914c6..758efb2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] - -### Changed - -- LSP: Defer attaching the LSP client to `BufEnter` for a smoother experience - on low-end devices. - ## [4.23.5] - 2024-05-24 ### Fixed diff --git a/ftplugin/rust.lua b/ftplugin/rust.lua index 786e1309..11661084 100644 --- a/ftplugin/rust.lua +++ b/ftplugin/rust.lua @@ -46,19 +46,12 @@ end vim.g.loaded_rustaceanvim = true -local bufnr = vim.api.nvim_get_current_buf() local auto_attach = config.server.auto_attach if type(auto_attach) == 'function' then + local bufnr = vim.api.nvim_get_current_buf() auto_attach = auto_attach(bufnr) end if auto_attach then - -- Defer for a smoother experience on low-end devices - vim.api.nvim_create_autocmd('BufEnter', { - buffer = bufnr, - group = vim.api.nvim_create_augroup('RustaceanvimAttach', { clear = true }), - callback = function() - require('rustaceanvim.lsp').start() - end, - }) + require('rustaceanvim.lsp').start() end