agentleFS
forcedotcomforcedotcom/salesforcedx-vscode/.claude/skills/vscode-window-messages/SKILL.md

vscode-window-messages

Skill1k starsChanged 26 days agoBSD-3-ClauseView on GitHub

Guidelines for using vscode.window.show*Message methods. Use when working with showInformationMessage, showWarningMessage, showErrorMessage.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 13: 0 new projectsWeek of Sep 20: 0 new projectsWeek of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Who's talking about forcedotcom/salesforcedx-vscode

The biggest 5 of 52 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 52

Talked about on GitHub and Stack Overflow (52 times).

On GitHub · 50

45 more on GitHub

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Very specific:

    Use vscode.window.show*Message directly.

    line 25
  2. Very specific:

    All message strings and button labels must use nls.localize().

    line 41
  3. Very specific:

    Add key/value to i18n.ts in package

    line 65
  4. Very specific:

    Use Effect.promise() to wait for user response.

    line 111
  5. Very specific:

    Use Effect.sync() for non-blocking messages.

    line 133
  6. Distinctive:

    No string literals as first argument

    line 255
  7. Very specific:

    No template literals unless they contain nls.localize() calls

    line 256
  8. Very specific:

    Run npm run lint before committing.

    line 259

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

VSCode Window Messages Best Practices

Quick Reference: Critical Rules

CategoryDODON'T
APIDirect vscode.window.show*MessageLegacy NotificationService
Messagesnls.localize('key', ...args)String literals or template literals without nls
Return ValuesHandle Thenable<string | undefined> or Thenable<MessageItem | undefined>Ignore return values
Button ActionsCheck return value for button clicksAssume user always clicks
Button Actionsnls.localizeString literals or template literals without nls
Modal Options{ modal: true, detail: ... } for blocking dialogsdetail without modal: true (detail modal-only); explicit 'Cancel' buttons (VS Code adds one automatically)
Effect (wait)Effect.promise() when response neededEffect.promise() for fire-and-forget
Effect (no wait)Effect.sync() for fire-and-forgetEffect.promise() when not waiting

Use Direct vscode.window Calls

Use vscode.window.show*Message directly. Don't use legacy NotificationService in new code.

import * as vscode from 'vscode';
import { nls } from '../messages/messages';

// CORRECT
await vscode.window.showInformationMessage(nls.localize('retrieve_canceled'));
await vscode.window.showErrorMessage(nls.localize('retrieve_failed', String(error)));

// WRONG
await notificationService.showInformationMessage(nls.localize('retrieve_canceled'));

Internationalization with nls.localize()

All message strings and button labels must use nls.localize(). Enforced by no-vscode-message-literals ESLint rule.

Button labels should use nls.localize() even for command titles. Importing package.nls.json directly strips locale context—only manifest %key% reads locale-specific JSON files. Use nls.localize() to preserve Japanese and other locales via i18n.ja.ts.

// CORRECT
await vscode.window.showInformationMessage(nls.localize('retrieve_canceled'));
await vscode.window.showErrorMessage(nls.localize('retrieve_failed', String(error)));
await vscode.window.showInformationMessage(`${nls.localize('prefix')} ${nls.localize('suffix')}`);

const answer = await vscode.window.showWarningMessage(
  nls.localize('confirm_delete'),
  nls.localize('yes_button'),
  nls.localize('no_button')
);

// WRONG
await vscode.window.showInformationMessage('Operation successful');
await vscode.window.showInformationMessage(`Operation ${status} successful`);
await vscode.window.showWarningMessage(nls.localize('confirm_delete'), 'Yes', 'No');

Adding new messages:

  1. Add key/value to i18n.ts in package
  2. Use nls.localize('your_message_key', ...args)

Handling Return Values

Returns clicked button or undefined if dismissed.

Return types:

  • String buttons: Thenable<string | undefined>
  • MessageItem buttons: Thenable<MessageItem | undefined>
// CORRECT - String buttons
const selection = await vscode.window.showWarningMessage(
  nls.localize('unsaved_changes'),
  nls.localize('save_button'),
  nls.localize('discard_button')
);

if (selection === nls.localize('save_button')) {
  await saveFile();
}

// CORRECT - MessageItem buttons
const item = await vscode.window.showWarningMessage(
  nls.localize('unsaved_changes'),
  { modal: true },
  { title: nls.localize('save_button') },
  { title: nls.localize('discard_button') }
);

if (item?.title === nls.localize('save_button')) {
  await saveFile();
}

// CORRECT - Fire and forget
void vscode.window.showInformationMessage(nls.localize('operation_completed'));

// WRONG
vscode.window.showInformationMessage(nls.localize('operation_completed')); // Missing void

Integration with Effect

When User Response is Required

Use Effect.promise() to wait for user response. Blocks execution until user responds.

import { Effect } from 'effect';

// CORRECT - Wait for response
const selection =
  yield *
  Effect.promise(() =>
    vscode.window.showWarningMessage(nls.localize('confirm_action'), nls.localize('yes'), nls.localize('no'))
  );

if (selection === nls.localize('yes')) {
  yield * performAction();
}

// CORRECT - Wait for error acknowledgment
yield * Effect.promise(() => vscode.window.showErrorMessage(nls.localize('critical_error')));

When User Response is NOT Required (Fire-and-Forget)

Use Effect.sync() for non-blocking messages. Execution continues immediately.

import { Effect } from 'effect';

// CORRECT - Fire and forget
yield *
  Effect.sync(() => {
    void vscode.window.showInformationMessage(nls.localize('background_task_started'));
  });

yield * performBackgroundTask();

// WRONG - Blocks unnecessarily
yield * Effect.promise(() => vscode.window.showInformationMessage(nls.localize('background_task_started')));

// WRONG - Direct call in Effect.gen
yield *
  Effect.gen(function* () {
    await vscode.window.showErrorMessage('Error'); // Type error
  });

Message Types

  • showInformationMessage: Success, info, non-critical
  • showWarningMessage: Warnings, recoverable errors, user decisions
  • showErrorMessage: Errors, failures, critical issues
await vscode.window.showInformationMessage(nls.localize('retrieve_completed'));
await vscode.window.showWarningMessage(nls.localize('unsaved_changes'));
await vscode.window.showErrorMessage(nls.localize('retrieve_failed', errorMessage));

// Modal with detail (detail only shown for modal)
await vscode.window.showWarningMessage(
  nls.localize('destructive_action_warning'),
  { modal: true, detail: nls.localize('destructive_action_detail') },
  nls.localize('confirm')
);

Note: VS Code automatically adds a 'Cancel' button to modal dialogs. Do not add an explicit nls.localize('cancel_button') as an item when modal: true. Dismissing the dialog (via 'Cancel' or ESC) returns undefined.

MessageOptions and MessageItem

MessageOptions

  • modal?: boolean - System modal dialog, blocks interaction
  • detail?: string - Extra text (modal only)

Button Types

Strings or MessageItem objects:

// String buttons (prefer)
const result = await vscode.window.showWarningMessage(
  nls.localize('confirm_action'),
  nls.localize('yes'),
  nls.localize('no')
);
// result: string | undefined

// MessageItem (for modal ESC handling)
const result = await vscode.window.showWarningMessage(
  nls.localize('confirm_action'),
  { modal: true },
  { title: nls.localize('yes'), isCloseAffordance: false },
  { title: nls.localize('no'), isCloseAffordance: true }
);
// result: MessageItem | undefined

isCloseAffordance: true = button handles ESC. Modal-only. Modals auto-add Cancel; use this to control which custom button handles ESC.

Common Patterns

Conditional Messages

// Fire-and-forget
if (hasErrors) {
  void vscode.window.showErrorMessage(nls.localize('operation_completed_with_errors'));
} else {
  void vscode.window.showInformationMessage(nls.localize('operation_completed_successfully'));
}

Error Toast with Action Buttons

Non-modal error toast whose buttons run an action (e.g. Open Report): use NotificationModeService.showErrorWithActions, not showErrorMessage(...).then(...). It returns without waiting for the click and shows an error if the action rejects (notification-mode-api).

yield* notificationMode.showErrorWithActions(nls.localize('operation_completed_with_errors'), [
  { label: nls.localize('open_report_button'), run: () => openReport(uri) }
]);

User Confirmation (Requires Response)

import { Effect } from 'effect';

const confirm =
  yield *
  Effect.promise(() =>
    vscode.window.showWarningMessage(
      nls.localize('confirm_destructive_action'),
      nls.localize('proceed_button')
    )
  );

if (confirm === nls.localize('proceed_button')) {
  yield * performDestructiveAction();
}

ESLint Rule

no-vscode-message-literals enforces:

  • No string literals as first argument
  • No template literals unless they contain nls.localize() calls
  • Applies to showInformationMessage, showWarningMessage, showErrorMessage

Run npm run lint before committing.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.