1

I am trying to split CodeLensProvider implementation in two parts. First part is implementation of provideCodeLenses which returns array of unresolved CodeLens. And the second part is implementation of resolveCodeLens.

So I want to ignore some kind of CodeLens don't match some conditions inside resolveCodeLens because provideCodeLenses should return as fast as possible. Is it possible to do?

Right now I just got <<MISSING COMMAND>> for unresolved CodeLens.

An Example

class Provider implements CodeLensProvider {
  provideCodeLenses() {
    return [lensA, lensB, lensC];
  }

  resolveCodeLens(lens) {
    return executeCommand('vscode.someCommand')
      .then((result) => {
        if (result.isTrue) {
          return lens.resolve();
        } else {
          // ignore `lens`
        }
      });
  }
}
Ky6uk
  • 1,067
  • 3
  • 16
  • 26

1 Answers1

0

Well. According to the answer on the VSCode repository, this is not possible to do. :(

Ky6uk
  • 1,067
  • 3
  • 16
  • 26
  • However, according to the offical sample (github.com/microsoft/vscode-extension-samples/tree/main/…) and doc, for performance reasons the creation of a code lens and resolving should be done to two stages, but since the resolveCodeLens seems to only process one codelens, it confuses me if I have multiple codelens. – K. Symbol May 25 '21 at 10:17