Skip to content

Commit f8f0341

Browse files
author
Marc Jakobi
committed
fix(health): check if vim.g.rustaceanvim was set but not sourced
1 parent bdd7155 commit f8f0341

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ 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]
10+
11+
### Fixed
12+
13+
- Health: Check if `vim.g.rustaceanvim` is set,
14+
but hasn't been sourced before initialization.
15+
916
## [3.7.1] - 2023-11-28
1017

1118
### Fixed

lua/rustaceanvim/config/internal.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ local RustaceanDefaultConfig = {
247247
return should_enable_dap_config_value(RustaceanConfig.dap.adapter)
248248
end,
249249
},
250+
was_g_rustaceanvim_sourced = vim.g.rustaceanvim ~= nil,
250251
}
251252

252253
local rustaceanvim = vim.g.rustaceanvim or {}

lua/rustaceanvim/health.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,8 @@ end
180180

181181
local function check_config()
182182
start('Checking config')
183-
if vim.g.rustaceanvim then
184-
ok('vim.g.rustaceanvim is set')
185-
else
186-
ok('vim.g.rustaceanvim is not set')
183+
if vim.g.rustaceanvim and not config.was_g_rustaceanvim_sourced then
184+
error('vim.g.rustaceanvim is set, but it was sourced after rustaceanvim was initialized.')
187185
end
188186
local valid, err = require('rustaceanvim.config.check').validate(config)
189187
if valid then

0 commit comments

Comments
 (0)