Provide links to open actions on GitHub

This commit is contained in:
Christopher Schleiden
2022-12-21 13:34:10 +01:00
parent 3bc0cb0b4e
commit 56e8393e0f
6 changed files with 146 additions and 7 deletions
+11 -4
View File
@@ -1,10 +1,11 @@
import {hover} from "@github/actions-languageservice/hover";
import {documentLinks, hover, validate, ValidationConfig} from "@github/actions-languageservice";
import {registerLogger, setLogLevel} from "@github/actions-languageservice/log";
import {validate, ValidationConfig} from "@github/actions-languageservice/validate";
import {Octokit} from "@octokit/rest";
import {
CompletionItem,
Connection,
DocumentLink,
DocumentLinkParams,
Hover,
HoverParams,
InitializeParams,
@@ -61,7 +62,10 @@ export function initConnection(connection: Connection) {
resolveProvider: false,
triggerCharacters: [":", "."]
},
hoverProvider: true
hoverProvider: true,
documentLinkProvider: {
resolveProvider: false
}
}
};
@@ -103,7 +107,6 @@ export function initConnection(connection: Connection) {
connection.sendDiagnostics({uri: textDocument.uri, diagnostics: result});
}
// This handler provides the initial list of the completion items.
connection.onCompletion(async ({position, textDocument}: TextDocumentPositionParams): Promise<CompletionItem[]> => {
return await onCompletion(
position,
@@ -118,6 +121,10 @@ export function initConnection(connection: Connection) {
return hover(documents.get(textDocument.uri)!, position);
});
connection.onDocumentLinks(async ({textDocument}: DocumentLinkParams): Promise<DocumentLink[] | null> => {
return documentLinks(documents.get(textDocument.uri)!);
});
// Make the text document manager listen on the connection
// for open, change and close text document events
documents.listen(connection);
@@ -1,5 +1,5 @@
import {data} from "@github/actions-expressions";
import {ContextProviderConfig} from "@github/actions-languageservice/.";
import {ContextProviderConfig} from "@github/actions-languageservice";
import {WorkflowContext} from "@github/actions-languageservice/context/workflow-context";
import {Octokit} from "@octokit/rest";
import {getSecrets} from "./context-providers/secrets";