diff --git a/CHANGELOG.md b/CHANGELOG.md index 826f1b4..391c698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,13 @@ All notable changes to the Official Dotenv VS Code extension will be documented in this file. -## [Unreleased](https://github.com/dotenvx/dotenv-vscode/compare/v1.5.7...master) +## [Unreleased](https://github.com/dotenvx/dotenv-vscode/compare/v1.5.8...master) + +## [1.5.8](https://github.com/dotenvx/dotenv-vscode/compare/v1.5.7...v1.5.8) (2026-09-23) + +### Changed + +* Get settings right - turning off the feature not the cloaking. ([#143](https://github.com/dotenvx/dotenv-vscode/pull/143)) ## [1.5.7](https://github.com/dotenvx/dotenv-vscode/compare/v1.5.6...v1.5.7) (2026-09-23) @@ -183,6 +189,8 @@ All notable changes to the Official Dotenv VS Code extension will be documented ### Fixed +* Always cloak new secret peeks, independently of editor cloaking. Disable cloaking controls when the auto-cloaking feature is turned off. + * Disable dotenv hovers and expanded autocomplete value details when secret peeking is turned off, while keeping autocomplete suggestions available. * Reverted code causing autocloaking to fail [#93](https://github.com/dotenvx/dotenv-vscode/pull/93) diff --git a/README.md b/README.md index 20a1541..7832dca 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,8 @@ from the Command Palette to reveal or hide them. Switching tabs hides them again in the Dotenv Editor when auto-cloaking is enabled. Set `dotenv.enableAutocloaking` to `false` to keep values visible, including after -reopening files or switching tabs. Changes to this setting apply to open editors immediately. +reopening files or switching tabs. This disables the cloaking feature and removes +its toggle controls. Changes apply to open editors immediately. @@ -96,7 +97,9 @@ secret-peeking setting stays unchanged. Hover over a reference such as `process.env.SECRET_KEY` or `ENV["SECRET_KEY"]`. -The popup shows the source file and lets you **Reveal value** or **Hide value**. +Every new hover or expanded autocomplete peek starts cloaked. Click **Reveal value** +to reveal that popup, or **Hide value** to cloak it again. Editor cloaking toggles +never reveal peek values. Uncheck **Dotenv: Enable Secretpeeking** to disable dotenv hovers and in-code Reveal actions, including the expanded value details in autocomplete. Completion suggestions remain available with masked values. diff --git a/lib/autocloaking.js b/lib/autocloaking.js index 3954f25..06d09c8 100644 --- a/lib/autocloaking.js +++ b/lib/autocloaking.js @@ -58,6 +58,7 @@ function decorateMasking (context) { const toggleLink = { provideCodeLenses: function (document, token) { + if (!settings.autocloakingFeatureEnabled(document.uri)) return [] if (yaml.supported(document) && !yaml.ranges(document).length) return [] const range = new vscode.Range(0, 0, 0, 0) // place at top of file const lens = new vscode.CodeLens(range, { @@ -71,7 +72,12 @@ const toggleLink = { } function buildToggle (context) { - const codeLens = vscode.languages.registerCodeLensProvider([{ language: 'dotenv' }, { language: 'yaml' }], toggleLink) + const codeLens = vscode.languages.registerCodeLensProvider([{ language: 'dotenv' }, { language: 'yaml' }], { + ...toggleLink, + onDidChangeCodeLenses: listener => vscode.workspace.onDidChangeConfiguration(event => { + if (event.affectsConfiguration('dotenv.enableAutocloaking')) listener() + }) + }) context.subscriptions.push(codeLens) @@ -80,6 +86,7 @@ function buildToggle (context) { async function dotenvToggleAutocloaking () { const uri = vscode.window.activeTextEditor?.document.uri + if (!settings.autocloakingFeatureEnabled(uri)) return false if (settings.autocloakingEnabled(uri)) { await settings.autocloakingOff(uri) } else { diff --git a/lib/helpers.js b/lib/helpers.js index e168a5d..5ce511e 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -46,7 +46,7 @@ function valueHover (key, document, range) { if (!settings.secretpeekingEnabled(document.uri)) return undefined const values = module.exports.envValues(document).get(key) if (!values) return new vscode.Hover(settings.missingText(), range) - const revealed = hoverReveal.begin(document, key, range, settings.secretpeekingEnabled(document.uri)) + const revealed = hoverReveal.begin(document, key, range) const contents = [valueDocumentation(values, undefined, undefined, revealed, document.uri)] const control = values.some(entry => entry.value) && hoverReveal.control(document, key, range, revealed) if (control) contents.push(control) diff --git a/lib/hover-reveal.js b/lib/hover-reveal.js index 57d6e0f..2daa627 100644 --- a/lib/hover-reveal.js +++ b/lib/hover-reveal.js @@ -11,9 +11,9 @@ function matches (request, document, key, range) { request.version === document.version && request.key === key && range && request.range.isEqual(range) } -function begin (document, key, range, defaultRevealed) { +function begin (document, key, range) { const request = pending - if (!matches(request, document, key, range)) return defaultRevealed + if (!matches(request, document, key, range)) return false pending = undefined return request.revealed } diff --git a/lib/secure-editor.js b/lib/secure-editor.js index 4c0af47..0fc8f6b 100644 --- a/lib/secure-editor.js +++ b/lib/secure-editor.js @@ -13,7 +13,7 @@ function html (webview, extensionUri) {