Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C# cell executor support in VSCode #606

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/vscode/src/host/executors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ const juliaCellExecutor: VSCodeCellExecutor = {
},
};

const csharpCellExecutor: VSCodeCellExecutor = {
language: "csharp",
requiredExtension: ["ms-dotnettools.dotnet-interactive-vscode"],
requiredExtensionName: "Polyglot Notebooks",
requiredVersion: "1.0.55", // Adjust minimum version as needed
execute: async (blocks: string[], editorUri?: Uri) => {
const extension = extensions.getExtension("ms-dotnettools.dotnet-interactive-vscode");
if (extension) {
if (!extension.isActive) {
await extension.activate();
}

await jupyterCellExecutor("csharp").execute(blocks);
} else {
window.showErrorMessage("Unable to execute code - Polyglot Notebooks extension not found");
}
}
};

const bashCellExecutor: VSCodeCellExecutor = {
language: "bash",
execute: async (blocks: string[]) => {
Expand All @@ -147,6 +166,7 @@ const kCellExecutors = [
bashCellExecutor,
shCellExecutor,
shellCellExecutor,
csharpCellExecutor
];

function findExecutor(
Expand Down
1 change: 1 addition & 0 deletions apps/vscode/src/host/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export function hooksExtensionHost(): ExtensionHost {
switch (language) {
// use hooks for known runtimes
case "python":
case "csharp":
case "r":
return {
execute: async (blocks: string[], _editorUri?: vscode.Uri): Promise<void> => {
Expand Down