Skip to content

Extension adds spurious "macros.inspect" command #60

@lilyball

Description

@lilyball

After installing this extension and defining one macro, my keybindings list shows that one macro, but it also shows a second macro called macros.inspect. Invoking this just logs a JavaScript error.

Upon inspection, it appears that the vscode.WorkspaceConfiguration object returned from vscode.workspace.getConfiguration() includes this extra inspect key, and experimentally it appears that inspect is an undocumented key that can be used to get information about settings in this configuration (in particular, it appears to let you extract default vs global vs workspace settings).

In any case, right now the code just hardcodes several keys to ignore

macros/extension.js

Lines 23 to 25 in 96b0d7b

const macros = Object.keys(settings).filter((prop) => {
return prop !== 'has' && prop !== 'get' && prop !== 'update';
});

and really what it should do is skip the hardcoding and just invoke settings.get(name) for each key, as that appears to handle this for you. This will also fix the bug where a macro named "get" will just be silently ignored, as settings.get(name) does the right thing even if the name is one of the functions (such as "get" or "inspect").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions