Skip to content

Eperm error windows #52

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions language-server/src/build-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export const buildServer = (connection, features) => {
}
});

connection.onExit(() => {
connection.dispose();
});

connection.listen();
documents.listen(connection);
};

Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("Feature - Watch File Patterns", () => {
await closeDocument(client, documentUri);
await closeDocument(client, documentUriB);

await tearDownWorkspace(workspaceFolder);
await tearDownWorkspace(client, workspaceFolder);
});

test("watches all files", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("Feature - Watch File Patterns", () => {
await closeDocument(client, documentUri);
await closeDocument(client, documentUriB);

await tearDownWorkspace(workspaceFolder);
await tearDownWorkspace(client, workspaceFolder);
});

test("watches only specified files", async () => {
Expand Down
3 changes: 2 additions & 1 deletion language-server/src/features/workspace-neovim.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import documentSettings from "./document-settings.js";
import schemaRegistry from "./schema-registry.js";

import type { Connection, ServerCapabilities } from "vscode-languageserver";
// import { afterEach } from "node:test";


describe("Feature - workspace (neovim)", () => {
Expand Down Expand Up @@ -49,8 +50,8 @@ describe("Feature - workspace (neovim)", () => {
});

afterAll(async () => {
await tearDownWorkspace(client, workspaceFolder);
client.dispose();
await tearDownWorkspace(workspaceFolder);
});

test("capabilities", async () => {
Expand Down
6 changes: 6 additions & 0 deletions language-server/src/features/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ export default {
await validateSchema(schemaDocument);
}
});

connection.onShutdown(() => {
for (const path in watchers) {
watchers[path].close();
}
});
},

onInitialize({ capabilities, workspaceFolders }) {
Expand Down
2 changes: 1 addition & 1 deletion language-server/src/features/workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe("Feature - workspace", () => {
});

afterAll(async () => {
await tearDownWorkspace(workspaceFolder);
await tearDownWorkspace(client, workspaceFolder);
});

test("capabilities", async () => {
Expand Down
5 changes: 4 additions & 1 deletion language-server/src/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
InitializedNotification,
RegistrationRequest,
SemanticTokensRefreshRequest,
ShutdownRequest,
WorkDoneProgressCreateRequest
} from "vscode-languageserver";
import { createConnection } from "vscode-languageserver/node.js";
Expand Down Expand Up @@ -124,6 +125,8 @@ export const setupWorkspace = async (files: Record<string, string>) => {
return pathToFileURL(workspaceFolder).toString();
};

export const tearDownWorkspace = async (workspaceFolder: string) => {
export const tearDownWorkspace = async (client: Connection, workspaceFolder: string) => {
await client.sendRequest(ShutdownRequest.type);
//await client.sendNotification(ExitNotification.type);
await rm(fileURLToPath(workspaceFolder), { recursive: true });
};