Skip to content

Commit 64a403e

Browse files
committed
Add a custom request for reading files
1 parent 7aa55a6 commit 64a403e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/workflow/languageServer.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ export async function initLanguageServer(context: vscode.ExtensionContext) {
6262
client = new BrowserLanguageClient("actions-language", "GitHub Actions Language Server", clientOptions, worker);
6363
}
6464

65+
client.onRequest("actions/readFile", async (event: {path: string}) => {
66+
if (typeof event?.path !== "string") {
67+
return null;
68+
}
69+
70+
const uri = vscode.Uri.parse(event?.path);
71+
const content = await vscode.workspace.fs.readFile(uri);
72+
return new TextDecoder().decode(content);
73+
});
74+
6575
return client.start();
6676
}
6777

0 commit comments

Comments
 (0)