-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
124 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
import { IOperationInfo, getCompilerWorker } from "qsharp-lang"; | ||
import { Uri } from "vscode"; | ||
import { sendMessageToPanel } from "./webviewPanel"; | ||
|
||
export async function showDocumentationCommand( | ||
extensionUri: Uri, | ||
_operation: IOperationInfo | undefined, | ||
) { | ||
// Reveal panel an show 'Loading...' for immediate feedback. | ||
sendMessageToPanel( | ||
"documentationPanelType", // This is needed to route the message to the proper panel | ||
true, | ||
null, | ||
); | ||
|
||
// Get std library documentation from compiler. | ||
const compilerWorkerScriptPath = Uri.joinPath( | ||
extensionUri, | ||
"./out/compilerWorker.js", | ||
).toString(); | ||
const worker = getCompilerWorker(compilerWorkerScriptPath); | ||
const content = await worker.getCombinedDocumentation(); | ||
|
||
const message = { | ||
command: "showDocumentationCommand", // This is handled in webview.tsx onMessage | ||
contentToRender: content, | ||
}; | ||
|
||
sendMessageToPanel( | ||
"documentationPanelType", // This is needed to route the message to the proper panel | ||
true, | ||
message, | ||
); | ||
} |
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,13 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
export function DocumentationView(props: { | ||
renderer: (input: string) => string; | ||
contentToRender: string; | ||
}) { | ||
const renderedContent = { | ||
__html: props.renderer(props.contentToRender), | ||
}; | ||
|
||
return <div dangerouslySetInnerHTML={renderedContent} />; | ||
} |
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