Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add glob support for URLs #5824

Merged
merged 21 commits into from
Jun 29, 2024
Merged

feat: Add glob support for URLs #5824

merged 21 commits into from
Jun 29, 2024

Conversation

Jason3S
Copy link
Collaborator

@Jason3S Jason3S commented Jun 28, 2024

It is possible to use CSpell in an environment where all the files being spell checked exist behind a virtual URL, something like: vscode-vfs://github/microsoft/vscode/extensions/csharp/README.md.

The challenge here is to make the glob system URL aware.

Copy link
Contributor

github-actions bot commented Jun 29, 2024

Performance Report

Repository Elapsed Min/Avg/Max SD SD Graph
AdaDoom3/AdaDoom3 12.36 11.9 / 12.4 / 13.8 0.34 ┣━━┻━━●━━┻━━┫
alexiosc/megistos 30.95 29.5 / 31.1 / 32.9 0.71 ┣━━┻━●╋━━┻━━┫
apollographql/apollo-server 6.53 6.4 / 6.7 / 7.0 0.17 ┣●┻━━╋━━┻━┫
aspnetboilerplate/aspnetboilerplate 24.38 23.3 / 24.8 / 26.9 0.78 ┣━━┻●━╋━━┻━━┫
aws-amplify/docs 36.87 35.3 / 37.7 / 61.0 4.09 ┣━━━┻━●╋━━┻━━━┫
Azure/azure-rest-api-specs 31.12 30.3 / 32.1 / 34.2 0.96 ┣━━●━━╋━━┻━━┫
bitjson/typescript-starter 0.81 0.8 / 0.9 / 1.1 0.05 ┣━●┻━╋━┻━━┫
caddyserver/caddy 11.40 11.2 / 11.8 / 12.5 0.33 ┣━●┻━━╋━━┻━━┫
canada-ca/open-source-logiciel-libre 0.98 0.9 / 1.0 / 1.1 0.03 ┣━━┻●╋━┻━━┫
chef/chef 20.40 19.8 / 20.8 / 22.2 0.66 ┣━━┻●━╋━━┻━━┫
django/django 51.29 50.2 / 52.9 / 56.7 1.22 ┣━━●┻━━╋━━┻━━━┫
eslint/eslint 30.92 30.5 / 31.7 / 34.4 0.87 ┣━━●━━╋━━┻━━┫
exonum/exonum 12.05 11.3 / 11.8 / 14.1 0.48 ┣━━┻━━╋━●┻━━┫
gitbucket/gitbucket 6.83 6.7 / 7.0 / 7.4 0.23 ┣━┻●━╋━━┻━┫
googleapis/google-cloud-cpp 403.43 378.1 / 396.6 / 423.5 11.87 ┣━━━┻━━━╋━●━┻━━━┫
graphql/express-graphql 0.91 0.9 / 0.9 / 1.0 0.03 ┣━━┻●╋━┻━━┫
graphql/graphql-js 6.20 5.7 / 6.0 / 6.6 0.19 ┣━┻━━╋━●┻━┫
graphql/graphql-relay-js 1.08 0.9 / 0.9 / 1.1 0.05 ┣━━┻━╋━┻━━┫●
graphql/graphql-spec 1.81 1.8 / 1.9 / 2.0 0.05 ┣●━┻━╋━┻━━┫
iluwatar/java-design-patterns 33.92 31.4 / 33.6 / 36.2 1.04 ┣━━┻━━╋●━┻━━┫
ktaranov/sqlserver-kit 23.44 22.1 / 23.4 / 25.3 0.64 ┣━━┻━━●━━┻━━┫
liriliri/licia 7.79 7.5 / 8.0 / 8.7 0.29 ┣━━┻●━╋━━┻━━┫
MartinThoma/LaTeX-examples 13.90 13.6 / 14.1 / 14.9 0.33 ┣━━┻●━╋━━┻━━┫
mdx-js/mdx 3.87 3.7 / 3.9 / 4.3 0.13 ┣━┻━━●━━┻━┫
microsoft/TypeScript-Website 18.15 17.4 / 18.4 / 20.4 0.84 ┣━━┻━●╋━━┻━━┫
MicrosoftDocs/PowerShell-Docs 88.00 85.7 / 90.0 / 98.0 2.44 ┣━━━●━━╋━━┻━━━┫
neovim/nvim-lspconfig 9.13 8.8 / 9.2 / 10.6 0.35 ┣━━┻━●╋━━┻━━┫
pagekit/pagekit 7.60 7.3 / 7.7 / 8.3 0.20 ┣━┻━●╋━━┻━┫
php/php-src 112.54 110.9 / 116.5 / 139.3 5.04 ┣━━┻●━━╋━━━┻━━┫
plasticrake/tplink-smarthome-api 1.54 1.5 / 1.5 / 1.7 0.05 ┣━━┻━●━┻━━┫
prettier/prettier 13.53 12.8 / 13.5 / 14.2 0.34 ┣━━┻━━╋●━┻━━┫
pycontribs/jira 2.62 2.6 / 2.7 / 3.1 0.10 ┣━┻●━╋━━┻━┫
RustPython/RustPython 14.21 14.0 / 14.5 / 15.1 0.34 ┣━━┻●━╋━━┻━━┫
shoelace-style/shoelace 7.75 7.1 / 7.4 / 8.5 0.28 ┣━━┻━━╋━━●━━┫
SoftwareBrothers/admin-bro 4.56 4.5 / 4.7 / 5.0 0.12 ┣━┻●━╋━━┻━┫
sveltejs/svelte 35.81 36.5 / 37.9 / 39.5 0.74 ● ┣━━┻━━╋━━┻━━┫
TheAlgorithms/Python 16.61 16.4 / 17.1 / 18.9 0.53 ┣━━●━━╋━━┻━━┫
twbs/bootstrap 3.69 3.6 / 3.7 / 4.0 0.10 ┣━┻━●╋━━┻━┫
typescript-cheatsheets/react 2.25 2.0 / 2.1 / 2.3 0.07 ┣━━┻━╋━┻━●┫
typescript-eslint/typescript-eslint 6.92 6.4 / 6.8 / 7.5 0.27 ┣━━┻━━╋━●┻━━┫
w3c/aria-practices 9.75 9.2 / 9.7 / 10.8 0.34 ┣━━┻━━●━━┻━━┫
w3c/specberus 2.94 2.8 / 3.0 / 3.3 0.09 ┣━┻━●╋━━┻━┫
webdeveric/webpack-assets-manifest 0.84 0.8 / 0.8 / 1.0 0.04 ┣━━┻━●━┻━━┫
webpack/webpack 12.36 11.8 / 12.3 / 13.0 0.33 ┣━━┻━━╋●━┻━━┫
wireapp/wire-desktop 1.43 1.2 / 1.3 / 1.6 0.07 ┣━━┻━╋━┻●━┫
wireapp/wire-webapp 21.02 20.8 / 21.6 / 22.7 0.52 ┣━●┻━━╋━━┻━━┫
Repository Elapsed Rel Trend Count
AdaDoom3/AdaDoom3 12.36 -0.00% ▃▃▂▄▆▄▄▅▄▃▄▃▂█▅▅▅▅▃▄ 33
alexiosc/megistos 30.95 -0.37% ▂▃▆▆▅▁▃▃▅▄▅▂▁▃▄█▄▄▃ 33
apollographql/apollo-server 6.53 -3.19% ▃▃▇▅▄▃▃▆▅▃▆▂▂▄▃▃▃▃▂▂ 33
aspnetboilerplate/aspnetboilerplate 24.38 -1.81% ▄▃▄▆▂▄▇▆▃▄▃▄▃▂▃█▄▂▅▃ 35
aws-amplify/docs 36.87 -2.21% ▃▃▃▄▄▄█▃▃▄▃▄▃▃▃▃▃▄▃▃ 35
Azure/azure-rest-api-specs 31.12 -3.18% ▅▆▅▃▃▃▂▅▂▃▄▇▁▃▄▂▃▄▇▂ 35
bitjson/typescript-starter 0.81 -6.75% ▄▄▃▄▂▃▄▃▃█▃▃▃▃▃▄▃▃█▂ 33
caddyserver/caddy 11.40 -3.68% ▄▃▄▃▆▃▄▅▄▂▃▆▄▅▅▇▅▂▇▂ 35
canada-ca/open-source-logiciel-libre 0.98 -1.26% ▂▃ ▄▃▆▅▅▅▃▂▂▄▅▃▂▅▃▂▃ 33
chef/chef 20.40 -1.82% ▃▆▃▃▄▆▃▄▆▂▄▂▆▃▇▆▅▅▄▃ 35
django/django 51.29 -3.12% ▇▆▃▄▅▃▂▅▅▅▄▄▃▄▄▅█▃▃▂ 35
eslint/eslint 30.92 -2.53% ▂▆▄▄▇▂▃▃▄▃▄▃▃▃█▂▂▃▅▂ 35
exonum/exonum 12.05 2.12% ▃▂▂▃▃▃▅▃▄▅▃▃▃▅▅█▄▃▄▅ 33
gitbucket/gitbucket 6.83 -2.45% ▇▃▅▄▄▂▄▆▃▂▆▁▃▅▂▆▆▂▃▂ 35
googleapis/google-cloud-cpp 403.43 1.73% ▂▄▄▅▇▂▃▇▃▄▃▂▃▅▄▇▂▆▆▅ 35
graphql/express-graphql 0.91 -1.85% ▂▃▂▄▆▄▄▃▄▆▄▅▄▂▅▄▂▆▅▃ 33
graphql/graphql-js 6.20 2.75% ▂▂▂▃▃▃▄▄▂▃▄▃▆█▄▄▅▄▄▅ 35
graphql/graphql-relay-js 1.08 14.22% ▂▂▂▃▅▇▄▃▄▃▂▄▃▃██▄▂▄█ 33
graphql/graphql-spec 1.81 -4.74% ▅▃▅▅▂▇▂▃▆▃▃▃▂▂▄▅▂▅█▁ 34
iluwatar/java-design-patterns 33.92 0.97% ▄▂▆▃▅▆▄▄▇▃▂▃▄▄▇▃▄▄▃▄ 35
ktaranov/sqlserver-kit 23.44 0.31% ▃▅▄▄▇▂▃▄▃▃▁▄▃▄▅▄▄▄▆▄ 33
liriliri/licia 7.79 -2.66% ▄▃▆▇▅▁▄▁▅▃▂▄▄▃▄▄▅▃▂▃ 35
MartinThoma/LaTeX-examples 13.90 -1.55% ▆▄▆▅▂▅▅▆▃▃▂▃▆▃▄▂▇▃▅▃ 33
mdx-js/mdx 3.87 -0.18% ▃▃▅▂▂▅▂▅▂▅▅▃▃▃▃▅▃█▄▄ 34
microsoft/TypeScript-Website 18.15 -1.49% ▂▃▃▃▂▂▃▃▅▂▃▂▃▆▄▂▃▃▂▃ 35
MicrosoftDocs/PowerShell-Docs 88.00 -2.22% ▇▂▃▃▅▃▆▄▄▃▂▂▄▃▅█▆▅▃▂ 35
neovim/nvim-lspconfig 9.13 -0.85% ▃▄▃▂▃▃▃▃▂▄▄▂▅▄▄█▆█▃▃ 35
pagekit/pagekit 7.60 -0.86% ▄▂▅▂▃▅▁▅▅▂▂▅▅▃▃▅▄▃▂▃ 33
php/php-src 112.54 -3.37% ▄▄▄▄▄▃▂▂▃▂▃▅▃▅▅▄▄▃▅▂ 35
plasticrake/tplink-smarthome-api 1.54 0.09% ▂█▄▄▄▄▃▆▃▃▃▄▂▂█▄▂▂▄▄ 33
prettier/prettier 13.53 0.46% ▃▅▂▅▃▅▅▇▂▄▃▃▂▆▆▃▆▄▅▄ 35
pycontribs/jira 2.62 -2.77% ▂▂▃▄▃█▂▃▄▅▄▂▅▃▇▃▃▂▄▃ 33
RustPython/RustPython 14.21 -1.90% ▆▆▂▃▃▆▂▆▄▃▁▆▁▅▅▅▂▃▄▂ 35
shoelace-style/shoelace 7.75 4.58% ▃▃▃▃▃▂▃▃▆▄▃▄▃▂▇▄▃▄▃▆ 35
SoftwareBrothers/admin-bro 4.56 -1.95% ▄▃█▃▆▃▆▂▁▇▄▃▃▅▆▃▂▄▂▃ 33
sveltejs/svelte 35.81 -5.61% ▄▃▇▄▃▄▂▅▃▃▂▄▂▁▂▄▆▅▃ 35
TheAlgorithms/Python 16.61 -3.00% ▄▄▅▇▃▃▅▆▃▅▄▂▃▅█▆▄▂▂▂ 35
twbs/bootstrap 3.69 -1.01% ▁▁▇▄▅▄▅▂▃▆▂▂▃▄▃▂▄▅▄▃ 34
typescript-cheatsheets/react 2.25 5.66% ▅▄▃▂▄▃▅▇▅▃▃▃▂▃▄█▄▂▄▆ 34
typescript-eslint/typescript-eslint 6.92 2.30% ▃▂▃▂▃▂▂▄▃▄▆▃▃▄█▃▄▃▅▅ 35
w3c/aria-practices 9.75 0.11% ▂▂▃▃▅▄▄▂▃▃▃▄▂▂▅▅▃█▅▄ 33
w3c/specberus 2.94 -0.88% ▄▄▂▃▆▃▃▇▃█▃▅▄▅▂▃▂▄▄▃ 35
webdeveric/webpack-assets-manifest 0.84 -0.65% ▂▃▃▃▃▄▄▃▄▂▅▅▂▃▄▃▃▃▃▃ 33
webpack/webpack 12.36 0.69% ▆▂▃▄▆▄▅▆▂▅▄▁▃▄▅▇▃▂▃▄ 35
wireapp/wire-desktop 1.43 6.11% ▅▃▄▃▄▃▄▃▃▃▅▃▃ ▄▆▃▃▅▆ 35
wireapp/wire-webapp 21.02 -2.86% ▁▃▄▄▅▄▆▇▄▃▃▃▁▃▂▇▅▃▃▂ 35

Note:

  • Elapsed time is in seconds. The trend graph shows the last 10 runs.
    The SD graph shows the current run relative to the average and standard deviation.
  • Rel is the relative change from the average.

@Jason3S Jason3S marked this pull request as ready for review June 29, 2024 17:22
@Jason3S Jason3S merged commit 8081fca into main Jun 29, 2024
84 checks passed
@Jason3S Jason3S deleted the dev-glob branch June 29, 2024 17:25
@ccoVeille
Copy link

The amount of change needed for this feature is impressive

@Jason3S
Copy link
Collaborator Author

Jason3S commented Jun 30, 2024

The amount of change needed for this feature is impressive

It was more than I had hoped for. It also includes performance tests and prep work for adding URL support to the gitignore library.

The goal:

To be able to test globs against URLs as well as file paths.

Why

The spell checker extension in VS Code needs to support spell checking remote files. These come in the form like: vscode-vfs://github/un-ts/synckit/yarn.lock for editing a remote GitHub repository. It is necessary for ignorePaths to correctly match against the yarn.lock and indicate that it should not be spell checked. It is also necessary to use the VS Code File System to read/write to these file.

Problem

Most JavaScript libraries (like the popular find-up and globby packages) have a hard dependency upon NodeJS.fs to read/write files. Since, Dependency Injection is not yet very common, this has lead me to writing my own libraries.

Solution / Workaround

I ended up creating the following libraries:

  • cspell-io - to handle file IO with the intent to support a Browser version of CSpell. This library supports registering custom URL handlers.
  • cspell-glob - to have a consistent glob matching library that doesn't need a file system and tries to mimic .gitignore globs.
  • cspell-gitignore - a library to read .gitignore files and provide .gitignore like filtering. (There is a setting that prevents files from being spell checked if they are .gitignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants