exceedsystem / vscode-macros

This extension gives the macro features to your vscode.
https://marketplace.visualstudio.com/items?itemName=EXCEEDSYSTEM.vscode-macros
MIT License
38 stars 2 forks source link

Could not identify extension for 'vscode' require call from <macro js file> #6

Closed WebMechanic closed 2 years ago

WebMechanic commented 2 years ago

Hello,

I am very happy to have found this extension as it simplifies tasks that were built into other editors I used before.

I adopted one of the examples and noticed the follwing in the "Extension host" log window upon VSCode startup (line breaks added)

[exthost] [warning] Could not identify extension for 'vscode' require call from 
    file:///c%3A/Users/xyz/.config/vscode-macros.js. 
These are the extension path mappings: 
  file:///c%3A/Users/xyz/.vscode/extensions/exceedsystem.vscode-macros-1.3.0 -> 
    EXCEEDSYSTEM.vscode-macros

 ... other extension paths following ...

This is in the "global" part of my file

const vscode = require('vscode');  // I presume this to be the culprit

module.exports.macroCommands = {
  // makro deklarations
}

async function oneMakro() {
  const editor = vscode.window.activeTextEditor;
  if (!editor) return;
  // code
}

I am not very proficient in VSCode's API so it's likely I am doing it wrong and the line needs to go someplace else; or sth. is missing from your Gist example which I used as a blueprint.

If this isn't a "bug", any help would be appreciated :-)

Thank you.

exceedsystem commented 2 years ago

Thank you for the report. However, how exactly can I reproduce the problem? Please also more detailed information such as vscode version and etc...

Regards.

exceedsystem commented 2 years ago

I was able to reproduce it.

This is not a bug, it is by design. Because this warning is caused by the VSCodeMacros extension calling the vscode API from outside the extension path, so there is no need to worry about it.

Regards.

WebMechanic commented 2 years ago

ok, thanks. I was just puzzled 'cos the code I wrote runs perfectly well. Now I need to locate Code's API reference so I know what other fancy stuff I can do :-)

exceedsystem commented 2 years ago

Is the following the VSCode API reference you are looking for? https://code.visualstudio.com/api/references/vscode-api

The following VSCode extension samples may be useful for creating macros. https://github.com/Microsoft/vscode-extension-samples