Skip to content

Commit

Permalink
fix: curly bracket glob escape (#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuisi authored Jan 13, 2025
1 parent dbd82c9 commit 8663c3b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 27 deletions.
58 changes: 37 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions vscode-lean4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1091,11 +1091,9 @@
"markdown-it-anchor": "^9.0.1",
"semver": "^7.6.0",
"vscode-languageclient": "^8.0.2",
"zod": "^3.22.4",
"glob": "^11.0.1"
"zod": "^3.22.4"
},
"devDependencies": {
"@types/glob": "^8.1.0",
"@types/markdown-it": "^14.1.1",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.12",
Expand All @@ -1112,7 +1110,8 @@
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
"webpack-cli": "^5.1.4",
"glob": "^10.4.5"
},
"icon": "images/lean_logo.png",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions vscode-lean4/src/leanclient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as glob from 'glob'
import {
DiagnosticCollection,
Disposable,
Expand Down Expand Up @@ -548,7 +547,8 @@ export class LeanClient implements Disposable {
let workspaceFolder: WorkspaceFolder | undefined
documentSelector.scheme = this.folderUri.scheme
if (this.folderUri.scheme === 'file') {
documentSelector.pattern = `${glob.escape(this.folderUri.fsPath, { windowsPathsNoEscape: true })}/**/*`
const escapedPath = this.folderUri.fsPath.replace(/[?*()[\]{}]/g, '[$&]')
documentSelector.pattern = `${escapedPath}/**/*`
workspaceFolder = {
uri: this.folderUri.asUri(),
name: path.basename(this.folderUri.fsPath),
Expand Down

0 comments on commit 8663c3b

Please sign in to comment.