Skip to content

Commit a503d05

Browse files
author
Marc Jakobi
committed
perf: don't run ftplugin/rust.lua more than once per buffer
1 parent ce119c0 commit a503d05

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@ All notable changes to this project will be documented in this file.
66
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
77
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

9-
## [Unreleased]
9+
## [4.0.1] - 2024-01-27
1010

1111
### Fixed
1212

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

16+
### Performance
17+
18+
- Only setup `vim.lsp.commands` for rust-analyzer on the first
19+
initialization.
20+
- Don't run `ftplugin/rust.lua` more than once on the same
21+
buffer.
22+
1823
## [4.0.0] - 2024-01-25
1924

2025
### BREAKING CHANGES

ftplugin/rust.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
local bufnr = vim.api.nvim_get_current_buf()
2+
if vim.b[bufnr].did_rustaceanvim_ftplugin then
3+
return
4+
end
5+
16
---@type RustaceanConfig
27
local config = require('rustaceanvim.config.internal')
38
local types = require('rustaceanvim.types.internal')
@@ -42,3 +47,5 @@ if not auto_attach then
4247
end
4348

4449
lsp.start()
50+
51+
vim.b[bufnr].did_rustaceanvim_ftplugin = true

0 commit comments

Comments
 (0)