Skip to content

Commit

Permalink
perf: don't run ftplugin/rust.lua more than once per buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Jan 27, 2024
1 parent ce119c0 commit a503d05
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@ 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]
## [4.0.1] - 2024-01-27

### Fixed

- LSP: Only setup `vim.lsp.commands` for rust-analyzer on the first
initialization.
- LSP: Fix resetting client state on `:RustAnalyzer stop`
if only one client is attached.

### Performance

- Only setup `vim.lsp.commands` for rust-analyzer on the first
initialization.
- Don't run `ftplugin/rust.lua` more than once on the same
buffer.

## [4.0.0] - 2024-01-25

### BREAKING CHANGES
Expand Down
7 changes: 7 additions & 0 deletions ftplugin/rust.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
local bufnr = vim.api.nvim_get_current_buf()
if vim.b[bufnr].did_rustaceanvim_ftplugin then
return
end

---@type RustaceanConfig
local config = require('rustaceanvim.config.internal')
local types = require('rustaceanvim.types.internal')
Expand Down Expand Up @@ -42,3 +47,5 @@ if not auto_attach then
end

lsp.start()

vim.b[bufnr].did_rustaceanvim_ftplugin = true

0 comments on commit a503d05

Please sign in to comment.