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

handle windows file separator in filesets #240

Merged
merged 14 commits into from
Dec 6, 2024
Next Next commit
handle windows file separator in filesets
  • Loading branch information
phryneas committed Dec 5, 2024
commit 20d73d361ed345bb60935a3e1f425e454bd956c4
6 changes: 3 additions & 3 deletions src/language-server/fileSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { minimatch } from "minimatch";
import { globSync } from "glob";
import { invariant } from "../tools";
import { URI } from "vscode-uri";
import { normalizeURI } from "./utilities";
import { normalizeURI, withUnixSeparator } from "./utilities";
import { resolve } from "path";

export class FileSet {
Expand Down Expand Up @@ -35,13 +35,13 @@ export class FileSet {
this.includes.some((include) => {
return minimatch(
normalizedFilePath,
resolve(this.rootURI.fsPath, include),
withUnixSeparator(resolve(this.rootURI.fsPath, include)),
);
}) &&
!this.excludes.some((exclude) => {
return minimatch(
normalizedFilePath,
resolve(this.rootURI.fsPath, exclude),
withUnixSeparator(resolve(this.rootURI.fsPath, exclude)),
);
})
);
Expand Down
2 changes: 1 addition & 1 deletion src/language-server/utilities/uri.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { URI } from "vscode-uri";

const withUnixSeparator = (uriString: string) =>
export const withUnixSeparator = (uriString: string) =>
uriString.split(/[\/\\]/).join("/");

export const normalizeURI = (uriString: string) => {
Expand Down
Loading