From d818dd022d803ea93db34d1a6ccca56a05d54348 Mon Sep 17 00:00:00 2001 From: Medhat Omr <1138835+momr@users.noreply.github.com> Date: Fri, 22 Nov 2024 10:05:12 -0600 Subject: [PATCH 1/2] Add C# cell executor support in VSCode (#606) Co-authored-by: M Essmat --- apps/vscode/src/host/executors.ts | 20 ++++++++++++++++++++ apps/vscode/src/host/hooks.ts | 1 + 2 files changed, 21 insertions(+) diff --git a/apps/vscode/src/host/executors.ts b/apps/vscode/src/host/executors.ts index 0fa1a570..fddfe2b5 100644 --- a/apps/vscode/src/host/executors.ts +++ b/apps/vscode/src/host/executors.ts @@ -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[]) => { @@ -147,6 +166,7 @@ const kCellExecutors = [ bashCellExecutor, shCellExecutor, shellCellExecutor, + csharpCellExecutor ]; function findExecutor( diff --git a/apps/vscode/src/host/hooks.ts b/apps/vscode/src/host/hooks.ts index 9c826762..3b0b6965 100644 --- a/apps/vscode/src/host/hooks.ts +++ b/apps/vscode/src/host/hooks.ts @@ -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 => { From 772c6501b6a033166b41c4cd07da2e0c50b3d9e4 Mon Sep 17 00:00:00 2001 From: Julia Silge Date: Tue, 26 Nov 2024 10:13:11 -0700 Subject: [PATCH 2/2] Do not force snippet suggestions to the bottom of completions (#609) * Do not force snippet suggestions to the bottom of completions * Update changelog --- apps/vscode/CHANGELOG.md | 1 + apps/vscode/package.json | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/vscode/CHANGELOG.md b/apps/vscode/CHANGELOG.md index 5a979c7d..490e1432 100644 --- a/apps/vscode/CHANGELOG.md +++ b/apps/vscode/CHANGELOG.md @@ -4,6 +4,7 @@ - Provide F1 help at cursor in Positron () - Expose new context keys for the language of a specific cell () +- No longer send all snippet suggestions to the bottom of the completion list (). ## 1.117.0 (Release on 2024-11-07) diff --git a/apps/vscode/package.json b/apps/vscode/package.json index 118b1b7b..43169692 100644 --- a/apps/vscode/package.json +++ b/apps/vscode/package.json @@ -896,7 +896,6 @@ "strings": "on" }, "editor.quickSuggestionsDelay": 250, - "editor.snippetSuggestions": "bottom", "editor.wordBasedSuggestions": "off", "editor.suggestOnTriggerCharacters": true, "editor.unicodeHighlight.ambiguousCharacters": false,