-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from davelopez/add_wf_tests_document_support
Add basic support for Workflow Test Files '*-test.yml'
- Loading branch information
Showing
92 changed files
with
13,810 additions
and
620 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
CleanWorkflowContentsParams, | ||
CleanWorkflowContentsResult, | ||
CleanWorkflowDocumentParams, | ||
CleanWorkflowDocumentResult, | ||
GetWorkflowInputsResult, | ||
GetWorkflowOutputsResult, | ||
LSRequestIdentifiers, | ||
TargetWorkflowDocumentParams, | ||
} from "../../shared/src/requestsDefinitions"; | ||
|
||
export { | ||
CleanWorkflowContentsParams, | ||
CleanWorkflowContentsResult, | ||
CleanWorkflowDocumentParams, | ||
CleanWorkflowDocumentResult, | ||
GetWorkflowInputsResult, | ||
GetWorkflowOutputsResult, | ||
LSRequestIdentifiers, | ||
TargetWorkflowDocumentParams, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { ExtensionContext, Uri, workspace } from "vscode"; | ||
import { BaseLanguageClient } from "vscode-languageclient"; | ||
import { | ||
getAssociatedWorkflowUriFromTestsUri, | ||
isNativeWorkflowDocument, | ||
isWorkflowTestsDocument, | ||
} from "../common/utils"; | ||
import { | ||
GetWorkflowInputsResult, | ||
GetWorkflowOutputsResult, | ||
LSRequestIdentifiers, | ||
TargetWorkflowDocumentParams, | ||
} from "../languageTypes"; | ||
|
||
export function setupRequests( | ||
context: ExtensionContext, | ||
nativeWorkflowClient: BaseLanguageClient, | ||
gxFormat2Client: BaseLanguageClient | ||
): void { | ||
function createRequestHandler<TResult>(requestIdentifier: string) { | ||
return async (params: TargetWorkflowDocumentParams) => { | ||
let targetUri: Uri | undefined = Uri.parse(params.uri); | ||
if (isWorkflowTestsDocument(targetUri)) { | ||
// If the target is a test file, we need to find the associated workflow file | ||
targetUri = await getAssociatedWorkflowUriFromTestsUri(targetUri); | ||
} | ||
if (!targetUri) { | ||
console.debug("No associated workflow file found for:", params.uri); | ||
return undefined; | ||
} | ||
// Open the file to include it in the document cache | ||
await workspace.openTextDocument(targetUri); | ||
|
||
let languageClient = gxFormat2Client; | ||
if (isNativeWorkflowDocument(targetUri)) { | ||
languageClient = nativeWorkflowClient; | ||
} | ||
const requestParams: TargetWorkflowDocumentParams = { uri: targetUri.toString() }; | ||
const result = await languageClient.sendRequest<TResult>(requestIdentifier, requestParams); | ||
return result; | ||
}; | ||
} | ||
|
||
context.subscriptions.push( | ||
gxFormat2Client.onRequest( | ||
LSRequestIdentifiers.GET_WORKFLOW_INPUTS, | ||
createRequestHandler<GetWorkflowInputsResult>(LSRequestIdentifiers.GET_WORKFLOW_INPUTS) | ||
) | ||
); | ||
|
||
context.subscriptions.push( | ||
gxFormat2Client.onRequest( | ||
LSRequestIdentifiers.GET_WORKFLOW_OUTPUTS, | ||
createRequestHandler<GetWorkflowOutputsResult>(LSRequestIdentifiers.GET_WORKFLOW_OUTPUTS) | ||
) | ||
); | ||
} |
Oops, something went wrong.