@@ -2,7 +2,10 @@ import * as path from "path";
22import * as vscode from "vscode" ;
33
44import { LanguageClient , LanguageClientOptions , ServerOptions , TransportKind } from "vscode-languageclient/node" ;
5+ import { InitializationOptions } from "@github/actions-languageserver/initializationOptions" ;
6+ import { getSession } from "../auth/auth" ;
57import { WorkflowSelector } from "./documentSelector" ;
8+ import { getGitHubContext } from "../git/repository" ;
69
710let client : LanguageClient ;
811
@@ -20,12 +23,26 @@ export async function initLanguageServer(context: vscode.ExtensionContext) {
2023 }
2124 } ;
2225
26+ const session = await getSession ( ) ;
27+
28+ const ghContext = await getGitHubContext ( ) ;
29+ const initializationOptions : InitializationOptions = {
30+ sessionToken : session . accessToken ,
31+ repos : ghContext ?. repos . map ( repo => ( {
32+ id : repo . id ,
33+ owner : repo . owner ,
34+ name : repo . name ,
35+ workspaceUri : repo . workspaceUri . toString ( )
36+ } ) )
37+ } ;
38+
2339 const clientOptions : LanguageClientOptions = {
2440 documentSelector : [ WorkflowSelector ] ,
2541 synchronize : {
2642 // // Notify the server about file changes to '.clientrc files contained in the workspace
2743 // fileEvents: workspace.createFileSystemWatcher("**/.clientrc"),
28- }
44+ } ,
45+ initializationOptions : initializationOptions
2946 } ;
3047
3148 // Create the language client and start the client.
0 commit comments