asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
340 stars 97 forks source link

[FOR DISCUSSION ONLY] - illustrates possible approach for limiting calls to findFiles #906

Closed alaindresse closed 2 months ago

alaindresse commented 2 months ago

@ggrossetie this shows my explorations on how to limit the impact of calls to findFiles on responsiveness, for discussion.

I will put a few comments in the PR to highlight the points that may be interesting.

ggrossetie commented 2 months ago

I don't want to dig into the implementation but I'm fine with the following changes:

For the later, and if we want to be thorough, we will need to add a listener (https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider) and update the cache when:

ggrossetie commented 2 months ago

Could you please open a dedicated pull request for "Use findFiles2 (proposed API) if available"?

ggrossetie commented 2 months ago

Oh, I just found this in the documentation:

While you're not able to publish extensions using the proposed API on the Marketplace, you can still share your extension with your peers by packaging and sharing your extension.

https://code.visualstudio.com/api/advanced-topics/using-proposed-api#sharing-extensions-using-the-proposed-api

I guess that would prevent us from using it since we want to publish on the Marketplace :(

alaindresse commented 2 months ago

Oh, I just found this in the documentation:

While you're not able to publish extensions using the proposed API on the Marketplace, you can still share your extension with your peers by packaging and sharing your extension.

https://code.visualstudio.com/api/advanced-topics/using-proposed-api#sharing-extensions-using-the-proposed-api

I guess that would prevent us from using it since we want to publish on the Marketplace :(

Indeed, I don't believe we will have to wait for the api to be finalized before we can use it (except for internal releases).

alaindresse commented 2 months ago

Could you please open a dedicated pull request for "Use findFiles2 (proposed API) if available"?

Given the restrictions on publishing an extension that uses a proposed API, I don't believe this is really useful ☹️

alaindresse commented 2 months ago

I don't want to dig into the implementation but I'm fine with the following changes:

  • Make use of findFiles2 if available
  • Add a cache mechanism on antora.yml files

For the later, and if we want to be thorough, we will need to add a listener (https://code.visualstudio.com/api/references/vscode-api#FileSystemProvider) and update the cache when:

  • a file is created with the name antora.yml
  • a file is renamed to antora.yml
  • an antora.yml is moved

In this proposal, I do listen to vscode.workspace.onDidChangeTextDocument (in antoraConfig.ts line 93), which I believe would cover antora.yml files in the repo. Could you clarify what the FileSystemProvider would add to that ?

When I get some time, I'll try to create a PR that could actually be merged on the caching.

alaindresse commented 2 months ago

Closing this pull request as discussion has taken place with clear next steps

ggrossetie commented 2 months ago

@alaindresse Could you please share the directory structure of your project? Maybe we could let the user configure the glob pattern to find antora.yml (default value **/antora.yml). If you have a common structure, then something like projects/**/docs/antora.yml might be faster.