geddski / macros

macros support for VS Code
MIT License
166 stars 36 forks source link

Extension adds spurious "macros.inspect" command #60

Open lilyball opened 3 years ago

lilyball commented 3 years ago

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

https://github.com/geddski/macros/blob/96b0d7b2930c26eea22f2a9acbebba823bc98c5b/extension.js#L23-L25

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").